[java-shib-shared] 01/02: IDP-1793 Use Suppliers for HttpRequest/Response
Rod Widdowson
rdw at steadingsoftware.com
Thu Nov 24 11:00:52 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw 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=17e9af6b52b38e545a444a63d5fde97374f01bd0
commit 17e9af6b52b38e545a444a63d5fde97374f01bd0
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Nov 23 17:17:03 2022 +0000
IDP-1793 Use Suppliers for HttpRequest/Response
https://shibboleth.atlassian.net/browse/IDP-1793
Concrete implementation of a Supplier which is guaranteed
to return a non null value
---
.../shared/testing/ConstantSupplier.java | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/shib-testing/src/main/java/net/shibboleth/shared/testing/ConstantSupplier.java b/shib-testing/src/main/java/net/shibboleth/shared/testing/ConstantSupplier.java
new file mode 100644
index 00000000..16c270e7
--- /dev/null
+++ b/shib-testing/src/main/java/net/shibboleth/shared/testing/ConstantSupplier.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.shared.testing;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.shared.primitive.NonNullSupplier;
+
+/**
+ * Implementaion of {@link NonNullSupplier} which returns an unchanging
+ * value/
+ */
+public final class ConstantSupplier<T> implements NonNullSupplier<T> {
+
+ /** The value we will return */
+ @Nonnull private final T theValue;
+
+ /**
+ * Constructor.
+ *
+ * @param value the value to set
+ */
+ public ConstantSupplier(@Nonnull final T value) {
+ theValue = value;
+ }
+ /** {@inheritDoc} */
+ @Override
+ @Nonnull public T get() {
+ return theValue;
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list