[java-opensaml] branch main updated: IDP-2069 - Null Handling Task
Scott Cantor
cantor.2 at osu.edu
Thu Apr 6 12:49:12 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=fe44b88553a5636a9a89c2717a0c5b278f95ae65
The following commit(s) were added to refs/heads/main by this push:
new fe44b8855 IDP-2069 - Null Handling Task
fe44b8855 is described below
commit fe44b88553a5636a9a89c2717a0c5b278f95ae65
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Apr 6 08:49:05 2023 -0400
IDP-2069 - Null Handling Task
https://shibboleth.atlassian.net/browse/IDP-2069
Clean SAML core implementation classes.
Fix inconsistent handling of SAMLVersion.
---
.../org/opensaml/saml/saml1/core/Assertion.java | 4 +-
.../opensaml/saml/saml1/core/impl/ActionImpl.java | 14 ++--
.../opensaml/saml/saml1/core/impl/AdviceImpl.java | 36 +++++----
.../saml1/core/impl/AssertionArtifactImpl.java | 9 ++-
.../saml1/core/impl/AssertionIDReferenceImpl.java | 7 +-
.../saml/saml1/core/impl/AssertionImpl.java | 94 ++++++++++++----------
.../saml1/core/impl/AttributeDesignatorImpl.java | 27 ++++---
.../saml/saml1/core/impl/AttributeImpl.java | 23 ++++--
.../saml/saml1/core/impl/AttributeQueryImpl.java | 36 ++++++---
.../saml1/core/impl/AttributeStatementImpl.java | 33 ++++----
.../saml/saml1/core/impl/AudienceImpl.java | 6 +-
.../impl/AudienceRestrictionConditionImpl.java | 29 +++----
.../saml1/core/impl/AuthenticationQueryImpl.java | 30 ++-----
.../core/impl/AuthenticationStatementImpl.java | 55 ++++++-------
.../saml/saml1/core/impl/AuthorityBindingImpl.java | 33 ++++----
.../core/impl/AuthorizationDecisionQueryImpl.java | 46 ++++++-----
.../impl/AuthorizationDecisionStatementImpl.java | 51 +++++++-----
.../saml/saml1/core/impl/ConditionsImpl.java | 46 ++++++-----
.../saml1/core/impl/ConditionsUnmarshaller.java | 4 +-
.../saml1/core/impl/ConfirmationMethodImpl.java | 7 +-
.../saml1/core/impl/DoNotCacheConditionImpl.java | 15 +++-
.../saml/saml1/core/impl/EvidenceImpl.java | 35 ++++----
.../saml/saml1/core/impl/NameIdentifierImpl.java | 19 +++--
.../saml1/core/impl/RequestAbstractTypeImpl.java | 50 +++++++-----
.../core/impl/RequestAbstractTypeUnmarshaller.java | 2 +-
.../opensaml/saml/saml1/core/impl/RequestImpl.java | 58 ++++++-------
.../saml/saml1/core/impl/RespondWithImpl.java | 17 ++--
.../saml1/core/impl/ResponseAbstractTypeImpl.java | 60 +++++++-------
.../impl/ResponseAbstractTypeUnmarshaller.java | 2 +-
.../saml/saml1/core/impl/ResponseImpl.java | 38 +++++----
.../saml/saml1/core/impl/StatusCodeImpl.java | 39 +++++----
.../saml/saml1/core/impl/StatusDetailImpl.java | 34 ++++----
.../opensaml/saml/saml1/core/impl/StatusImpl.java | 38 +++++----
.../saml/saml1/core/impl/StatusMessageImpl.java | 7 +-
.../saml1/core/impl/SubjectConfirmationImpl.java | 49 ++++++-----
.../opensaml/saml/saml1/core/impl/SubjectImpl.java | 33 ++++----
.../saml/saml1/core/impl/SubjectLocalityImpl.java | 28 ++++---
.../saml/saml1/core/impl/SubjectQueryImpl.java | 32 +++++---
.../saml/saml1/core/impl/SubjectStatementImpl.java | 34 ++++----
39 files changed, 667 insertions(+), 513 deletions(-)
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/Assertion.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/Assertion.java
index 75b2a8d53..3c0ef6d9c 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/Assertion.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/Assertion.java
@@ -92,14 +92,14 @@ public interface Assertion extends SignableSAMLObject, Evidentiary {
*
* @return the stored MajorVersion
*/
- int getMajorVersion();
+ @Nullable Integer getMajorVersion();
/**
* Get the MinorVersion attribute.
*
* @return the stored MinorVersion
*/
- int getMinorVersion();
+ @Nullable Integer getMinorVersion();
/**
* Set the SAML version of this assertion.
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ActionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ActionImpl.java
index fb8717128..66affc040 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ActionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ActionImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml1.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml1.core.Action;
@@ -26,7 +29,7 @@ import org.opensaml.saml.saml1.core.Action;
public class ActionImpl extends XSStringImpl implements Action {
/** Place to store the namespace. */
- private String namespace;
+ @Nullable private String namespace;
/**
* Constructor.
@@ -35,19 +38,18 @@ public class ActionImpl extends XSStringImpl implements Action {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ActionImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ActionImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- @Override
- public String getNamespace() {
+ @Nullable public String getNamespace() {
return namespace;
}
/** {@inheritDoc} */
- @Override
- public void setNamespace(final String ns) {
+ public void setNamespace(@Nullable final String ns) {
namespace = prepareForAssignment(namespace, ns);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AdviceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AdviceImpl.java
index c2dfe9ed6..1151b370c 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AdviceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AdviceImpl.java
@@ -18,9 +18,10 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.AbstractXMLObject;
@@ -31,16 +32,22 @@ import org.opensaml.saml.saml1.core.Advice;
import org.opensaml.saml.saml1.core.Assertion;
import org.opensaml.saml.saml1.core.AssertionIDReference;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml1.core.Advice}.
+ * Concrete implementation of {@link Advice}.
*/
+ at SuppressWarnings("unchecked")
public class AdviceImpl extends AbstractXMLObject implements Advice {
/** Contains all the SAML objects we have added. */
- private final IndexedXMLObjectChildrenList<XMLObject> assertionChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> assertionChildren;
/** "any" children. */
- private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
/**
* Constructor.
@@ -49,15 +56,15 @@ public class AdviceImpl extends AbstractXMLObject implements Advice {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AdviceImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AdviceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
assertionChildren = new IndexedXMLObjectChildrenList<>(this);
unknownChildren = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- @Override
- public List<AssertionIDReference> getAssertionIDReferences() {
+ @Nonnull @Live public List<AssertionIDReference> getAssertionIDReferences() {
//
// The cast in the line below is unsafe. (it's checking against the erasure of l - which is List.
// We are, however guaranteed by sublist that although l is 'just' a List it
@@ -70,33 +77,30 @@ public class AdviceImpl extends AbstractXMLObject implements Advice {
}
/** {@inheritDoc} */
- @Override
- public List<Assertion> getAssertions() {
+ @Nonnull @Live public List<Assertion> getAssertions() {
// See Comment for getAssertionIDReference as to why this unsafe casting is OK
final QName assertionQname = new QName(SAMLConstants.SAML1_NS, Assertion.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<Assertion>) assertionChildren.subList(assertionQname);
}
/** {@inheritDoc} */
- @Override
- public List<XMLObject> getUnknownXMLObjects() {
+ @Nonnull @Live public List<XMLObject> getUnknownXMLObjects() {
return unknownChildren;
}
/** {@inheritDoc} */
- @Override
- public List<XMLObject> getUnknownXMLObjects(final QName typeOrName) {
+ @Nonnull @Live public List<XMLObject> getUnknownXMLObjects(@Nonnull final QName typeOrName) {
return (List<XMLObject>) unknownChildren.subList(typeOrName);
}
/** {@inheritDoc} */
- @Override
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
children.addAll(assertionChildren);
children.addAll(unknownChildren);
- return Collections.unmodifiableList(children);
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionArtifactImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionArtifactImpl.java
index 570a6c9fe..87861f150 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionArtifactImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionArtifactImpl.java
@@ -17,11 +17,14 @@
package org.opensaml.saml.saml1.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml1.core.AssertionArtifact;
/**
- * Concrete implementation if {@link org.opensaml.saml.saml1.core.AssertionArtifact}.
+ * Concrete implementation of {@link AssertionArtifact}.
*/
public class AssertionArtifactImpl extends XSStringImpl implements AssertionArtifact {
@@ -32,8 +35,8 @@ public class AssertionArtifactImpl extends XSStringImpl implements AssertionArti
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AssertionArtifactImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AssertionArtifactImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionIDReferenceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionIDReferenceImpl.java
index 11e28b4a0..1b89f1f79 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionIDReferenceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionIDReferenceImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml1.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml1.core.AssertionIDReference;
@@ -32,8 +35,8 @@ public class AssertionIDReferenceImpl extends XSStringImpl implements AssertionI
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AssertionIDReferenceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AssertionIDReferenceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionImpl.java
index a6c08e819..6ff55c66d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AssertionImpl.java
@@ -19,9 +19,10 @@ package org.opensaml.saml.saml1.core.impl;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -37,32 +38,39 @@ import org.opensaml.saml.saml1.core.AuthorizationDecisionStatement;
import org.opensaml.saml.saml1.core.Conditions;
import org.opensaml.saml.saml1.core.Statement;
import org.opensaml.saml.saml1.core.SubjectStatement;
+import org.opensaml.xmlsec.signature.Signature;
+
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
/**
* This class implements the SAML 1 <code> Assertion </code> statement.
*/
+ at SuppressWarnings("unchecked")
public class AssertionImpl extends AbstractSignableSAMLObject implements Assertion {
/** The <code> AssertionID </code> attrribute. */
- private String id;
+ @Nullable private String id;
/** SAML version of this assertion. */
- private SAMLVersion version;
+ @Nullable private SAMLVersion version;
/** Object version of the <code> Issuer </code> attribute. */
- private String issuer;
+ @Nullable private String issuer;
/** Object version of the <code> IssueInstant </code> attribute. */
- private Instant issueInstant;
+ @Nullable private Instant issueInstant;
/** (Possibly null) Singleton object version of the <code> Conditions </code> element. */
- private Conditions conditions;
+ @Nullable private Conditions conditions;
/** (Possibly null) Singleton object version of the <code> Advice </code> element. */
- private Advice advice;
+ @Nullable private Advice advice;
/** Object representation of all the <code>Statement</code> elements. */
- private final IndexedXMLObjectChildrenList<Statement> statements;
+ @Nonnull private final IndexedXMLObjectChildrenList<Statement> statements;
/**
* Constructor.
@@ -71,122 +79,123 @@ public class AssertionImpl extends AbstractSignableSAMLObject implements Asserti
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AssertionImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AssertionImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
statements = new IndexedXMLObjectChildrenList<>(this);
version = SAMLVersion.VERSION_11;
}
/** {@inheritDoc} */
- public int getMajorVersion(){
- return version.getMajorVersion();
+ @Nullable public Integer getMajorVersion(){
+ return version != null ? version.getMajorVersion() : null;
}
/** {@inheritDoc} */
- public int getMinorVersion() {
- return version.getMinorVersion();
+ @Nullable public Integer getMinorVersion() {
+ return version != null ? version.getMinorVersion() : null;
}
/** {@inheritDoc} */
- public void setVersion(final SAMLVersion newVersion){
+ public void setVersion(@Nullable final SAMLVersion newVersion){
version = prepareForAssignment(version, newVersion);
}
/** {@inheritDoc} */
- public String getID() {
+ @Nullable public String getID() {
return id;
}
/** {@inheritDoc} */
- public void setID(final String newID) {
+ public void setID(@Nullable final String newID) {
final String oldID = id;
id = prepareForAssignment(id, newID);
registerOwnID(oldID, id);
}
/** {@inheritDoc} */
- public String getIssuer() {
+ @Nullable public String getIssuer() {
return this.issuer;
}
/** {@inheritDoc} */
- public void setIssuer(final String iss) {
+ public void setIssuer(@Nullable final String iss) {
issuer = prepareForAssignment(issuer, iss);
}
/** {@inheritDoc} */
- public Instant getIssueInstant() {
+ @Nullable public Instant getIssueInstant() {
return this.issueInstant;
}
/** {@inheritDoc} */
- public void setIssueInstant(final Instant instant) {
+ public void setIssueInstant(@Nullable final Instant instant) {
issueInstant = prepareForAssignment(issueInstant, instant);
}
/** {@inheritDoc} */
- public Conditions getConditions() {
+ @Nullable public Conditions getConditions() {
return conditions;
}
/** {@inheritDoc} */
- public void setConditions(final Conditions c) {
+ public void setConditions(@Nullable final Conditions c) {
conditions = prepareForAssignment(conditions, c);
}
/** {@inheritDoc} */
- public Advice getAdvice() {
+ @Nullable public Advice getAdvice() {
return advice;
}
/** {@inheritDoc} */
- public void setAdvice(final Advice adv) {
+ public void setAdvice(@Nullable final Advice adv) {
advice = prepareForAssignment(advice, adv);
}
/** {@inheritDoc} */
- public List<Statement> getStatements() {
+ @Nonnull @Live public List<Statement> getStatements() {
return statements;
}
/** {@inheritDoc} */
- public List<Statement> getStatements(final QName typeOrName) {
+ @Nonnull @Live public List<Statement> getStatements(@Nonnull final QName typeOrName) {
return (List<Statement>) statements.subList(typeOrName);
}
/** {@inheritDoc} */
- public List<SubjectStatement> getSubjectStatements() {
+ @Nonnull @Live public List<SubjectStatement> getSubjectStatements() {
final QName statementQName = new QName(SAMLConstants.SAML1_NS, SubjectStatement.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<SubjectStatement>) statements.subList(statementQName);
}
/** {@inheritDoc} */
- public List<AuthenticationStatement> getAuthenticationStatements() {
+ @Nonnull @Live public List<AuthenticationStatement> getAuthenticationStatements() {
final QName statementQName =
new QName(SAMLConstants.SAML1_NS, AuthenticationStatement.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<AuthenticationStatement>) statements.subList(statementQName);
}
/** {@inheritDoc} */
- public List<AuthorizationDecisionStatement> getAuthorizationDecisionStatements() {
+ @Nonnull @Live public List<AttributeStatement> getAttributeStatements() {
+ final QName statementQName = new QName(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME);
+ return (List<AttributeStatement>) statements.subList(statementQName);
+ }
+
+ /** {@inheritDoc} */
+ @Nonnull @Live public List<AuthorizationDecisionStatement> getAuthorizationDecisionStatements() {
final QName statementQName =
new QName(SAMLConstants.SAML1_NS, AuthorizationDecisionStatement.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<AuthorizationDecisionStatement>) statements.subList(statementQName);
}
/** {@inheritDoc} */
- public List<AttributeStatement> getAttributeStatements() {
- final QName statementQName = new QName(SAMLConstants.SAML1_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME);
- return (List<AttributeStatement>) statements.subList(statementQName);
- }
-
- /** {@inheritDoc} */
- public String getSignatureReferenceID(){
+ @Nullable public String getSignatureReferenceID() {
return id;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
@@ -200,13 +209,12 @@ public class AssertionImpl extends AbstractSignableSAMLObject implements Asserti
children.addAll(statements);
- if(getSignature() != null){
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
- if (children.size() == 0) {
- return null;
- }
- return Collections.unmodifiableList(children);
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeDesignatorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeDesignatorImpl.java
index 19d72c34f..182764b77 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeDesignatorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeDesignatorImpl.java
@@ -23,20 +23,26 @@ package org.opensaml.saml.saml1.core.impl;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.AttributeDesignator;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * Concrete Implementation of the {@link org.opensaml.saml.saml1.core.AttributeDesignator} interface.
+ * Concrete Implementation of the {@link AttributeDesignator} interface.
*/
public class AttributeDesignatorImpl extends AbstractXMLObject implements AttributeDesignator {
/** Contains the AttributeName. */
- private String attributeName;
+ @Nullable private String attributeName;
/** Contains the AttributeNamespace. */
- private String attributeNamespace;
+ @Nullable private String attributeNamespace;
/**
* Constructor.
@@ -45,33 +51,34 @@ public class AttributeDesignatorImpl extends AbstractXMLObject implements Attrib
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AttributeDesignatorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AttributeDesignatorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getAttributeName() {
+ @Nullable public String getAttributeName() {
return attributeName;
}
/** {@inheritDoc} */
- public void setAttributeName(final String name) {
+ public void setAttributeName(@Nullable final String name) {
attributeName = prepareForAssignment(attributeName, name);
}
/** {@inheritDoc} */
- public String getAttributeNamespace() {
+ @Nullable public String getAttributeNamespace() {
return attributeNamespace;
}
/** {@inheritDoc} */
- public void setAttributeNamespace(final String ns) {
+ public void setAttributeNamespace(@Nullable final String ns) {
attributeNamespace = prepareForAssignment(attributeNamespace, ns);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeImpl.java
index b44819c69..711a69b40 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeImpl.java
@@ -17,20 +17,27 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.Attribute;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * A Concrete implementation of the {@link org.opensaml.saml.saml1.core.Attribute} Interface.
+ * A Concrete implementation of the {@link Attribute} Interface.
*/
public class AttributeImpl extends AttributeDesignatorImpl implements Attribute {
/** Contains the AttributeValues. */
- private final XMLObjectChildrenList<XMLObject> attributeValues;
+ @Nonnull private final XMLObjectChildrenList<XMLObject> attributeValues;
/**
* Constructor.
@@ -39,18 +46,20 @@ public class AttributeImpl extends AttributeDesignatorImpl implements Attribute
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AttributeImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AttributeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
attributeValues = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<XMLObject> getAttributeValues() {
+ @Nonnull @Live public List<XMLObject> getAttributeValues() {
return attributeValues;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- return Collections.unmodifiableList(attributeValues);
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ return CollectionSupport.copyToList(attributeValues);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeQueryImpl.java
index bd6db6a40..a6097b86a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeQueryImpl.java
@@ -18,24 +18,31 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.AttributeDesignator;
import org.opensaml.saml.saml1.core.AttributeQuery;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of the {@link org.opensaml.saml.saml1.core.AttributeQuery} interface.
+ * Concrete implementation of the {@link AttributeQuery} interface.
*/
public class AttributeQueryImpl extends SubjectQueryImpl implements AttributeQuery {
/** Contains the resource attribute. */
- private String resource;
+ @Nullable private String resource;
/** Contains all the child AttributeDesignators. */
- private final XMLObjectChildrenList<AttributeDesignator> attributeDesignators;
+ @Nonnull private final XMLObjectChildrenList<AttributeDesignator> attributeDesignators;
/**
* Constructor.
@@ -44,36 +51,39 @@ public class AttributeQueryImpl extends SubjectQueryImpl implements AttributeQue
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AttributeQueryImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AttributeQueryImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
attributeDesignators = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getResource() {
+ @Nullable public String getResource() {
return resource;
}
/** {@inheritDoc} */
- public void setResource(final String res) {
+ public void setResource(@Nullable final String res) {
resource = prepareForAssignment(resource, res);
}
/** {@inheritDoc} */
- public List<AttributeDesignator> getAttributeDesignators() {
+ @Nonnull @Live public List<AttributeDesignator> getAttributeDesignators() {
return attributeDesignators;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(attributeDesignators.size() + 1);
- if (super.getOrderedChildren() != null) {
- list.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ list.addAll(superKids);
}
list.addAll(attributeDesignators);
- return Collections.unmodifiableList(list);
+
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeStatementImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeStatementImpl.java
index e66a48a3f..416e96ff4 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeStatementImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AttributeStatementImpl.java
@@ -18,21 +18,28 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.Attribute;
import org.opensaml.saml.saml1.core.AttributeStatement;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * A Concrete implementation of the {@link org.opensaml.saml.saml1.core.AttributeStatement} Interface.
+ * A Concrete implementation of the {@link AttributeStatement} Interface.
*/
public class AttributeStatementImpl extends SubjectStatementImpl implements AttributeStatement {
/** Contains the Attributes (in order). */
- private final XMLObjectChildrenList<Attribute> attributes;
+ @Nonnull private final XMLObjectChildrenList<Attribute> attributes;
/**
* Constructor.
@@ -41,31 +48,29 @@ public class AttributeStatementImpl extends SubjectStatementImpl implements Attr
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AttributeStatementImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AttributeStatementImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
attributes = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<Attribute> getAttributes() {
+ @Nonnull @Live public List<Attribute> getAttributes() {
return attributes;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(attributes.size() + 1);
- if (super.getOrderedChildren() != null) {
- list.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ list.addAll(superKids);
}
list.addAll(attributes);
- if (list.size() == 0) {
- return null;
- }
-
- return Collections.unmodifiableList(list);
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceImpl.java
index 3893cf9c9..deba52f6a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml1.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml1.core.Audience;
@@ -32,7 +35,8 @@ public class AudienceImpl extends XSURIImpl implements Audience {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AudienceImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AudienceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceRestrictionConditionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceRestrictionConditionImpl.java
index 39861faa9..2a10c4a3a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceRestrictionConditionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AudienceRestrictionConditionImpl.java
@@ -17,23 +17,29 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.Audience;
import org.opensaml.saml.saml1.core.AudienceRestrictionCondition;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
* Concrete implementation of the org.opensaml.saml.saml1.core.AudienceRestrictionCondition.
*/
public class AudienceRestrictionConditionImpl extends AbstractXMLObject implements AudienceRestrictionCondition {
/** Audiences. */
- private final XMLObjectChildrenList<Audience> audiences;
+ @Nonnull private final XMLObjectChildrenList<Audience> audiences;
/**
* Constructor.
@@ -42,25 +48,20 @@ public class AudienceRestrictionConditionImpl extends AbstractXMLObject implemen
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AudienceRestrictionConditionImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AudienceRestrictionConditionImpl(@Nullable final String namespaceURI,
+ @Nonnull final String elementLocalName, @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
audiences = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<Audience> getAudiences() {
+ @Nonnull @Live public List<Audience> getAudiences() {
return audiences;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
-
- if (audiences.size() == 0) {
- return null;
- }
- final ArrayList<XMLObject> children = new ArrayList<>();
- children.addAll(audiences);
- return Collections.unmodifiableList(children);
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ return CollectionSupport.copyToList(audiences);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationQueryImpl.java
index 1af94d2a5..6ea2fc36a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationQueryImpl.java
@@ -17,15 +17,13 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
-import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.AuthenticationQuery;
/**
- * Concrete implementation of the {@link org.opensaml.saml.saml1.core.AuthenticationQuery} interface.
+ * Concrete implementation of the {@link AuthenticationQuery} interface.
*/
public class AuthenticationQueryImpl extends SubjectQueryImpl implements AuthenticationQuery {
@@ -39,33 +37,19 @@ public class AuthenticationQueryImpl extends SubjectQueryImpl implements Authent
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthenticationQueryImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthenticationQueryImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getAuthenticationMethod() {
+ @Nullable public String getAuthenticationMethod() {
return authenticationMethod;
}
/** {@inheritDoc} */
- public void setAuthenticationMethod(final String method) {
+ public void setAuthenticationMethod(@Nullable final String method) {
authenticationMethod = prepareForAssignment(authenticationMethod, method);
}
- /** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final List<XMLObject> list = new ArrayList<>();
-
- if (super.getOrderedChildren() != null) {
- list.addAll(super.getOrderedChildren());
- }
-
- if (list.size() == 0) {
- return null;
- }
-
- return Collections.unmodifiableList(list);
- }
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationStatementImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationStatementImpl.java
index 46f29aeee..d80c2e557 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationStatementImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthenticationStatementImpl.java
@@ -19,31 +19,38 @@ package org.opensaml.saml.saml1.core.impl;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.AuthenticationStatement;
import org.opensaml.saml.saml1.core.AuthorityBinding;
import org.opensaml.saml.saml1.core.SubjectLocality;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * A Concrete implementation of the {@link org.opensaml.saml.saml1.core.AuthenticationStatement} Interface.
+ * A Concrete implementation of the {@link AuthenticationStatement} Interface.
*/
public class AuthenticationStatementImpl extends SubjectStatementImpl implements AuthenticationStatement {
/** Contains the AuthenticationMethod attribute contents. */
- private String authenticationMethod;
+ @Nullable private String authenticationMethod;
/** Contains the AuthenticationMethod attribute contents. */
- private Instant authenticationInstant;
+ @Nullable private Instant authenticationInstant;
/** Contains the SubjectLocality subelement. */
- private SubjectLocality subjectLocality;
+ @Nullable private SubjectLocality subjectLocality;
/** Contains the AuthorityBinding subelements. */
- private final XMLObjectChildrenList<AuthorityBinding> authorityBindings;
+ @Nonnull private final XMLObjectChildrenList<AuthorityBinding> authorityBindings;
/**
* Constructor.
@@ -52,57 +59,54 @@ public class AuthenticationStatementImpl extends SubjectStatementImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthenticationStatementImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthenticationStatementImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
authorityBindings = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getAuthenticationMethod() {
+ @Nullable public String getAuthenticationMethod() {
return authenticationMethod;
}
/** {@inheritDoc} */
- public void setAuthenticationMethod(final String method) {
+ public void setAuthenticationMethod(@Nullable final String method) {
authenticationMethod = prepareForAssignment(authenticationMethod, method);
}
/** {@inheritDoc} */
- public Instant getAuthenticationInstant() {
+ @Nullable public Instant getAuthenticationInstant() {
return authenticationInstant;
}
/** {@inheritDoc} */
- public void setAuthenticationInstant(final Instant instant) {
+ public void setAuthenticationInstant(@Nullable final Instant instant) {
authenticationInstant = prepareForAssignment(authenticationInstant, instant);
}
- //
- // Elements
- //
-
/** {@inheritDoc} */
- public SubjectLocality getSubjectLocality() {
+ @Nullable public SubjectLocality getSubjectLocality() {
return subjectLocality;
}
/** {@inheritDoc} */
- public void setSubjectLocality(final SubjectLocality locality) {
+ public void setSubjectLocality(@Nullable final SubjectLocality locality) {
subjectLocality = prepareForAssignment(subjectLocality, locality);
}
/** {@inheritDoc} */
- public List<AuthorityBinding> getAuthorityBindings() {
+ @Nonnull @Live public List<AuthorityBinding> getAuthorityBindings() {
return authorityBindings;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(authorityBindings.size() + 2);
- if (super.getOrderedChildren() != null) {
- list.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ list.addAll(superKids);
}
if (subjectLocality != null) {
@@ -111,10 +115,7 @@ public class AuthenticationStatementImpl extends SubjectStatementImpl implements
list.addAll(authorityBindings);
- if (list.size() == 0) {
- return null;
- }
-
- return Collections.unmodifiableList(list);
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorityBindingImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorityBindingImpl.java
index 96361a7c3..da00da23e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorityBindingImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorityBindingImpl.java
@@ -19,25 +19,30 @@ package org.opensaml.saml.saml1.core.impl;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.AuthorityBinding;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * A concrete implementation of the {@link org.opensaml.saml.saml1.core.SubjectLocality} interface.
+ * A concrete implementation of the {@link AuthorityBinding} interface.
*/
public class AuthorityBindingImpl extends AbstractXMLObject implements AuthorityBinding {
/** The AuthorityKind. */
- private QName authorityKind;
+ @Nullable private QName authorityKind;
/** The Location. */
- private String location;
+ @Nullable private String location;
/** The Binding. */
- private String binding;
+ @Nullable private String binding;
/**
* Constructor.
@@ -46,45 +51,45 @@ public class AuthorityBindingImpl extends AbstractXMLObject implements Authority
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthorityBindingImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthorityBindingImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public QName getAuthorityKind() {
+ @Nullable public QName getAuthorityKind() {
return authorityKind;
}
/** {@inheritDoc} */
- public void setAuthorityKind(final QName kind) {
+ public void setAuthorityKind(@Nullable final QName kind) {
authorityKind = prepareAttributeValueForAssignment(AuthorityBinding.AUTHORITYKIND_ATTRIB_NAME,
authorityKind, kind);
}
/** {@inheritDoc} */
- public String getLocation() {
+ @Nullable public String getLocation() {
return location;
}
/** {@inheritDoc} */
- public void setLocation(final String loc) {
+ public void setLocation(@Nullable final String loc) {
location = prepareForAssignment(location, loc);
}
/** {@inheritDoc} */
- public String getBinding() {
+ @Nullable public String getBinding() {
return binding;
}
/** {@inheritDoc} */
- public void setBinding(final String newBinding) {
+ public void setBinding(@Nullable final String newBinding) {
binding = prepareForAssignment(binding, newBinding);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- // No children
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionQueryImpl.java
index 4a798afac..357b47886 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionQueryImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.common.xml.SAMLConstants;
@@ -28,19 +30,24 @@ import org.opensaml.saml.saml1.core.Action;
import org.opensaml.saml.saml1.core.AuthorizationDecisionQuery;
import org.opensaml.saml.saml1.core.Evidence;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of the {@link org.opensaml.saml.saml1.core.AuthorizationDecisionQuery} interface.
+ * Concrete implementation of the {@link AuthorizationDecisionQuery} interface.
*/
public class AuthorizationDecisionQueryImpl extends SubjectQueryImpl implements AuthorizationDecisionQuery {
/** Contains the resource attribute. */
- private String resource;
+ @Nullable private String resource;
/** Contains all the Action child elements. */
- private final XMLObjectChildrenList<Action> actions;
+ @Nonnull private final XMLObjectChildrenList<Action> actions;
/** Contains the Evidence child element. */
- private Evidence evidence;
+ @Nullable private Evidence evidence;
/**
* Constructor.
@@ -49,55 +56,54 @@ public class AuthorizationDecisionQueryImpl extends SubjectQueryImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthorizationDecisionQueryImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthorizationDecisionQueryImpl(@Nullable final String namespaceURI,
+ @Nonnull final String elementLocalName, @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
setElementNamespacePrefix(SAMLConstants.SAML1P_PREFIX);
actions = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getResource() {
+ @Nullable public String getResource() {
return resource;
}
/** {@inheritDoc} */
- public void setResource(final String res) {
+ public void setResource(@Nullable final String res) {
resource = prepareForAssignment(resource, res);
}
/** {@inheritDoc} */
- public List<Action> getActions() {
+ @Nonnull @Live public List<Action> getActions() {
return actions;
}
/** {@inheritDoc} */
- public Evidence getEvidence() {
+ @Nullable public Evidence getEvidence() {
return evidence;
}
/** {@inheritDoc} */
- public void setEvidence(final Evidence ev) {
+ public void setEvidence(@Nullable final Evidence ev) {
evidence = prepareForAssignment(evidence, ev);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(actions.size() + 2);
- if (super.getOrderedChildren() != null) {
- list.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ list.addAll(superKids);
}
list.addAll(actions);
+
if (evidence != null) {
list.add(evidence);
}
- if (list.size() == 0) {
- return null;
- }
-
- return Collections.unmodifiableList(list);
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionStatementImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionStatementImpl.java
index 37887f96e..89184f8c6 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionStatementImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/AuthorizationDecisionStatementImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.Action;
@@ -28,22 +30,27 @@ import org.opensaml.saml.saml1.core.AuthorizationDecisionStatement;
import org.opensaml.saml.saml1.core.DecisionTypeEnumeration;
import org.opensaml.saml.saml1.core.Evidence;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
* A concrete implementation of {@link org.opensaml.saml.saml1.core.AuthorizationDecisionStatement}.
*/
public class AuthorizationDecisionStatementImpl extends SubjectStatementImpl implements AuthorizationDecisionStatement {
/** Contains the Resource attribute. */
- private String resource;
+ @Nullable private String resource;
/** Contains the Decision attribute. */
- private DecisionTypeEnumeration decision;
+ @Nullable private DecisionTypeEnumeration decision;
/** Contains the list of Action elements. */
- private final XMLObjectChildrenList<Action> actions;
+ @Nonnull private final XMLObjectChildrenList<Action> actions;
/** Contains the (single) Evidence element. */
- private Evidence evidence;
+ @Nullable private Evidence evidence;
/**
* Constructor.
@@ -52,61 +59,63 @@ public class AuthorizationDecisionStatementImpl extends SubjectStatementImpl imp
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthorizationDecisionStatementImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthorizationDecisionStatementImpl(@Nullable final String namespaceURI,
+ @Nonnull final String elementLocalName, @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
actions = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getResource() {
+ @Nullable public String getResource() {
return resource;
}
/** {@inheritDoc} */
- public void setResource(final String res) {
+ public void setResource(@Nullable final String res) {
resource = prepareForAssignment(resource, res);
}
/** {@inheritDoc} */
- public DecisionTypeEnumeration getDecision() {
+ @Nullable public DecisionTypeEnumeration getDecision() {
return decision;
}
/** {@inheritDoc} */
- public void setDecision(final DecisionTypeEnumeration dec) {
+ public void setDecision(@Nullable final DecisionTypeEnumeration dec) {
decision = prepareForAssignment(decision, dec);
}
/** {@inheritDoc} */
- public List<Action> getActions() {
+ @Nonnull @Live public List<Action> getActions() {
return actions;
}
/** {@inheritDoc} */
- public Evidence getEvidence() {
+ @Nullable public Evidence getEvidence() {
return evidence;
}
/** {@inheritDoc} */
- public void setEvidence(final Evidence ev) {
+ public void setEvidence(@Nullable final Evidence ev) {
evidence = prepareForAssignment(evidence, ev);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(actions.size() + 2);
- if (super.getOrderedChildren() != null) {
- list.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ list.addAll(superKids);
}
+
list.addAll(actions);
+
if (evidence != null) {
list.add(evidence);
}
- if (list.size() == 0) {
- return null;
- }
- return Collections.unmodifiableList(list);
+
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsImpl.java
index d82759f3a..311240ee7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsImpl.java
@@ -18,11 +18,10 @@
package org.opensaml.saml.saml1.core.impl;
import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.AbstractXMLObject;
@@ -34,19 +33,25 @@ import org.opensaml.saml.saml1.core.Condition;
import org.opensaml.saml.saml1.core.Conditions;
import org.opensaml.saml.saml1.core.DoNotCacheCondition;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * This is a concrete implementation of the {@link org.opensaml.saml.saml1.core.Conditions} interface.
+ * This is a concrete implementation of the {@link Conditions} interface.
*/
+ at SuppressWarnings("unchecked")
public class ConditionsImpl extends AbstractXMLObject implements Conditions {
/** Value saved in the NotBefore attribute. */
- private Instant notBefore;
+ @Nullable private Instant notBefore;
/** Value saved in the NotOnOrAfter attribute. */
- private Instant notOnOrAfter;
+ @Nullable private Instant notOnOrAfter;
/** Set containing all the Conditions. */
- private final IndexedXMLObjectChildrenList<Condition> conditions;
+ @Nonnull private final IndexedXMLObjectChildrenList<Condition> conditions;
/**
* Constructor.
@@ -55,60 +60,57 @@ public class ConditionsImpl extends AbstractXMLObject implements Conditions {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ConditionsImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ConditionsImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
conditions = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public Instant getNotBefore() {
+ @Nullable public Instant getNotBefore() {
return notBefore;
}
/** {@inheritDoc} */
- public void setNotBefore(final Instant dt) {
+ public void setNotBefore(@Nullable final Instant dt) {
notBefore = prepareForAssignment(notBefore, dt);
}
/** {@inheritDoc} */
- public Instant getNotOnOrAfter() {
+ @Nullable public Instant getNotOnOrAfter() {
return notOnOrAfter;
}
/** {@inheritDoc} */
- public void setNotOnOrAfter(final Instant dt) {
+ public void setNotOnOrAfter(@Nullable final Instant dt) {
notOnOrAfter = prepareForAssignment(notOnOrAfter, dt);
}
/** {@inheritDoc} */
- public List<Condition> getConditions() {
+ @Nonnull @Live public List<Condition> getConditions() {
return conditions;
}
/** {@inheritDoc} */
- public List<Condition> getConditions(@Nonnull final QName typeOrName) {
+ @Nonnull @Live public List<Condition> getConditions(@Nonnull final QName typeOrName) {
return (List<Condition>) conditions.subList(typeOrName);
}
/** {@inheritDoc} */
- public List<AudienceRestrictionCondition> getAudienceRestrictionConditions() {
+ @Nonnull @Live public List<AudienceRestrictionCondition> getAudienceRestrictionConditions() {
final QName qname = new QName(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<AudienceRestrictionCondition>) conditions.subList(qname);
}
/** {@inheritDoc} */
- public List<DoNotCacheCondition> getDoNotCacheConditions() {
+ @Nonnull @Live public List<DoNotCacheCondition> getDoNotCacheConditions() {
final QName qname = new QName(SAMLConstants.SAML1_NS, DoNotCacheCondition.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<DoNotCacheCondition>) conditions.subList(qname);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- if (conditions.size() == 0) {
- return null;
- }
- final ArrayList<XMLObject> children = new ArrayList<>();
- children.addAll(conditions);
- return Collections.unmodifiableList(children);
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ return CollectionSupport.copyToList(conditions);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsUnmarshaller.java
index 47b7081d0..e896942e5 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConditionsUnmarshaller.java
@@ -49,7 +49,9 @@ public class ConditionsUnmarshaller extends AbstractSAMLObjectUnmarshaller {
}
/** {@inheritDoc} */
- protected void processAttribute(final XMLObject samlObject, final Attr attribute) throws UnmarshallingException {
+ @Override
+ protected void processAttribute(@Nonnull final XMLObject samlObject, @Nonnull final Attr attribute)
+ throws UnmarshallingException {
final Conditions conditions = (Conditions) samlObject;
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConfirmationMethodImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConfirmationMethodImpl.java
index 97d66d044..9f82963a0 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConfirmationMethodImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ConfirmationMethodImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml1.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml1.core.ConfirmationMethod;
@@ -32,8 +35,8 @@ public class ConfirmationMethodImpl extends XSURIImpl implements ConfirmationMet
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ConfirmationMethodImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ConfirmationMethodImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/DoNotCacheConditionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/DoNotCacheConditionImpl.java
index 0324c3b1a..ac25543dd 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/DoNotCacheConditionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/DoNotCacheConditionImpl.java
@@ -19,12 +19,18 @@ package org.opensaml.saml.saml1.core.impl;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.DoNotCacheCondition;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * Concrete Implementation of a {@link org.opensaml.saml.saml1.core.DoNotCacheCondition} Objects.
+ * Concrete implementation of {@link DoNotCacheCondition}.
*/
public class DoNotCacheConditionImpl extends AbstractXMLObject implements DoNotCacheCondition {
@@ -35,13 +41,14 @@ public class DoNotCacheConditionImpl extends AbstractXMLObject implements DoNotC
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected DoNotCacheConditionImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected DoNotCacheConditionImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/EvidenceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/EvidenceImpl.java
index 2fe8e55e9..a2a4de55b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/EvidenceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/EvidenceImpl.java
@@ -17,10 +17,10 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.AbstractXMLObject;
@@ -32,13 +32,19 @@ import org.opensaml.saml.saml1.core.AssertionIDReference;
import org.opensaml.saml.saml1.core.Evidence;
import org.opensaml.saml.saml1.core.Evidentiary;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of the {@link org.opensaml.saml.saml1.core.Evidence} interface.
+ * Concrete implementation of the {@link Evidence} interface.
*/
+ at SuppressWarnings("unchecked")
public class EvidenceImpl extends AbstractXMLObject implements Evidence {
/** The Evidentiary child elements. */
- private final IndexedXMLObjectChildrenList<Evidentiary> evidence;
+ @Nonnull private final IndexedXMLObjectChildrenList<Evidentiary> evidence;
/**
* Constructor.
@@ -47,37 +53,32 @@ public class EvidenceImpl extends AbstractXMLObject implements Evidence {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EvidenceImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected EvidenceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
evidence = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<AssertionIDReference> getAssertionIDReferences() {
+ @Nonnull @Live public List<AssertionIDReference> getAssertionIDReferences() {
final QName qname = new QName(SAMLConstants.SAML1_NS, AssertionIDReference.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<AssertionIDReference>) evidence.subList(qname);
}
/** {@inheritDoc} */
- public List<Assertion> getAssertions() {
+ @Nonnull @Live public List<Assertion> getAssertions() {
final QName qname = new QName(SAMLConstants.SAML1_NS, Assertion.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<Assertion>) evidence.subList(qname);
}
/** {@inheritDoc} */
- public List<Evidentiary> getEvidence() {
+ @Nonnull @Live public List<Evidentiary> getEvidence() {
return evidence;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- if (evidence.size() == 0) {
- return null;
- }
-
- final ArrayList<XMLObject> list = new ArrayList<>();
- list.addAll(evidence);
-
- return Collections.unmodifiableList(list);
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ return CollectionSupport.copyToList(evidence);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/NameIdentifierImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/NameIdentifierImpl.java
index 8b664ee34..fa9456f9d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/NameIdentifierImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/NameIdentifierImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml1.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml1.core.NameIdentifier;
@@ -26,10 +29,10 @@ import org.opensaml.saml.saml1.core.NameIdentifier;
public class NameIdentifierImpl extends XSStringImpl implements NameIdentifier {
/** Contents of the NameQualifierAttribute. */
- private String nameQualifier;
+ @Nullable private String nameQualifier;
/** Contents of the Format. */
- private String format;
+ @Nullable private String format;
/**
* Constructor.
@@ -38,28 +41,28 @@ public class NameIdentifierImpl extends XSStringImpl implements NameIdentifier {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected NameIdentifierImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected NameIdentifierImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getNameQualifier() {
+ @Nullable public String getNameQualifier() {
return nameQualifier;
}
/** {@inheritDoc} */
- public String getFormat() {
+ @Nullable public String getFormat() {
return this.format;
}
/** {@inheritDoc} */
- public void setNameQualifier(final String qualifier) {
+ public void setNameQualifier(@Nullable final String qualifier) {
nameQualifier = prepareForAssignment(nameQualifier, qualifier);
}
/** {@inheritDoc} */
- public void setFormat(final String fmt) {
+ public void setFormat(@Nullable final String fmt) {
format = prepareForAssignment(format, fmt);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeImpl.java
index 67cbc7ac6..9526445e6 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeImpl.java
@@ -19,15 +19,23 @@ package org.opensaml.saml.saml1.core.impl;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.common.AbstractSignableSAMLObject;
import org.opensaml.saml.common.SAMLVersion;
import org.opensaml.saml.saml1.core.RequestAbstractType;
import org.opensaml.saml.saml1.core.RespondWith;
+import org.opensaml.xmlsec.signature.Signature;
+
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
/**
* Implementation of {@link org.opensaml.saml.saml1.core.RequestAbstractType}.
@@ -35,16 +43,16 @@ import org.opensaml.saml.saml1.core.RespondWith;
public abstract class RequestAbstractTypeImpl extends AbstractSignableSAMLObject implements RequestAbstractType {
/** Contains the ID. */
- private String id;
+ @Nullable private String id;
/** Contains the IssueInstant. */
- private Instant issueInstant;
+ @Nullable private Instant issueInstant;
/** Version of this SAML message. */
- private SAMLVersion version;
+ @Nullable private SAMLVersion version;
/** Contains the respondWiths. */
- private final XMLObjectChildrenList<RespondWith> respondWiths;
+ @Nonnull private final XMLObjectChildrenList<RespondWith> respondWiths;
/**
* Constructor.
@@ -53,65 +61,67 @@ public abstract class RequestAbstractTypeImpl extends AbstractSignableSAMLObject
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RequestAbstractTypeImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected RequestAbstractTypeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
version = SAMLVersion.VERSION_11;
respondWiths = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getID() {
+ @Nullable public String getID() {
return id;
}
/** {@inheritDoc} */
- public void setID(final String newID) {
+ public void setID(@Nullable final String newID) {
final String oldID = id;
id = prepareForAssignment(id, newID);
registerOwnID(oldID, id);
}
/** {@inheritDoc} */
- public SAMLVersion getVersion() {
+ @Nullable public SAMLVersion getVersion() {
return version;
}
/** {@inheritDoc} */
- public void setVersion(final SAMLVersion newVersion) {
+ public void setVersion(@Nullable final SAMLVersion newVersion) {
version = prepareForAssignment(version, newVersion);
}
/** {@inheritDoc} */
- public Instant getIssueInstant() {
+ @Nullable public Instant getIssueInstant() {
return issueInstant;
}
/** {@inheritDoc} */
- public void setIssueInstant(final Instant instant) {
- this.issueInstant = prepareForAssignment(this.issueInstant, instant);
+ public void setIssueInstant(@Nullable final Instant instant) {
+ issueInstant = prepareForAssignment(issueInstant, instant);
}
/** {@inheritDoc} */
- public List<RespondWith> getRespondWiths() {
+ @Nonnull @Live public List<RespondWith> getRespondWiths() {
return respondWiths;
}
/** {@inheritDoc} */
- public String getSignatureReferenceID(){
+ @Nullable public String getSignatureReferenceID(){
return id;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> children = new ArrayList<>();
children.addAll(respondWiths);
- if(getSignature() != null){
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
- return Collections.unmodifiableList(children);
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java
index 6585124e3..2b97123cb 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestAbstractTypeUnmarshaller.java
@@ -32,12 +32,12 @@ import org.opensaml.saml.saml1.core.RequestAbstractType;
import org.opensaml.saml.saml1.core.RespondWith;
import org.opensaml.xmlsec.signature.Signature;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import com.google.common.base.Strings;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.DOMTypeSupport;
/**
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestImpl.java
index 53930c0f4..623ca65e7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RequestImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.AssertionArtifact;
@@ -32,19 +34,24 @@ import org.opensaml.saml.saml1.core.Query;
import org.opensaml.saml.saml1.core.Request;
import org.opensaml.saml.saml1.core.SubjectQuery;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml1.core.Request}.
+ * Concrete implementation of {@link Request}.
*/
public class RequestImpl extends RequestAbstractTypeImpl implements Request {
/** Saves the query (one of Query, SubjectQuery, AuthenticationQuery, AttributeQuery, AuthorizationDecisionQuery. */
- private Query query;
+ @Nullable private Query query;
/** The List of AssertionIDReferences. */
- private final XMLObjectChildrenList<AssertionIDReference> assertionIDReferences;
+ @Nonnull private final XMLObjectChildrenList<AssertionIDReference> assertionIDReferences;
/** The List of AssertionArtifacts. */
- private final XMLObjectChildrenList<AssertionArtifact> assertionArtifacts;
+ @Nonnull private final XMLObjectChildrenList<AssertionArtifact> assertionArtifacts;
/**
* Constructor.
@@ -53,74 +60,69 @@ public class RequestImpl extends RequestAbstractTypeImpl implements Request {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RequestImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected RequestImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
assertionIDReferences = new XMLObjectChildrenList<>(this);
assertionArtifacts = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public Query getQuery() {
+ @Nullable public Query getQuery() {
return query;
}
/** {@inheritDoc} */
- public SubjectQuery getSubjectQuery() {
+ @Nullable public SubjectQuery getSubjectQuery() {
return query instanceof SubjectQuery ? (SubjectQuery) query : null;
}
/** {@inheritDoc} */
- public AttributeQuery getAttributeQuery() {
+ @Nullable public AttributeQuery getAttributeQuery() {
return query instanceof AttributeQuery ? (AttributeQuery) query : null;
}
/** {@inheritDoc} */
- public AuthenticationQuery getAuthenticationQuery() {
+ @Nullable public AuthenticationQuery getAuthenticationQuery() {
return query instanceof AuthenticationQuery ? (AuthenticationQuery) query : null;
}
/** {@inheritDoc} */
- public AuthorizationDecisionQuery getAuthorizationDecisionQuery() {
+ @Nullable public AuthorizationDecisionQuery getAuthorizationDecisionQuery() {
return query instanceof AuthorizationDecisionQuery ? (AuthorizationDecisionQuery) query : null;
}
/** {@inheritDoc} */
- public void setQuery(final Query q) {
+ public void setQuery(@Nullable final Query q) {
query = prepareForAssignment(query, q);
}
/** {@inheritDoc} */
- public List<AssertionIDReference> getAssertionIDReferences() {
+ @Nonnull @Live public List<AssertionIDReference> getAssertionIDReferences() {
return assertionIDReferences;
}
/** {@inheritDoc} */
- public List<AssertionArtifact> getAssertionArtifacts() {
+ @Nonnull @Live public List<AssertionArtifact> getAssertionArtifacts() {
return assertionArtifacts;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- list.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ list.addAll(superKids);
}
if (query != null) {
list.add(query);
}
- if (assertionIDReferences.size() != 0) {
- list.addAll(assertionIDReferences);
- }
- if (assertionArtifacts.size() != 0) {
- list.addAll(assertionArtifacts);
- }
-
- if (list.size() == 0) {
- return null;
- }
+ list.addAll(assertionIDReferences);
+ list.addAll(assertionArtifacts);
- return Collections.unmodifiableList(list);
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RespondWithImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RespondWithImpl.java
index 78cda8b8a..64f45552e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RespondWithImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/RespondWithImpl.java
@@ -19,19 +19,24 @@ package org.opensaml.saml.saml1.core.impl;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.RespondWith;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
* Implementation of {@link RespondWith}.
*/
public class RespondWithImpl extends AbstractXMLObject implements RespondWith {
/** Value of this element. */
- private QName value;
+ @Nullable private QName value;
/**
* Constructor.
@@ -40,22 +45,24 @@ public class RespondWithImpl extends AbstractXMLObject implements RespondWith {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RespondWithImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected RespondWithImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public QName getValue() {
+ @Nullable public QName getValue() {
return value;
}
/** {@inheritDoc} */
- public void setValue(final QName newValue) {
+ public void setValue(@Nullable final QName newValue) {
value = prepareElementContentForAssignment(value, newValue);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeImpl.java
index 0730c0570..d2b7135f9 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeImpl.java
@@ -18,34 +18,40 @@
package org.opensaml.saml.saml1.core.impl;
import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.common.AbstractSignableSAMLObject;
import org.opensaml.saml.common.SAMLVersion;
import org.opensaml.saml.saml1.core.ResponseAbstractType;
+import org.opensaml.xmlsec.signature.Signature;
+
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
/**
- * Abstract implementation of {@link org.opensaml.saml.saml1.core.ResponseAbstractType} Object.
+ * Abstract implementation of {@link ResponseAbstractType} Object.
*/
public abstract class ResponseAbstractTypeImpl extends AbstractSignableSAMLObject implements ResponseAbstractType {
/** Contains the ID. */
- private String id;
+ @Nullable private String id;
/** Message version. */
- private SAMLVersion version;
+ @Nullable private SAMLVersion version;
/** Contents of the InResponseTo attribute. */
- private String inResponseTo;
+ @Nullable private String inResponseTo;
/** Contents of the IssueInstant attribute. */
- private Instant issueInstant;
+ @Nullable private Instant issueInstant;
/** Contents of the Recipient attribute. */
- private String recipient;
+ @Nullable private String recipient;
/**
* Constructor.
@@ -54,78 +60,78 @@ public abstract class ResponseAbstractTypeImpl extends AbstractSignableSAMLObjec
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ResponseAbstractTypeImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ResponseAbstractTypeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
version = SAMLVersion.VERSION_11;
}
/** {@inheritDoc} */
- public String getID() {
+ @Nullable public String getID() {
return id;
}
/** {@inheritDoc} */
- public void setID(final String newID) {
+ public void setID(@Nullable final String newID) {
final String oldID = id;
id = prepareForAssignment(id, newID);
registerOwnID(oldID, id);
}
/** {@inheritDoc} */
- public String getInResponseTo() {
+ @Nullable public String getInResponseTo() {
return inResponseTo;
}
/** {@inheritDoc} */
- public void setInResponseTo(final String to) {
+ public void setInResponseTo(@Nullable final String to) {
inResponseTo = prepareForAssignment(inResponseTo, to);
}
/** {@inheritDoc} */
- public SAMLVersion getVersion() {
+ @Nullable public SAMLVersion getVersion() {
return version;
}
/** {@inheritDoc} */
- public void setVersion(final SAMLVersion newVersion) {
+ public void setVersion(@Nullable final SAMLVersion newVersion) {
version = prepareForAssignment(version, newVersion);
}
/** {@inheritDoc} */
- public Instant getIssueInstant() {
-
+ @Nullable public Instant getIssueInstant() {
return issueInstant;
}
/** {@inheritDoc} */
- public void setIssueInstant(final Instant date) {
+ public void setIssueInstant(@Nullable final Instant date) {
issueInstant = prepareForAssignment(issueInstant, date);
}
/** {@inheritDoc} */
- public String getRecipient() {
+ @Nullable public String getRecipient() {
return recipient;
}
/** {@inheritDoc} */
- public void setRecipient(final String recip) {
+ public void setRecipient(@Nullable final String recip) {
recipient = prepareForAssignment(recipient, recip);
}
/** {@inheritDoc} */
- public String getSignatureReferenceID(){
+ @Nullable public String getSignatureReferenceID(){
return id;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final List<XMLObject> children = new ArrayList<>();
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
- if(getSignature() != null){
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null) {
+ return CollectionSupport.singletonList(sig);
}
- return Collections.unmodifiableList(children);
+ return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java
index 7eaa2b7a3..98cd37903 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseAbstractTypeUnmarshaller.java
@@ -31,12 +31,12 @@ import org.opensaml.saml.common.SAMLVersion;
import org.opensaml.saml.saml1.core.ResponseAbstractType;
import org.opensaml.xmlsec.signature.Signature;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import com.google.common.base.Strings;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.DOMTypeSupport;
/**
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseImpl.java
index 86d46f62b..75b78a7b2 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/ResponseImpl.java
@@ -18,25 +18,32 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml1.core.Assertion;
import org.opensaml.saml.saml1.core.Response;
import org.opensaml.saml.saml1.core.Status;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Implementation of the {@link org.opensaml.saml.saml1.core.Response} Object.
+ * Implementation of the {@link Response} Object.
*/
public class ResponseImpl extends ResponseAbstractTypeImpl implements Response {
/** Status associated with this element. */
- private Status status;
+ @Nullable private Status status;
/** List of all the Assertions. */
- private final XMLObjectChildrenList<Assertion> assertions;
+ @Nonnull private final XMLObjectChildrenList<Assertion> assertions;
/**
* Constructor.
@@ -45,32 +52,34 @@ public class ResponseImpl extends ResponseAbstractTypeImpl implements Response {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ResponseImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ResponseImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
assertions = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<Assertion> getAssertions() {
+ @Nonnull @Live public List<Assertion> getAssertions() {
return assertions;
}
/** {@inheritDoc} */
- public Status getStatus() {
+ @Nullable public Status getStatus() {
return status;
}
/** {@inheritDoc} */
- public void setStatus(final Status s) {
+ public void setStatus(@Nullable final Status s) {
status = prepareForAssignment(status, s);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>(1 + assertions.size());
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
if (status != null) {
@@ -79,10 +88,7 @@ public class ResponseImpl extends ResponseAbstractTypeImpl implements Response {
children.addAll(assertions);
- if (children.size() == 0) {
- return null;
- }
-
- return Collections.unmodifiableList(children);
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusCodeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusCodeImpl.java
index 95ed38eb7..4779b0399 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusCodeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusCodeImpl.java
@@ -17,26 +17,30 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.StatusCode;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml1.core.StatusCode} Object.
+ * Concrete implementation of {@link StatusCode}.
*/
public class StatusCodeImpl extends AbstractXMLObject implements StatusCode {
/** Contents of the Value attribute. */
- private QName value;
+ @Nullable private QName value;
/** The child StatusCode sub element. */
- private StatusCode childStatusCode;
+ @Nullable private StatusCode childStatusCode;
/**
* Constructor.
@@ -45,38 +49,39 @@ public class StatusCodeImpl extends AbstractXMLObject implements StatusCode {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected StatusCodeImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected StatusCodeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public QName getValue() {
+ @Nullable public QName getValue() {
return value;
}
/** {@inheritDoc} */
- public void setValue(final QName newValue) {
- this.value = prepareAttributeValueForAssignment(StatusCode.VALUE_ATTRIB_NAME, this.value, newValue);
+ public void setValue(@Nullable final QName newValue) {
+ value = prepareAttributeValueForAssignment(StatusCode.VALUE_ATTRIB_NAME, value, newValue);
}
/** {@inheritDoc} */
- public StatusCode getStatusCode() {
+ @Nullable public StatusCode getStatusCode() {
return childStatusCode;
}
/** {@inheritDoc} */
- public void setStatusCode(final StatusCode statusCode) {
+ public void setStatusCode(@Nullable final StatusCode statusCode) {
childStatusCode = prepareForAssignment(childStatusCode, statusCode);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+
if (childStatusCode != null) {
- final ArrayList<XMLObject> contents = new ArrayList<>(1);
- contents.add(childStatusCode);
- return Collections.unmodifiableList(contents);
- } else {
- return null;
+ return CollectionSupport.singletonList(childStatusCode);
}
+
+ return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusDetailImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusDetailImpl.java
index 597c1012f..da2aca1f9 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusDetailImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusDetailImpl.java
@@ -17,9 +17,10 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.AbstractXMLObject;
@@ -27,13 +28,18 @@ import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.IndexedXMLObjectChildrenList;
import org.opensaml.saml.saml1.core.StatusDetail;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.StatusDetail}.
+ * Concrete implementation of {@link StatusDetail}.
*/
public class StatusDetailImpl extends AbstractXMLObject implements StatusDetail {
/** child "any" elements. */
- private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
/**
* Constructor.
@@ -42,26 +48,26 @@ public class StatusDetailImpl extends AbstractXMLObject implements StatusDetail
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected StatusDetailImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected StatusDetailImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownChildren = new IndexedXMLObjectChildrenList<>(this);
}
- /**
- * {@inheritDoc}
- */
- public List<XMLObject> getUnknownXMLObjects() {
+ /** {@inheritDoc} */
+ @Nonnull @Live public List<XMLObject> getUnknownXMLObjects() {
return unknownChildren;
}
/** {@inheritDoc} */
- public List<XMLObject> getUnknownXMLObjects(final QName typeOrName) {
+ @SuppressWarnings("unchecked")
+ @Nonnull @Live public List<XMLObject> getUnknownXMLObjects(@Nonnull final QName typeOrName) {
return (List<XMLObject>) unknownChildren.subList(typeOrName);
}
- /**
- * {@inheritDoc}
- */
- public List<XMLObject> getOrderedChildren() {
- return Collections.unmodifiableList(unknownChildren);
+
+ /** {@inheritDoc} */
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ return CollectionSupport.copyToList(unknownChildren);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusImpl.java
index da98c8f5a..55770bc89 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.Status;
@@ -28,19 +30,23 @@ import org.opensaml.saml.saml1.core.StatusCode;
import org.opensaml.saml.saml1.core.StatusDetail;
import org.opensaml.saml.saml1.core.StatusMessage;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
* Concrete Implementation {@link org.opensaml.saml.saml1.core.Status}.
*/
public class StatusImpl extends AbstractXMLObject implements Status {
/** Representation of the StatusMessage element. */
- private StatusMessage statusMessage;
+ @Nullable private StatusMessage statusMessage;
/** Representation of the StatusCode element. */
- private StatusCode statusCode;
+ @Nullable private StatusCode statusCode;
/** Representation of the StatusDetail element. */
- private StatusDetail statusDetail;
+ @Nullable private StatusDetail statusDetail;
/**
* Constructor.
@@ -49,42 +55,43 @@ public class StatusImpl extends AbstractXMLObject implements Status {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected StatusImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected StatusImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public StatusMessage getStatusMessage() {
+ @Nullable public StatusMessage getStatusMessage() {
return statusMessage;
}
/** {@inheritDoc} */
- public void setStatusMessage(final StatusMessage message) {
+ public void setStatusMessage(@Nullable final StatusMessage message) {
statusMessage = prepareForAssignment(statusMessage, message);
}
/** {@inheritDoc} */
- public StatusCode getStatusCode() {
+ @Nullable public StatusCode getStatusCode() {
return statusCode;
}
/** {@inheritDoc} */
- public void setStatusCode(final StatusCode code) {
+ public void setStatusCode(@Nullable final StatusCode code) {
statusCode = prepareForAssignment(statusCode, code);
}
/** {@inheritDoc} */
- public StatusDetail getStatusDetail() {
+ @Nullable public StatusDetail getStatusDetail() {
return statusDetail;
}
/** {@inheritDoc} */
- public void setStatusDetail(final StatusDetail detail) {
+ public void setStatusDetail(@Nullable final StatusDetail detail) {
statusDetail = prepareForAssignment(statusDetail, detail);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>(3);
if (statusCode != null) {
@@ -99,10 +106,7 @@ public class StatusImpl extends AbstractXMLObject implements Status {
children.add(statusDetail);
}
- if (children.size() == 0) {
- return null;
- }
-
- return Collections.unmodifiableList(children);
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusMessageImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusMessageImpl.java
index 2ec63f5c5..bf7945542 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusMessageImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/StatusMessageImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml1.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml1.core.StatusMessage;
@@ -32,8 +35,8 @@ public class StatusMessageImpl extends XSStringImpl implements StatusMessage {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected StatusMessageImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected StatusMessageImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectConfirmationImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectConfirmationImpl.java
index 493093250..2b1e9a219 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectConfirmationImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectConfirmationImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
@@ -28,19 +30,24 @@ import org.opensaml.saml.saml1.core.ConfirmationMethod;
import org.opensaml.saml.saml1.core.SubjectConfirmation;
import org.opensaml.xmlsec.signature.KeyInfo;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete implementation of a <code> SubjectConfirmation </code> object.
+ * Concrete implementation of {@link SubjectConfirmation}.
*/
public class SubjectConfirmationImpl extends AbstractXMLObject implements SubjectConfirmation {
/** Contains the list of ConfirmationMethods. */
- private final XMLObjectChildrenList<ConfirmationMethod> confirmationMethods;
+ @Nonnull private final XMLObjectChildrenList<ConfirmationMethod> confirmationMethods;
/** Contains the SubjectConfirmationData element. */
- private XMLObject subjectConfirmationData;
+ @Nullable private XMLObject subjectConfirmationData;
/** Contains the KeyInfo element. */
- private KeyInfo keyInfo;
+ @Nullable private KeyInfo keyInfo;
/**
* Constructor.
@@ -49,39 +56,39 @@ public class SubjectConfirmationImpl extends AbstractXMLObject implements Subjec
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SubjectConfirmationImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SubjectConfirmationImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
confirmationMethods = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<ConfirmationMethod> getConfirmationMethods() {
+ @Nonnull @Live public List<ConfirmationMethod> getConfirmationMethods() {
return confirmationMethods;
}
-
+
/** {@inheritDoc} */
- public void setSubjectConfirmationData(final XMLObject data) {
- subjectConfirmationData = prepareForAssignment(subjectConfirmationData, data);
+ @Nullable public XMLObject getSubjectConfirmationData() {
+ return subjectConfirmationData;
}
-
+
/** {@inheritDoc} */
- public XMLObject getSubjectConfirmationData() {
- return subjectConfirmationData;
+ public void setSubjectConfirmationData(@Nullable final XMLObject data) {
+ subjectConfirmationData = prepareForAssignment(subjectConfirmationData, data);
}
/** {@inheritDoc} */
- public KeyInfo getKeyInfo() {
+ @Nullable public KeyInfo getKeyInfo() {
return keyInfo;
}
/** {@inheritDoc} */
- public void setKeyInfo(final KeyInfo info) {
+ public void setKeyInfo(@Nullable final KeyInfo info) {
keyInfo = prepareForAssignment(keyInfo, info);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(confirmationMethods.size() + 1);
@@ -91,13 +98,11 @@ public class SubjectConfirmationImpl extends AbstractXMLObject implements Subjec
list.add(subjectConfirmationData);
}
- if(keyInfo != null){
+ if (keyInfo != null) {
list.add(keyInfo);
}
- if (list.size() == 0) {
- return null;
- }
- return Collections.unmodifiableList(list);
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectImpl.java
index 3fd22ada4..8acc912c3 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectImpl.java
@@ -18,25 +18,31 @@
package org.opensaml.saml.saml1.core.impl;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.NameIdentifier;
import org.opensaml.saml.saml1.core.Subject;
import org.opensaml.saml.saml1.core.SubjectConfirmation;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Complete implementation of {@link org.opensaml.saml.saml1.core.Subject}.
+ * Complete implementation of {@link Subject}.
*/
public class SubjectImpl extends AbstractXMLObject implements Subject {
/** Contains the NameIdentifier inside the Subject. */
- private NameIdentifier nameIdentifier;
+ @Nullable private NameIdentifier nameIdentifier;
/** Contains the SubjectConfirmation inside the Subject. */
- private SubjectConfirmation subjectConfirmation;
+ @Nullable private SubjectConfirmation subjectConfirmation;
/**
* Constructor.
@@ -45,32 +51,33 @@ public class SubjectImpl extends AbstractXMLObject implements Subject {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SubjectImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected SubjectImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public NameIdentifier getNameIdentifier() {
+ @Nullable public NameIdentifier getNameIdentifier() {
return nameIdentifier;
}
/** {@inheritDoc} */
- public void setNameIdentifier(final NameIdentifier name) {
+ public void setNameIdentifier(@Nullable final NameIdentifier name) {
nameIdentifier = prepareForAssignment(nameIdentifier, name);
}
/** {@inheritDoc} */
- public SubjectConfirmation getSubjectConfirmation() {
+ @Nullable public SubjectConfirmation getSubjectConfirmation() {
return subjectConfirmation;
}
/** {@inheritDoc} */
- public void setSubjectConfirmation(final SubjectConfirmation conf) {
+ public void setSubjectConfirmation(@Nullable final SubjectConfirmation conf) {
subjectConfirmation = prepareForAssignment(subjectConfirmation, conf);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(2);
@@ -81,10 +88,8 @@ public class SubjectImpl extends AbstractXMLObject implements Subject {
if (subjectConfirmation != null) {
list.add(subjectConfirmation);
}
- if (list.size() == 0) {
- return null;
- }
- return Collections.unmodifiableList(list);
+ return CollectionSupport.copyToList(list);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectLocalityImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectLocalityImpl.java
index 44d9bd085..63507c8b7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectLocalityImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectLocalityImpl.java
@@ -19,20 +19,26 @@ package org.opensaml.saml.saml1.core.impl;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.SubjectLocality;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * A concrete implementation of the {@link org.opensaml.saml.saml1.core.SubjectLocality} interface.
+ * A concrete implementation of the {@link SubjectLocality} interface.
*/
public class SubjectLocalityImpl extends AbstractXMLObject implements SubjectLocality {
/** The ipAddress. */
- private String ipAddress;
+ @Nullable private String ipAddress;
/** The DNS Address. */
- private String dnsAddress;
+ @Nullable private String dnsAddress;
/**
* Constructor.
@@ -41,34 +47,34 @@ public class SubjectLocalityImpl extends AbstractXMLObject implements SubjectLoc
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SubjectLocalityImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SubjectLocalityImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getIPAddress() {
+ @Nullable public String getIPAddress() {
return ipAddress;
}
/** {@inheritDoc} */
- public void setIPAddress(final String address) {
+ public void setIPAddress(@Nullable final String address) {
ipAddress = prepareForAssignment(ipAddress, address);
}
/** {@inheritDoc} */
- public String getDNSAddress() {
+ @Nullable public String getDNSAddress() {
return dnsAddress;
}
/** {@inheritDoc} */
- public void setDNSAddress(final String address) {
+ public void setDNSAddress(@Nullable final String address) {
dnsAddress = prepareForAssignment(dnsAddress, address);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- // No children
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectQueryImpl.java
index d893fffc7..888e907f4 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectQueryImpl.java
@@ -17,22 +17,27 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.Subject;
import org.opensaml.saml.saml1.core.SubjectQuery;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Concrete (but abstract) implementation of {@link org.opensaml.saml.saml1.core.SubjectQuery} abstract type.
+ * Abstract implementation of {@link SubjectQuery} type.
*/
public abstract class SubjectQueryImpl extends AbstractXMLObject implements SubjectQuery {
/** Contains the Subject subelement. */
- private Subject subject;
+ @Nullable private Subject subject;
/**
* Constructor.
@@ -41,28 +46,29 @@ public abstract class SubjectQueryImpl extends AbstractXMLObject implements Subj
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SubjectQueryImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected SubjectQueryImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public Subject getSubject() {
+ @Nullable public Subject getSubject() {
return subject;
}
/** {@inheritDoc} */
- public void setSubject(final Subject sub) {
+ public void setSubject(@Nullable final Subject sub) {
subject = prepareForAssignment(subject, sub);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- if (subject == null) {
- return null;
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+
+ if (subject != null) {
+ return CollectionSupport.singletonList(subject);
}
- final List<XMLObject> children = new ArrayList<>();
- children.add(subject);
- return Collections.unmodifiableList(children);
+ return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectStatementImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectStatementImpl.java
index 855c8ca59..98a68a39d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectStatementImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/core/impl/SubjectStatementImpl.java
@@ -17,22 +17,27 @@
package org.opensaml.saml.saml1.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml1.core.Subject;
import org.opensaml.saml.saml1.core.SubjectStatement;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
- * Abstract type to implement SubjectStatementType.
+ * Abstract implementation of {@link SubjectStatement} type.
*/
public abstract class SubjectStatementImpl extends AbstractXMLObject implements SubjectStatement {
/** Contains the Subject subelement. */
- private Subject subject;
+ @Nullable private Subject subject;
/**
* Constructor.
@@ -41,29 +46,28 @@ public abstract class SubjectStatementImpl extends AbstractXMLObject implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SubjectStatementImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SubjectStatementImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public Subject getSubject() {
+ @Nullable public Subject getSubject() {
return subject;
}
/** {@inheritDoc} */
- public void setSubject(final Subject sub) {
+ public void setSubject(@Nullable final Subject sub) {
subject = prepareForAssignment(subject, sub);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- if (subject == null) {
- return null;
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ if (subject != null) {
+ return CollectionSupport.singletonList(subject);
}
-
- final List<XMLObject> children = new ArrayList<>();
- children.add(subject);
- return Collections.unmodifiableList(children);
+
+ return null;
}
+
}
\ 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