You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2022/11/06 19:21:35 UTC

[ws-axiom] branch master updated: Use lambdas

This is an automated email from the ASF dual-hosted git repository.

veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-axiom.git


The following commit(s) were added to refs/heads/master by this push:
     new cc2fe8537 Use lambdas
cc2fe8537 is described below

commit cc2fe8537fdaab691ef92e29f0480ae7e40d5440
Author: Andreas Veithen <an...@gmail.com>
AuthorDate: Sun Nov 6 19:21:29 2022 +0000

    Use lambdas
---
 .../src/main/java/org/apache/axiom/attachments/Attachments.java  | 9 ++-------
 axiom-api/src/main/java/org/apache/axiom/blob/MemoryBlob.java    | 7 +------
 .../test/java/org/apache/axiom/blob/OverflowableBlobTest.java    | 9 +++------
 3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java b/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
index db40cc704..b7696d810 100644
--- a/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
+++ b/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
@@ -106,14 +106,9 @@ public class Attachments implements OMAttachmentAccessor {
         }
         WritableBlobFactory<?> attachmentBlobFactory;
         if (fileCacheEnable) {
-            final WritableBlobFactory<?> tempFileBlobFactory = new LegacyTempFileBlobFactory(this, attachmentRepoDir);
+            WritableBlobFactory<?> tempFileBlobFactory = new LegacyTempFileBlobFactory(this, attachmentRepoDir);
             if (fileStorageThreshold > 0) {
-                attachmentBlobFactory = new WritableBlobFactory<WritableBlob>() {
-                    @Override
-                    public WritableBlob createBlob() {
-                        return Blobs.createOverflowableBlob(fileStorageThreshold, tempFileBlobFactory);
-                    }
-                };
+                attachmentBlobFactory = () -> Blobs.createOverflowableBlob(fileStorageThreshold, tempFileBlobFactory);
             } else {
                 attachmentBlobFactory = tempFileBlobFactory;
             }
diff --git a/axiom-api/src/main/java/org/apache/axiom/blob/MemoryBlob.java b/axiom-api/src/main/java/org/apache/axiom/blob/MemoryBlob.java
index f9b63786c..b12235f0d 100644
--- a/axiom-api/src/main/java/org/apache/axiom/blob/MemoryBlob.java
+++ b/axiom-api/src/main/java/org/apache/axiom/blob/MemoryBlob.java
@@ -30,12 +30,7 @@ import java.io.IOException;
  * Instances are created with {@link Blobs#createMemoryBlob()} or using {@link #FACTORY}.
  */
 public interface MemoryBlob extends WritableBlob {
-    WritableBlobFactory<MemoryBlob> FACTORY = new WritableBlobFactory<MemoryBlob>() {
-        @Override
-        public MemoryBlob createBlob() {
-            return new MemoryBlobImpl();
-        }
-    };
+    WritableBlobFactory<MemoryBlob> FACTORY = MemoryBlobImpl::new;
 
     @Override
     MemoryBlobInputStream getInputStream();
diff --git a/axiom-api/src/test/java/org/apache/axiom/blob/OverflowableBlobTest.java b/axiom-api/src/test/java/org/apache/axiom/blob/OverflowableBlobTest.java
index db033d2ef..6e3e85a11 100644
--- a/axiom-api/src/test/java/org/apache/axiom/blob/OverflowableBlobTest.java
+++ b/axiom-api/src/test/java/org/apache/axiom/blob/OverflowableBlobTest.java
@@ -25,11 +25,8 @@ import junit.framework.TestSuite;
 
 public class OverflowableBlobTest extends TestCase {
     public static TestSuite suite() {
-        return new WritableBlobTestSuiteBuilder(new WritableBlobFactory<OverflowableBlob>() {
-            @Override
-            public OverflowableBlob createBlob() {
-                return Blobs.createOverflowableBlob(16*1024, "test", ".dat", null);
-            }
-        }, new int[] { 10000, 16*1024, 100000 }, true, false).build();
+        return new WritableBlobTestSuiteBuilder(
+                () -> Blobs.createOverflowableBlob(16*1024, "test", ".dat", null),
+                new int[] { 10000, 16*1024, 100000 }, true, false).build();
     }
 }