[java-support] branch main updated: Make input type setter Spring-friendly.

Scott Cantor cantor.2 at osu.edu
Tue Mar 9 20:48:38 UTC 2021


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

scantor pushed a commit to branch main
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=e120969c32ead89ea1f38791e0b33a0caa39a5d5

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

commit e120969c32ead89ea1f38791e0b33a0caa39a5d5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Mar 9 15:48:36 2021 -0500

    Make input type setter Spring-friendly.
---
 .../java/support/logic/ScriptedBiConsumer.java     | 23 +++++++++++-----------
 .../java/support/logic/ScriptedBiFunction.java     | 23 +++++++++++-----------
 .../java/support/logic/ScriptedBiPredicate.java    | 21 ++++++++++----------
 3 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiConsumer.java b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiConsumer.java
index 3628471..d2abaee 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiConsumer.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiConsumer.java
@@ -49,11 +49,8 @@ public class ScriptedBiConsumer<T,U> extends AbstractScriptEvaluator implements
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(ScriptedBiConsumer.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.
@@ -83,18 +80,20 @@ public class ScriptedBiConsumer<T,U> extends AbstractScriptEvaluator implements
      * @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/utilities/java/support/logic/ScriptedBiFunction.java b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiFunction.java
index 4e5b0f1..54e5c0e 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiFunction.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiFunction.java
@@ -50,11 +50,8 @@ public class ScriptedBiFunction<T,U,V> extends AbstractScriptEvaluator implement
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(ScriptedBiFunction.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.
@@ -84,18 +81,20 @@ public class ScriptedBiFunction<T,U,V> extends AbstractScriptEvaluator implement
      * @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/utilities/java/support/logic/ScriptedBiPredicate.java b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiPredicate.java
index c3a8b8e..4b9d4bf 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiPredicate.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/ScriptedBiPredicate.java
@@ -50,10 +50,7 @@ public class ScriptedBiPredicate<T,U> extends AbstractScriptEvaluator implements
     @Nonnull private final Logger log = LoggerFactory.getLogger(ScriptedBiPredicate.class);
 
     /** Input type 1. */
-    @Nullable private Class<T> inputTypeClass1;
-
-    /** Input type 2. */
-    @Nullable private Class<U> inputTypeClass2;
+    @Nullable private Pair<Class<T>,Class<U>> inputTypes;
 
     /**
      * Constructor.
@@ -87,18 +84,20 @@ public class ScriptedBiPredicate<T,U> extends AbstractScriptEvaluator implements
      * @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