[java-support] branch master updated: Adjust Function->Predicate adapter default handling.

Scott Cantor cantor.2 at osu.edu
Mon Mar 27 10:26:04 EDT 2017


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

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

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

The following commit(s) were added to refs/heads/master by this push:
       new  cbec926   Adjust Function->Predicate adapter default handling.
cbec926 is described below

commit cbec92696395ac7ecccd44bddf2328d56f3cde08
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Mar 27 10:26:01 2017 -0400

    Adjust Function->Predicate adapter default handling.
---
 .../utilities/java/support/logic/PredicateSupport.java         | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java b/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
index 0831f46..cc4b5c0 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/PredicateSupport.java
@@ -75,16 +75,18 @@ public final class PredicateSupport {
      * @param <T> type of function input
      * 
      * @param function function to apply to input
-     * @param defValue default value if function returns null
+     * @param defValue default predicate to apply if function returns null
      * 
-     * @return a predicate adapter 
+     * @return a predicate adapter
+     * 
+     *  @since 7.4.0
      */
     @Nonnull public static <T> Predicate<T> fromFunction(@Nonnull final Function<T,Boolean> function,
-            final boolean defValue) {
+            @Nonnull final Predicate<T> defValue) {
         return new Predicate<T>() {
             public boolean apply(@Nullable final T input) {
                 final Boolean result = function.apply(input);
-                return result != null ? result : defValue;
+                return result != null ? result : defValue.apply(input);
             }
         };
     }

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


More information about the commits mailing list