[java-support] branch master updated: Add a method reference helper for Spring wiring.
Scott Cantor
cantor.2 at osu.edu
Tue May 21 12:34:22 EDT 2019
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=4de63e1d0c07416fe5ae6c487e768b4f75511f3e
The following commit(s) were added to refs/heads/master by this push:
new 4de63e1 Add a method reference helper for Spring wiring.
4de63e1 is described below
commit 4de63e1d0c07416fe5ae6c487e768b4f75511f3e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue May 21 12:34:20 2019 -0400
Add a method reference helper for Spring wiring.
---
.../utilities/java/support/logic/FunctionSupport.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java b/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
index dbf7c63..4dd1f6e 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/FunctionSupport.java
@@ -68,4 +68,18 @@ public final class FunctionSupport {
return g.compose(f);
}
+ /**
+ * Creates a function that returns the same boolean output as the given predicate for all inputs.
+ *
+ * <p>Primarily provided for Spring wiring use cases that can't express a method reference.</p>
+ *
+ * @param <T> input type
+ * @param predicate input predicate
+ *
+ * @return a corresponding function
+ */
+ @Nonnull public static <T> Function<T,Boolean> forPredicate(@Nonnull final Predicate<T> predicate) {
+ return predicate::test;
+ }
+
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list