[java-plugin-shibd] branch main updated: Override Object methods for comparisons.

Codeberg noreply at shibboleth.net
Tue Aug 18 15:58:03 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd/commit/3eb5262d374544388bd9391eb488758c0b52be4c

The following commit(s) were added to refs/heads/main by this push:
     new 3eb5262  Override Object methods for comparisons.
3eb5262 is described below

commit 3eb5262d374544388bd9391eb488758c0b52be4c
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Aug 18 11:57:47 2026 -0400

    Override Object methods for comparisons.
---
 .../java/net/shibboleth/sp/AgentIDCriterion.java   | 43 +++++++++++++++++++++
 .../net/shibboleth/sp/ApplicationIDCriterion.java  | 44 ++++++++++++++++++++++
 2 files changed, 87 insertions(+)

diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/AgentIDCriterion.java b/sp-server-api/src/main/java/net/shibboleth/sp/AgentIDCriterion.java
index 35f6a86..7fd36d5 100644
--- a/sp-server-api/src/main/java/net/shibboleth/sp/AgentIDCriterion.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/AgentIDCriterion.java
@@ -37,6 +37,15 @@ public class AgentIDCriterion implements Criterion {
     public AgentIDCriterion(@Nonnull @NotEmpty final String id) {
         agentId = Constraint.isNotNull(StringSupport.trimOrNull(id), "Agent ID cannot be null or empty");
     }
+
+    /**
+     * Constructor.
+     *
+     * @param agent the particular agent
+     */
+    public AgentIDCriterion(@Nonnull final Agent agent) {
+        agentId = Constraint.isNotNull(StringSupport.trimOrNull(agent.getId()), "Agent ID cannot be null or empty");
+    }
     
     /**
      * Get the agent ID specified.
@@ -47,4 +56,38 @@ public class AgentIDCriterion implements Criterion {
         return agentId;
     }
 
+    /** {@inheritDoc} */
+    @Override
+    @Nonnull public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("AgentIDCriterion [id=");
+        builder.append(agentId);
+        builder.append("]");
+        return builder.toString();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int hashCode() {
+        return agentId.hashCode();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj == null) {
+            return false;
+        }
+
+        if (obj instanceof AgentIDCriterion) {
+            return agentId.equals(((AgentIDCriterion) obj).agentId);
+        }
+
+        return false;
+    }
+    
 }
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationIDCriterion.java b/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationIDCriterion.java
index d4dcc10..0f3212e 100644
--- a/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationIDCriterion.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/ApplicationIDCriterion.java
@@ -37,6 +37,16 @@ public class ApplicationIDCriterion implements Criterion {
     public ApplicationIDCriterion(@Nonnull @NotEmpty final String id) {
         applicationId = Constraint.isNotNull(StringSupport.trimOrNull(id), "Application ID cannot be null or empty");
     }
+
+    /**
+     * Constructor.
+     *
+     * @param app the particular application
+     */
+    public ApplicationIDCriterion(@Nonnull final Application app) {
+        applicationId = Constraint.isNotNull(StringSupport.trimOrNull(app.getApplicationId()),
+                "Application ID cannot be null or empty");
+    }
     
     /**
      * Get the application ID specified.
@@ -47,4 +57,38 @@ public class ApplicationIDCriterion implements Criterion {
         return applicationId;
     }
 
+    /** {@inheritDoc} */
+    @Override
+    @Nonnull public String toString() {
+        final StringBuilder builder = new StringBuilder();
+        builder.append("ApplicationIDCriterion [id=");
+        builder.append(applicationId);
+        builder.append("]");
+        return builder.toString();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int hashCode() {
+        return applicationId.hashCode();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj == null) {
+            return false;
+        }
+
+        if (obj instanceof ApplicationIDCriterion) {
+            return applicationId.equals(((ApplicationIDCriterion) obj).applicationId);
+        }
+
+        return false;
+    }
+    
 }
\ 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