[spring-extensions] branch main updated: Make input types setter Spring-friendly.

Scott Cantor cantor.2 at osu.edu
Tue Mar 9 20:49:03 UTC 2021


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=c59c488538fb8a9ab088d548b26af8a911d89387

The following commit(s) were added to refs/heads/main by this push:
       new  c59c488   Make input types setter Spring-friendly.
c59c488 is described below

commit c59c488538fb8a9ab088d548b26af8a911d89387
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Mar 9 15:49:01 2021 -0500

    Make input types setter Spring-friendly.
---
 .../spring/util/SpringExpressionBiConsumer.java    | 23 +++++++++++-----------
 .../spring/util/SpringExpressionBiFunction.java    | 23 +++++++++++-----------
 .../spring/util/SpringExpressionBiPredicate.java   | 23 +++++++++++-----------
 3 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiConsumer.java b/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiConsumer.java
index dd76714..2c6cc2c 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiConsumer.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiConsumer.java
@@ -44,11 +44,8 @@ public class SpringExpressionBiConsumer<T,U> extends AbstractSpringExpressionEva
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(SpringExpressionBiConsumer.class);
 
-    /** Input type 1. */
-    @Nullable private Class<T> inputTypeClass1;
-
-    /** Input type 2. */
-    @Nullable private Class<U> inputTypeClass2;
+    /** Input types. */
+    @Nullable private Pair<Class<T>,Class<U>> inputTypes;
 
     /**
      * Constructor.
@@ -65,18 +62,20 @@ public class SpringExpressionBiConsumer<T,U> extends AbstractSpringExpressionEva
      * @return input type
      */
     @Nullable public Pair<Class<T>,Class<U>> getInputTypes() {
-        return new Pair<>(inputTypeClass1, inputTypeClass2);
+        return inputTypes;
     }
 
     /**
-     * Set the input type to be enforced.
+     * Set the input types to be enforced.
      *
-     * @param type1 first input type
-     * @param type2 second input type
+     * @param types the input types
      */
-    public void setInputTypes(@Nullable final Class<T> type1, @Nullable final Class<U> type2) {
-        inputTypeClass1 = type1;
-        inputTypeClass2 = type2;
+    public void setInputTypes(@Nullable final Pair<Class<T>,Class<U>> types) {
+        if (types != null && types.getFirst() != null && types.getSecond() != null) {
+            inputTypes = types;
+        } else {
+            inputTypes = null;
+        }
     }
     
     /** {@inheritDoc} */
diff --git a/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiFunction.java b/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiFunction.java
index d95f0ea..ccadcbc 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiFunction.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiFunction.java
@@ -45,11 +45,8 @@ public class SpringExpressionBiFunction<T,U,V> extends AbstractSpringExpressionE
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(SpringExpressionBiFunction.class);
 
-    /** Input type 1. */
-    @Nullable private Class<T> inputTypeClass1;
-
-    /** Input type 2. */
-    @Nullable private Class<U> inputTypeClass2;
+    /** Input types. */
+    @Nullable private Pair<Class<T>,Class<U>> inputTypes;
 
     /**
      * Constructor.
@@ -66,18 +63,20 @@ public class SpringExpressionBiFunction<T,U,V> extends AbstractSpringExpressionE
      * @return input type
      */
     @Nullable public Pair<Class<T>,Class<U>> getInputTypes() {
-        return new Pair<>(inputTypeClass1, inputTypeClass2);
+        return inputTypes;
     }
 
     /**
-     * Set the input type to be enforced.
+     * Set the input types to be enforced.
      *
-     * @param type1 first input type
-     * @param type2 second input type
+     * @param types the input types
      */
-    public void setInputTypes(@Nullable final Class<T> type1, @Nullable final Class<U> type2) {
-        inputTypeClass1 = type1;
-        inputTypeClass2 = type2;
+    public void setInputTypes(@Nullable final Pair<Class<T>,Class<U>> types) {
+        if (types != null && types.getFirst() != null && types.getSecond() != null) {
+            inputTypes = types;
+        } else {
+            inputTypes = null;
+        }
     }
 
     /**
diff --git a/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiPredicate.java b/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiPredicate.java
index 4731b6d..60a8f16 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiPredicate.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/SpringExpressionBiPredicate.java
@@ -44,11 +44,8 @@ public class SpringExpressionBiPredicate<T,U> extends AbstractSpringExpressionEv
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(SpringExpressionBiPredicate.class);
 
-    /** Input type 1. */
-    @Nullable private Class<T> inputTypeClass1;
-
-    /** Input type 2. */
-    @Nullable private Class<U> inputTypeClass2;
+    /** Input types. */
+    @Nullable private Pair<Class<T>,Class<U>> inputTypes;
 
     /**
      * Constructor.
@@ -67,18 +64,20 @@ public class SpringExpressionBiPredicate<T,U> extends AbstractSpringExpressionEv
      * @return input type
      */
     @Nullable public Pair<Class<T>,Class<U>> getInputTypes() {
-        return new Pair<>(inputTypeClass1, inputTypeClass2);
+        return inputTypes;
     }
 
     /**
-     * Set the input type to be enforced.
+     * Set the input types to be enforced.
      *
-     * @param type1 first input type
-     * @param type2 second input type
+     * @param types the input types
      */
-    public void setInputTypes(@Nullable final Class<T> type1, @Nullable final Class<U> type2) {
-        inputTypeClass1 = type1;
-        inputTypeClass2 = type2;
+    public void setInputTypes(@Nullable final Pair<Class<T>,Class<U>> types) {
+        if (types != null && types.getFirst() != null && types.getSecond() != null) {
+            inputTypes = types;
+        } else {
+            inputTypes = null;
+        }
     }
     
     /**

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list