[java-shib-shared] branch main updated: Add factory-method for constant non-null supplier.

Scott Cantor cantor.2 at osu.edu
Mon Dec 5 14:47:56 UTC 2022


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

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

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

The following commit(s) were added to refs/heads/main by this push:
     new dd7a9941 Add factory-method for constant non-null supplier.
dd7a9941 is described below

commit dd7a9941ba6b684c61ad831aff713540015d2ad7
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Dec 5 09:47:29 2022 -0500

    Add factory-method for constant non-null supplier.
---
 .../servlet/impl/RequestResponseContextFilter.java |  4 +++-
 .../shared/primitive/NonnullSupplier.java          | 23 +++++++++++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilter.java b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilter.java
index e044afdb..93edfacb 100644
--- a/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilter.java
+++ b/shib-networking-spring/src/main/java/net/shibboleth/shared/spring/servlet/impl/RequestResponseContextFilter.java
@@ -19,6 +19,8 @@ package net.shibboleth.shared.spring.servlet.impl;
 
 import java.io.IOException;
 
+import javax.annotation.Nonnull;
+
 import jakarta.servlet.Filter;
 import jakarta.servlet.FilterChain;
 import jakarta.servlet.FilterConfig;
@@ -54,7 +56,7 @@ public class RequestResponseContextFilter extends AbstractConditionalFilter impl
 
     /** {@inheritDoc} */
     @Override
-    protected void runFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
+    protected void runFilter(@Nonnull final ServletRequest request, @Nonnull final ServletResponse response, @Nonnull final FilterChain chain)
             throws IOException,
             ServletException {
 
diff --git a/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java b/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java
index de78c766..91bbd6dc 100644
--- a/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java
+++ b/shib-support/src/main/java/net/shibboleth/shared/primitive/NonnullSupplier.java
@@ -26,9 +26,30 @@ import javax.annotation.Nonnull;
  * on the {@link #get()} method.
  * 
  * @param <T> type of object supplied
+ * 
+ * @since 8.4.0
  */
 public interface NonnullSupplier<T> extends Supplier<T> {
 
     /** {@inheritDoc} */
     @Nonnull T get();
-}
+
+    /**
+     * Return a {@link NonnullSupplier} that returns the input argument.
+     * 
+     * @param <T> argument type
+     * @param input input argument to return
+     * 
+     * @return the input argument
+     */
+    @Nonnull static public <T> NonnullSupplier<T> of(@Nonnull final T input) {
+
+        return new NonnullSupplier<T>() {
+            @Override
+            @Nonnull public T get() {
+                return input;
+            }
+        };
+    }
+
+}
\ 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