[java-opensaml] branch main updated: New message context predicate and package.

Codeberg noreply at shibboleth.net
Tue Nov 17 17:09:06 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-opensaml.

View the commit online:
https://codeberg.org/Shibboleth/java-opensaml/commit/cf0a4296b9dfb1bcc406ade5c81b7c98458773ef

The following commit(s) were added to refs/heads/main by this push:
     new cf0a4296b New message context predicate and package.
cf0a4296b is described below

commit cf0a4296b9dfb1bcc406ade5c81b7c98458773ef
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Nov 17 12:08:41 2026 -0500

    New message context predicate and package.
---
 .../context/logic/MessageTypePredicate.java        | 50 ++++++++++++++++++++++
 .../messaging/context/logic/package-info.java      | 18 ++++++++
 2 files changed, 68 insertions(+)

diff --git a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/logic/MessageTypePredicate.java b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/logic/MessageTypePredicate.java
new file mode 100644
index 000000000..a59d3346f
--- /dev/null
+++ b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/logic/MessageTypePredicate.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed 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 org.opensaml.messaging.context.logic;
+
+import java.util.function.Predicate;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.messaging.context.MessageContext;
+
+import net.shibboleth.shared.logic.Constraint;
+
+/**
+ * Condition that evaluates a message context for a specific message type.
+ * 
+ * @since 5.3.0
+ */
+public class MessageTypePredicate implements Predicate<MessageContext> {
+
+    /** Type to check for. */
+    @Nonnull final Class<?> messageType;
+    
+    /**
+     * Constructor.
+     *
+     * @param type message type to check for
+     */
+    public MessageTypePredicate(@Nonnull final Class<?> type) {
+        messageType = Constraint.isNotNull(type, "Message type cannot be null");
+    }
+    
+    /** {@inheritDoc} */
+    public boolean test(@Nullable final MessageContext input) {
+        return input != null && messageType.isInstance(input.getMessage());
+    }
+
+}
\ No newline at end of file
diff --git a/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/logic/package-info.java b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/logic/package-info.java
new file mode 100644
index 000000000..9dab9f030
--- /dev/null
+++ b/opensaml-messaging-api/src/main/java/org/opensaml/messaging/context/logic/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * Licensed 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.
+ */
+
+/**
+ * Predicates over a {@link org.opensaml.messaging.context.MessageContext}.
+ */
+package org.opensaml.messaging.context.logic;
\ 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