[java-opensaml] branch main updated: IDP-2069 - Null Handling Task
Scott Cantor
cantor.2 at osu.edu
Thu Apr 6 17:25:40 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=1fbfdc1070d45c343183f24d2ea4705550c79a34
The following commit(s) were added to refs/heads/main by this push:
new 1fbfdc107 IDP-2069 - Null Handling Task
1fbfdc107 is described below
commit 1fbfdc1070d45c343183f24d2ea4705550c79a34
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Apr 6 13:25:36 2023 -0400
IDP-2069 - Null Handling Task
https://shibboleth.atlassian.net/browse/IDP-2069
Clean SAML 2 impl classes.
Tighten up some additional methods.
---
.../core/xml/io/AbstractXMLObjectMarshaller.java | 2 +
.../metadata/support/SAML2MetadataSupport.java | 3 +-
.../saml/saml1/core/ResponseAbstractType.java | 2 +-
.../opensaml/saml/saml2/common/SAML2Support.java | 15 +--
.../saml/saml1/core/impl/AttributeQueryImpl.java | 1 +
.../saml1/core/impl/AttributeStatementImpl.java | 1 +
.../core/impl/AuthenticationStatementImpl.java | 1 +
.../core/impl/AuthorizationDecisionQueryImpl.java | 1 +
.../impl/AuthorizationDecisionStatementImpl.java | 1 +
.../opensaml/saml/saml1/core/impl/RequestImpl.java | 1 +
.../saml/saml1/core/impl/ResponseImpl.java | 1 +
.../saml/saml2/core/impl/AbstractNameIDType.java | 33 ++---
.../opensaml/saml/saml2/core/impl/ActionImpl.java | 14 +-
.../opensaml/saml/saml2/core/impl/AdviceImpl.java | 38 +++---
.../saml/saml2/core/impl/ArtifactImpl.java | 6 +-
.../saml/saml2/core/impl/ArtifactResolveImpl.java | 35 ++---
.../saml/saml2/core/impl/ArtifactResponseImpl.java | 36 +++--
.../saml/saml2/core/impl/AssertionIDRefImpl.java | 7 +-
.../saml2/core/impl/AssertionIDRequestImpl.java | 35 +++--
.../saml/saml2/core/impl/AssertionImpl.java | 84 +++++++-----
.../saml/saml2/core/impl/AssertionURIRefImpl.java | 7 +-
.../saml/saml2/core/impl/AttributeImpl.java | 50 +++----
.../saml/saml2/core/impl/AttributeQueryImpl.java | 35 +++--
.../saml2/core/impl/AttributeStatementImpl.java | 32 +++--
.../saml2/core/impl/AudienceRestrictionImpl.java | 33 ++---
.../core/impl/AuthenticatingAuthorityImpl.java | 9 +-
.../saml2/core/impl/AuthnContextClassRefImpl.java | 5 +-
.../saml/saml2/core/impl/AuthnContextImpl.java | 66 +++++----
.../saml/saml2/core/impl/AuthnQueryImpl.java | 48 ++++---
.../saml/saml2/core/impl/AuthnRequestImpl.java | 150 +++++++++++----------
.../saml/saml2/core/impl/AuthnStatementImpl.java | 70 ++++++----
.../saml2/core/impl/AuthzDecisionQueryImpl.java | 48 ++++---
.../core/impl/AuthzDecisionStatementImpl.java | 54 +++++---
.../opensaml/saml/saml2/core/impl/BaseIDImpl.java | 30 +++--
.../saml/saml2/core/impl/ConditionsImpl.java | 47 ++++---
.../saml2/core/impl/EncryptedAssertionImpl.java | 11 +-
.../saml2/core/impl/EncryptedAttributeImpl.java | 11 +-
.../saml2/core/impl/EncryptedElementTypeImpl.java | 41 +++---
.../saml/saml2/core/impl/EncryptedIDImpl.java | 10 +-
.../saml/saml2/core/impl/EvidenceImpl.java | 41 +++---
.../saml/saml2/core/impl/ExtensionsImpl.java | 26 ++--
.../saml/saml2/core/impl/GetCompleteImpl.java | 6 +-
.../saml/saml2/core/impl/IDPEntryImpl.java | 44 +++---
.../opensaml/saml/saml2/core/impl/IDPListImpl.java | 40 +++---
.../opensaml/saml/saml2/core/impl/IssuerImpl.java | 9 +-
.../core/impl/KeyInfoConfirmationDataTypeImpl.java | 15 ++-
.../saml/saml2/core/impl/LogoutRequestImpl.java | 77 ++++++-----
.../saml/saml2/core/impl/LogoutResponseImpl.java | 10 +-
.../saml2/core/impl/ManageNameIDRequestImpl.java | 80 ++++++-----
.../saml2/core/impl/ManageNameIDResponseImpl.java | 10 +-
.../opensaml/saml/saml2/core/impl/NameIDImpl.java | 7 +-
.../saml2/core/impl/NameIDMappingRequestImpl.java | 61 +++++----
.../saml2/core/impl/NameIDMappingResponseImpl.java | 41 +++---
.../saml/saml2/core/impl/NameIDPolicyImpl.java | 36 +++--
.../saml/saml2/core/impl/NewEncryptedIDImpl.java | 11 +-
.../opensaml/saml/saml2/core/impl/NewIDImpl.java | 6 +-
.../saml/saml2/core/impl/OneTimeUseImpl.java | 14 +-
.../saml/saml2/core/impl/ProxyRestrictionImpl.java | 22 ++-
.../saml2/core/impl/RequestAbstractTypeImpl.java | 75 ++++++-----
.../saml2/core/impl/RequestedAuthnContextImpl.java | 36 ++---
.../saml/saml2/core/impl/RequesterIDImpl.java | 6 +-
.../saml/saml2/core/impl/ResponseImpl.java | 36 +++--
.../opensaml/saml/saml2/core/impl/ScopingImpl.java | 39 +++---
.../saml/saml2/core/impl/SessionIndexImpl.java | 6 +-
.../saml/saml2/core/impl/StatusCodeImpl.java | 42 +++---
.../saml/saml2/core/impl/StatusDetailImpl.java | 25 ++--
.../opensaml/saml/saml2/core/impl/StatusImpl.java | 43 +++---
.../saml/saml2/core/impl/StatusMessageImpl.java | 7 +-
.../saml2/core/impl/StatusResponseTypeImpl.java | 126 +++++++++--------
.../core/impl/SubjectConfirmationDataImpl.java | 60 +++++----
.../saml2/core/impl/SubjectConfirmationImpl.java | 53 +++++---
.../opensaml/saml/saml2/core/impl/SubjectImpl.java | 41 +++---
.../saml/saml2/core/impl/SubjectLocalityImpl.java | 27 ++--
.../saml/saml2/core/impl/SubjectQueryImpl.java | 36 ++---
.../saml/saml2/core/impl/TerminateImpl.java | 14 +-
.../saml/saml2/ecp/impl/RelayStateImpl.java | 29 ++--
.../saml2/ecp/impl/RequestAuthenticatedImpl.java | 29 ++--
.../opensaml/saml/saml2/ecp/impl/RequestImpl.java | 68 ++++++----
.../opensaml/saml/saml2/ecp/impl/ResponseImpl.java | 35 +++--
.../saml2/ecp/impl/SubjectConfirmationImpl.java | 51 +++----
.../impl/AdditionalMetadataLocationImpl.java | 5 +-
.../saml2/metadata/impl/AffiliateMemberImpl.java | 7 +-
.../metadata/impl/AffiliationDescriptorImpl.java | 69 +++++-----
.../impl/ArtifactResolutionServiceImpl.java | 10 +-
.../impl/AssertionConsumerServiceImpl.java | 10 +-
.../impl/AssertionIDRequestServiceImpl.java | 10 +-
.../impl/AttributeAuthorityDescriptorImpl.java | 52 +++----
.../impl/AttributeConsumingServiceImpl.java | 44 +++---
.../saml2/metadata/impl/AttributeProfileImpl.java | 7 +-
.../saml2/metadata/impl/AttributeServiceImpl.java | 10 +-
.../impl/AuthnAuthorityDescriptorImpl.java | 44 +++---
.../saml2/metadata/impl/AuthnQueryServiceImpl.java | 10 +-
.../saml/saml2/metadata/impl/AuthzServiceImpl.java | 9 +-
.../saml/saml2/metadata/impl/CompanyImpl.java | 6 +-
.../saml2/metadata/impl/ContactPersonImpl.java | 77 +++++------
.../saml/saml2/metadata/impl/EmailAddressImpl.java | 6 +-
.../saml2/metadata/impl/EncryptionMethodImpl.java | 9 +-
.../saml/saml2/metadata/impl/EndpointImpl.java | 51 ++++---
.../metadata/impl/EntitiesDescriptorImpl.java | 71 +++++-----
.../saml2/metadata/impl/EntityDescriptorImpl.java | 109 ++++++++-------
.../saml/saml2/metadata/impl/ExtensionsImpl.java | 23 +++-
.../metadata/impl/ExtensionsUnmarshaller.java | 15 +--
.../saml/saml2/metadata/impl/GivenNameImpl.java | 7 +-
.../saml2/metadata/impl/IDPSSODescriptorImpl.java | 57 ++++----
.../saml2/metadata/impl/IndexedEndpointImpl.java | 14 +-
.../saml2/metadata/impl/KeyDescriptorImpl.java | 31 +++--
.../saml2/metadata/impl/LocalizedNameImpl.java | 23 ++--
.../saml/saml2/metadata/impl/LocalizedURIImpl.java | 15 ++-
.../metadata/impl/ManageNameIDServiceImpl.java | 10 +-
.../saml/saml2/metadata/impl/NameIDFormatImpl.java | 6 +-
.../metadata/impl/NameIDMappingServiceImpl.java | 10 +-
.../metadata/impl/OrganizationDisplayNameImpl.java | 10 +-
.../saml/saml2/metadata/impl/OrganizationImpl.java | 45 ++++---
.../saml2/metadata/impl/OrganizationNameImpl.java | 10 +-
.../saml2/metadata/impl/OrganizationURLImpl.java | 9 +-
.../saml2/metadata/impl/PDPDescriptorImpl.java | 50 ++++---
.../metadata/impl/RequestedAttributeImpl.java | 19 +--
.../saml2/metadata/impl/RoleDescriptorImpl.java | 96 +++++++------
.../saml2/metadata/impl/SPSSODescriptorImpl.java | 80 ++++++-----
.../saml2/metadata/impl/SSODescriptorImpl.java | 46 ++++---
.../metadata/impl/ServiceDescriptionImpl.java | 10 +-
.../saml/saml2/metadata/impl/ServiceNameImpl.java | 8 +-
.../metadata/impl/SingleLogoutServiceImpl.java | 10 +-
.../metadata/impl/SingleSignOnServiceImpl.java | 10 +-
.../saml/saml2/metadata/impl/SurNameImpl.java | 6 +-
.../saml2/metadata/impl/TelephoneNumberImpl.java | 7 +-
.../saml/saml1/core/tests/ResponseTest.java | 2 +-
.../tests/SAML20AssertionValidatorTest.java | 6 +-
.../opensaml/saml/saml2/core/tests/MockBaseID.java | 29 ++--
.../impl/AttributeAuthorityDescriptorTest.java | 2 +-
.../impl/AuthnAuthorityDescriptorTest.java | 2 +-
.../saml2/metadata/impl/PDPDescriptorTest.java | 2 +-
.../core/testing/XMLObjectBaseTestCase.java | 6 +-
133 files changed, 2218 insertions(+), 1588 deletions(-)
diff --git a/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java b/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java
index f8e13bb7d..60ce9a2d1 100644
--- a/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java
+++ b/opensaml-core-api/src/main/java/org/opensaml/core/xml/io/AbstractXMLObjectMarshaller.java
@@ -253,6 +253,8 @@ public abstract class AbstractXMLObjectMarshaller implements Marshaller {
final List<XMLObject> childXMLObjects = xmlObject.getOrderedChildren();
if (childXMLObjects != null && childXMLObjects.size() > 0) {
for (final XMLObject childXMLObject : childXMLObjects) {
+ // TODO: this can be removed iff we clean the remaining XACML implementation classes
+ // to stop emitting nulls.
if (childXMLObject == null) {
continue;
}
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/metadata/support/SAML2MetadataSupport.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/metadata/support/SAML2MetadataSupport.java
index a085685ee..214d2de4f 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/metadata/support/SAML2MetadataSupport.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/metadata/support/SAML2MetadataSupport.java
@@ -20,6 +20,7 @@ package org.opensaml.saml.metadata.support;
import java.util.List;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.opensaml.saml.saml2.metadata.IndexedEndpoint;
import org.slf4j.Logger;
@@ -55,7 +56,7 @@ public final class SAML2MetadataSupport {
* @param <T> the subtype of IndexedType
*
*/
- public static <T extends IndexedEndpoint> T getDefaultIndexedEndpoint(final List<T> candidates) {
+ @Nullable public static <T extends IndexedEndpoint> T getDefaultIndexedEndpoint(final List<T> candidates) {
LOG.debug("Selecting default IndexedEndpoint");
if (candidates == null || candidates.isEmpty()) {
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/ResponseAbstractType.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/ResponseAbstractType.java
index d2e23ad02..2d92761c0 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/ResponseAbstractType.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/core/ResponseAbstractType.java
@@ -85,7 +85,7 @@ public interface ResponseAbstractType extends SignableSAMLObject {
void setID(@Nullable final String id);
/**
- * Sets the SAML version for this message.
+ * Gets the SAML version for this message.
*
* @return SAML version for this message
*/
diff --git a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java
index a77a97b71..9daf6dce0 100644
--- a/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java
+++ b/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/common/SAML2Support.java
@@ -90,24 +90,21 @@ public final class SAML2Support {
Instant earliestExpiration = candidateTime;
// Test duration based times
- if (xmlObject instanceof CacheableSAMLObject) {
- earliestExpiration = getEarliestExpirationFromCacheable((CacheableSAMLObject)xmlObject, earliestExpiration,
- now);
+ if (xmlObject instanceof CacheableSAMLObject cacheable) {
+ earliestExpiration = getEarliestExpirationFromCacheable(cacheable, earliestExpiration, now);
}
// Test instant based times
- if (xmlObject instanceof TimeBoundSAMLObject) {
- earliestExpiration = getEarliestExpirationFromTimeBound((TimeBoundSAMLObject)xmlObject, earliestExpiration);
+ if (xmlObject instanceof TimeBoundSAMLObject timebound) {
+ earliestExpiration = getEarliestExpirationFromTimeBound(timebound, earliestExpiration);
}
// Inspect children
if (xmlObject != null) {
final List<XMLObject> children = xmlObject.getOrderedChildren();
- if (children != null) {
+ if (children != null && !children.isEmpty()) {
for (final XMLObject child : children) {
- if (child != null) {
- earliestExpiration = getEarliestExpiration(child, earliestExpiration, now);
- }
+ earliestExpiration = getEarliestExpiration(child, earliestExpiration, now);
}
}
}
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 a6097b86a..0296b4f2e 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
@@ -73,6 +73,7 @@ public class AttributeQueryImpl extends SubjectQueryImpl implements AttributeQue
}
/** {@inheritDoc} */
+ @Override
@Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(attributeDesignators.size() + 1);
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 416e96ff4..ccd98d5fc 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
@@ -60,6 +60,7 @@ public class AttributeStatementImpl extends SubjectStatementImpl implements Attr
}
/** {@inheritDoc} */
+ @Override
@Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(attributes.size() + 1);
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 d80c2e557..526905a78 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
@@ -101,6 +101,7 @@ public class AuthenticationStatementImpl extends SubjectStatementImpl implements
}
/** {@inheritDoc} */
+ @Override
@Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(authorityBindings.size() + 2);
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 357b47886..3433d3f81 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
@@ -89,6 +89,7 @@ public class AuthorizationDecisionQueryImpl extends SubjectQueryImpl implements
}
/** {@inheritDoc} */
+ @Override
@Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(actions.size() + 2);
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 89184f8c6..0d283840a 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
@@ -101,6 +101,7 @@ public class AuthorizationDecisionStatementImpl extends SubjectStatementImpl imp
}
/** {@inheritDoc} */
+ @Override
@Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>(actions.size() + 2);
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 623ca65e7..d734e5eaa 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
@@ -108,6 +108,7 @@ public class RequestImpl extends RequestAbstractTypeImpl implements Request {
}
/** {@inheritDoc} */
+ @Override
@Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final List<XMLObject> list = new ArrayList<>();
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 75b78a7b2..935345308 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
@@ -74,6 +74,7 @@ public class ResponseImpl extends ResponseAbstractTypeImpl implements Response {
}
/** {@inheritDoc} */
+ @Override
@Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>(1 + assertions.size());
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AbstractNameIDType.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AbstractNameIDType.java
index fdc18e351..a9f0c74a6 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AbstractNameIDType.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AbstractNameIDType.java
@@ -17,25 +17,28 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.core.NameIDType;
/**
- * Abstract implementation of {@link org.opensaml.saml.saml2.core.NameIDType}.
+ * Abstract implementation of {@link NameIDType}.
*/
public class AbstractNameIDType extends XSStringImpl implements NameIDType {
/** Name Qualifier of the Name ID. */
- private String nameQualifier;
+ @Nullable private String nameQualifier;
/** SP Name Qualifier of the Name ID. */
- private String spNameQualifier;
+ @Nullable private String spNameQualifier;
/** Format of the Name ID. */
- private String format;
+ @Nullable private String format;
/** SP ProvidedID of the NameID. */
- private String spProvidedID;
+ @Nullable private String spProvidedID;
/**
* Constructor.
@@ -44,48 +47,48 @@ public class AbstractNameIDType extends XSStringImpl implements NameIDType {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AbstractNameIDType(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AbstractNameIDType(@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 void setNameQualifier(final String newNameQualifier) {
+ public void setNameQualifier(@Nullable final String newNameQualifier) {
this.nameQualifier = prepareForAssignment(this.nameQualifier, newNameQualifier);
}
/** {@inheritDoc} */
- public String getSPNameQualifier() {
+ @Nullable public String getSPNameQualifier() {
return spNameQualifier;
}
/** {@inheritDoc} */
- public void setSPNameQualifier(final String newSPNameQualifier) {
+ public void setSPNameQualifier(@Nullable final String newSPNameQualifier) {
this.spNameQualifier = prepareForAssignment(this.spNameQualifier, newSPNameQualifier);
}
/** {@inheritDoc} */
- public String getFormat() {
+ @Nullable public String getFormat() {
return format;
}
/** {@inheritDoc} */
- public void setFormat(final String newFormat) {
+ public void setFormat(@Nullable final String newFormat) {
this.format = prepareForAssignment(this.format, newFormat);
}
/** {@inheritDoc} */
- public String getSPProvidedID() {
+ @Nullable public String getSPProvidedID() {
return spProvidedID;
}
/** {@inheritDoc} */
- public void setSPProvidedID(final String newSPProvidedID) {
+ public void setSPProvidedID(@Nullable final String newSPProvidedID) {
this.spProvidedID = prepareForAssignment(this.spProvidedID, newSPProvidedID);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ActionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ActionImpl.java
index eadae62e0..0482f5b36 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ActionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ActionImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.core.Action;
@@ -30,7 +33,7 @@ import org.opensaml.saml.saml2.core.Action;
public class ActionImpl extends XSStringImpl implements Action {
/** URI of the Namespace of this Action. */
- private String namespace;
+ @Nullable private String namespace;
/**
* Constructor.
@@ -39,18 +42,19 @@ 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} */
- public String getNamespace() {
+ @Nullable public String getNamespace() {
return namespace;
}
/** {@inheritDoc} */
- public void setNamespace(final String newNamespace) {
- this.namespace = prepareForAssignment(this.namespace, newNamespace);
+ public void setNamespace(@Nullable final String newNamespace) {
+ namespace = prepareForAssignment(namespace, newNamespace);
}
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AdviceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AdviceImpl.java
index cca87d480..f69c4bc2d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AdviceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AdviceImpl.java
@@ -21,10 +21,10 @@
package org.opensaml.saml.saml2.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;
@@ -36,13 +36,19 @@ import org.opensaml.saml.saml2.core.AssertionIDRef;
import org.opensaml.saml.saml2.core.AssertionURIRef;
import org.opensaml.saml.saml2.core.EncryptedAssertion;
+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.saml2.core.Advice}.
+ * A concrete implementation of {@link Advice}.
*/
+ at SuppressWarnings("unchecked")
public class AdviceImpl extends AbstractXMLObject implements Advice {
/** Children. */
- private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
/**
* Constructor.
@@ -51,47 +57,45 @@ 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);
indexedChildren = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<XMLObject> getChildren() {
+ @Nonnull @Live public List<XMLObject> getChildren() {
return indexedChildren;
}
/** {@inheritDoc} */
- public List<XMLObject> getChildren(final QName typeOrName) {
+ @Nonnull @Live public List<XMLObject> getChildren(@Nonnull final QName typeOrName) {
return (List<XMLObject>) indexedChildren.subList(typeOrName);
}
/** {@inheritDoc} */
- public List<AssertionIDRef> getAssertionIDReferences() {
+ @Nonnull @Live public List<AssertionIDRef> getAssertionIDReferences() {
return (List<AssertionIDRef>) indexedChildren.subList(AssertionIDRef.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<AssertionURIRef> getAssertionURIReferences() {
+ @Nonnull @Live public List<AssertionURIRef> getAssertionURIReferences() {
return (List<AssertionURIRef>) indexedChildren.subList(AssertionURIRef.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<Assertion> getAssertions() {
+ @Nonnull @Live public List<Assertion> getAssertions() {
return (List<Assertion>) indexedChildren.subList(Assertion.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<EncryptedAssertion> getEncryptedAssertions() {
+ @Nonnull @Live public List<EncryptedAssertion> getEncryptedAssertions() {
return (List<EncryptedAssertion>) indexedChildren.subList(EncryptedAssertion.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<>();
-
- children.addAll(indexedChildren);
-
- return Collections.unmodifiableList(children);
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ return CollectionSupport.copyToList(indexedChildren);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactImpl.java
index 3c7bb6cc4..4e157fd7d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.core.Artifact;
@@ -36,7 +39,8 @@ public class ArtifactImpl extends XSStringImpl implements Artifact {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ArtifactImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ArtifactImpl(@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/saml2/core/impl/ArtifactResolveImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactResolveImpl.java
index f03c45e4f..90ee32fe9 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactResolveImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactResolveImpl.java
@@ -22,20 +22,26 @@
package org.opensaml.saml.saml2.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.saml2.core.Artifact;
import org.opensaml.saml.saml2.core.ArtifactResolve;
+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.ArtifactResolve}.
+ * Concrete implementation of {@link ArtifactResolve}.
*/
public class ArtifactResolveImpl extends RequestAbstractTypeImpl implements ArtifactResolve {
/** Artifact child element. */
- private Artifact artifact;
+ @Nullable private Artifact artifact;
/**
* Constructor.
@@ -44,37 +50,36 @@ public class ArtifactResolveImpl extends RequestAbstractTypeImpl implements Arti
* @param elementLocalName element name
* @param namespacePrefix namespace prefix
*/
- protected ArtifactResolveImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ArtifactResolveImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public Artifact getArtifact() {
+ @Nullable public Artifact getArtifact() {
return this.artifact;
}
/** {@inheritDoc} */
- public void setArtifact(final Artifact newArtifact) {
+ public void setArtifact(@Nullable final Artifact newArtifact) {
this.artifact = prepareForAssignment(this.artifact, newArtifact);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
if (artifact != null) {
children.add(artifact);
}
- 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/saml2/core/impl/ArtifactResponseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactResponseImpl.java
index ae990199a..4dcf1128d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactResponseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ArtifactResponseImpl.java
@@ -22,20 +22,26 @@
package org.opensaml.saml.saml2.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.common.SAMLObject;
import org.opensaml.saml.saml2.core.ArtifactResponse;
+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.ArtifactResponse}.
+ * Concrete implementation of {@link ArtifactResponse}.
*/
public class ArtifactResponseImpl extends StatusResponseTypeImpl implements ArtifactResponse {
/** Protocol message. */
- private SAMLObject protocolMessage;
+ @Nullable private SAMLObject protocolMessage;
/**
* Constructor.
@@ -44,30 +50,38 @@ public class ArtifactResponseImpl extends StatusResponseTypeImpl implements Arti
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ArtifactResponseImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ArtifactResponseImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public SAMLObject getMessage() {
+ @Nullable public SAMLObject getMessage() {
return protocolMessage;
}
/** {@inheritDoc} */
- public void setMessage(final SAMLObject message) {
+ public void setMessage(@Nullable final SAMLObject message) {
protocolMessage = prepareForAssignment(protocolMessage, message);
}
/**
* {@inheritDoc}
*/
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- children.addAll(super.getOrderedChildren());
- children.add(protocolMessage);
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
+ }
- return Collections.unmodifiableList(children);
+ if (protocolMessage != null) {
+ children.add(protocolMessage);
+ }
+
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionIDRefImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionIDRefImpl.java
index ff8aee726..bbfac714c 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionIDRefImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionIDRefImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.core.AssertionIDRef;
@@ -36,8 +39,8 @@ public class AssertionIDRefImpl extends XSStringImpl implements AssertionIDRef {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AssertionIDRefImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AssertionIDRefImpl(@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/saml2/core/impl/AssertionIDRequestImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionIDRequestImpl.java
index f4bfd3dca..a1bd211ff 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionIDRequestImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionIDRequestImpl.java
@@ -22,21 +22,28 @@
package org.opensaml.saml.saml2.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.saml2.core.AssertionIDRef;
import org.opensaml.saml.saml2.core.AssertionIDRequest;
+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.saml2.core.AssertionIDRequest}.
+ * A concrete implementation of {@link AssertionIDRequest}.
*/
public class AssertionIDRequestImpl extends RequestAbstractTypeImpl implements AssertionIDRequest {
/** List of AssertionIDRef child elements. */
- private final XMLObjectChildrenList<AssertionIDRef> assertionIDRefs;
+ @Nonnull private final XMLObjectChildrenList<AssertionIDRef> assertionIDRefs;
/**
* Constructor.
@@ -45,30 +52,30 @@ public class AssertionIDRequestImpl extends RequestAbstractTypeImpl implements A
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AssertionIDRequestImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AssertionIDRequestImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
assertionIDRefs = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<AssertionIDRef> getAssertionIDRefs() {
+ @Nonnull @Live public List<AssertionIDRef> getAssertionIDRefs() {
return assertionIDRefs;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
- children.addAll(assertionIDRefs);
- if (children.size() == 0) {
- return null;
- }
+ children.addAll(assertionIDRefs);
- 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/saml2/core/impl/AssertionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionImpl.java
index aaef8e5d6..e3f56d81e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionImpl.java
@@ -23,9 +23,10 @@ package org.opensaml.saml.saml2.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;
@@ -42,35 +43,42 @@ import org.opensaml.saml.saml2.core.Conditions;
import org.opensaml.saml.saml2.core.Issuer;
import org.opensaml.saml.saml2.core.Statement;
import org.opensaml.saml.saml2.core.Subject;
+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;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.Assertion}.
+ * A concrete implementation of {@link Assertion}.
*/
+ at SuppressWarnings("unchecked")
public class AssertionImpl extends AbstractSignableSAMLObject implements Assertion {
/** SAML Version of the assertion. */
- private SAMLVersion version;
+ @Nullable private SAMLVersion version;
/** Issue Instant of the assertion. */
- private Instant issueInstant;
+ @Nullable private Instant issueInstant;
/** ID of the assertion. */
- private String id;
+ @Nullable private String id;
/** Issuer of the assertion. */
- private Issuer issuer;
+ @Nullable private Issuer issuer;
/** Subject of the assertion. */
- private Subject subject;
+ @Nullable private Subject subject;
/** Conditions of the assertion. */
- private Conditions conditions;
+ @Nullable private Conditions conditions;
/** Advice of the assertion. */
- private Advice advice;
+ @Nullable private Advice advice;
/** Statements of the assertion. */
- private final IndexedXMLObjectChildrenList<Statement> statements;
+ @Nonnull private final IndexedXMLObjectChildrenList<Statement> statements;
/**
* Constructor.
@@ -79,131 +87,132 @@ 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);
version = SAMLVersion.VERSION_20;
statements = new IndexedXMLObjectChildrenList<>(this);
}
/** {@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 newIssueInstance) {
+ public void setIssueInstant(@Nullable final Instant newIssueInstance) {
issueInstant = prepareForAssignment(issueInstant, newIssueInstance);
}
/** {@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 Issuer getIssuer() {
+ @Nullable public Issuer getIssuer() {
return issuer;
}
/** {@inheritDoc} */
- public void setIssuer(final Issuer newIssuer) {
+ public void setIssuer(@Nullable final Issuer newIssuer) {
issuer = prepareForAssignment(issuer, newIssuer);
}
/** {@inheritDoc} */
- public Subject getSubject() {
+ @Nullable public Subject getSubject() {
return subject;
}
/** {@inheritDoc} */
- public void setSubject(final Subject newSubject) {
+ public void setSubject(@Nullable final Subject newSubject) {
subject = prepareForAssignment(subject, newSubject);
}
/** {@inheritDoc} */
- public Conditions getConditions() {
+ @Nullable public Conditions getConditions() {
return conditions;
}
/** {@inheritDoc} */
- public void setConditions(final Conditions newConditions) {
+ public void setConditions(@Nullable final Conditions newConditions) {
conditions = prepareForAssignment(conditions, newConditions);
}
/** {@inheritDoc} */
- public Advice getAdvice() {
+ @Nullable public Advice getAdvice() {
return advice;
}
/** {@inheritDoc} */
- public void setAdvice(final Advice newAdvice) {
+ public void setAdvice(@Nullable final Advice newAdvice) {
advice = prepareForAssignment(advice, newAdvice);
}
/** {@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<AuthnStatement> getAuthnStatements() {
+ @Nonnull @Live public List<AuthnStatement> getAuthnStatements() {
final QName statementQName = new QName(SAMLConstants.SAML20_NS, AuthnStatement.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20_PREFIX);
return (List<AuthnStatement>) statements.subList(statementQName);
}
/** {@inheritDoc} */
- public List<AuthzDecisionStatement> getAuthzDecisionStatements() {
+ @Nonnull @Live public List<AuthzDecisionStatement> getAuthzDecisionStatements() {
final QName statementQName = new QName(SAMLConstants.SAML20_NS,
- AuthzDecisionStatement.DEFAULT_ELEMENT_LOCAL_NAME,
- SAMLConstants.SAML20_PREFIX);
+ AuthzDecisionStatement.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
return (List<AuthzDecisionStatement>) statements.subList(statementQName);
}
/** {@inheritDoc} */
- public List<AttributeStatement> getAttributeStatements() {
+ @Nonnull @Live public List<AttributeStatement> getAttributeStatements() {
final QName statementQName = new QName(SAMLConstants.SAML20_NS, AttributeStatement.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20_PREFIX);
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<>();
if (issuer != null) {
children.add(issuer);
}
- if (getSignature() != null){
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null){
+ children.add(sig);
}
if (subject != null) {
@@ -220,6 +229,7 @@ public class AssertionImpl extends AbstractSignableSAMLObject implements Asserti
children.addAll(statements);
- 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/saml2/core/impl/AssertionURIRefImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionURIRefImpl.java
index ab1df163d..a6aa5bb43 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionURIRefImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AssertionURIRefImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.core.AssertionURIRef;
@@ -36,8 +39,8 @@ public class AssertionURIRefImpl extends XSURIImpl implements AssertionURIRef {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AssertionURIRefImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AssertionURIRefImpl(@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/saml2/core/impl/AttributeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeImpl.java
index 5f43c3892..3478cad81 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeImpl.java
@@ -17,35 +17,41 @@
package org.opensaml.saml.saml2.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.AttributeMap;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml2.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;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.Attribute}.
+ * Concrete implementation of {@link Attribute}.
*/
public class AttributeImpl extends AbstractXMLObject implements Attribute {
/** Name of the attribute. */
- private String name;
+ @Nullable private String name;
/** Format of the name of the attribute. */
- private String nameFormat;
+ @Nullable private String nameFormat;
/** Human readable name of the attribute. */
- private String friendlyName;
+ @Nullable private String friendlyName;
/** "anyAttribute" attributes. */
- private AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/** List of attribute values for this attribute. */
- private final XMLObjectChildrenList<XMLObject> attributeValues;
+ @Nonnull private final XMLObjectChildrenList<XMLObject> attributeValues;
/**
* Constructor.
@@ -54,60 +60,58 @@ public class AttributeImpl extends AbstractXMLObject 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);
unknownAttributes = new AttributeMap(this);
attributeValues = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getName() {
+ @Nullable public String getName() {
return name;
}
/** {@inheritDoc} */
- public void setName(final String n) {
+ public void setName(@Nullable final String n) {
name = prepareForAssignment(name, n);
}
/** {@inheritDoc} */
- public String getNameFormat() {
+ @Nullable public String getNameFormat() {
return nameFormat;
}
/** {@inheritDoc} */
- public void setNameFormat(final String format) {
+ public void setNameFormat(@Nullable final String format) {
nameFormat = prepareForAssignment(nameFormat, format);
}
/** {@inheritDoc} */
- public String getFriendlyName() {
+ @Nullable public String getFriendlyName() {
return friendlyName;
}
/** {@inheritDoc} */
- public void setFriendlyName(final String fname) {
+ public void setFriendlyName(@Nullable final String fname) {
friendlyName = prepareForAssignment(friendlyName, fname);
}
/**
* {@inheritDoc}
*/
- public AttributeMap getUnknownAttributes() {
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/** {@inheritDoc} */
- public List<XMLObject> getAttributeValues() {
+ @Nonnull @Live public List<XMLObject> getAttributeValues() {
return attributeValues;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<>();
-
- children.addAll(attributeValues);
-
- return Collections.unmodifiableList(children);
+ @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/saml2/core/impl/AttributeQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeQueryImpl.java
index ca812a960..1c4b43b6b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeQueryImpl.java
@@ -22,21 +22,28 @@
package org.opensaml.saml.saml2.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.saml2.core.Attribute;
import org.opensaml.saml.saml2.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 {@link org.opensaml.saml.saml2.core.AttributeQuery}.
+ * Concrete implementation of {@link AttributeQuery}.
*/
public class AttributeQueryImpl extends SubjectQueryImpl implements AttributeQuery {
/** Attribute child elements. */
- private final XMLObjectChildrenList<Attribute> attributes;
+ @Nonnull private final XMLObjectChildrenList<Attribute> attributes;
/**
* Constructor.
@@ -45,30 +52,30 @@ 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);
attributes = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<Attribute> getAttributes() {
+ @Nonnull @Live public List<Attribute> getAttributes() {
return attributes;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
- children.addAll(attributes);
- if (children.size() == 0) {
- return null;
- }
+ children.addAll(attributes);
- 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/saml2/core/impl/AttributeStatementImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeStatementImpl.java
index 34f0dd933..d0247a50a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeStatementImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AttributeStatementImpl.java
@@ -21,10 +21,11 @@
package org.opensaml.saml.saml2.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.IndexedXMLObjectChildrenList;
@@ -32,13 +33,19 @@ import org.opensaml.saml.saml2.core.Attribute;
import org.opensaml.saml.saml2.core.AttributeStatement;
import org.opensaml.saml.saml2.core.EncryptedAttribute;
+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.saml2.core.AttributeStatement}.
+ * A concrete implementation of {@link AttributeStatement}.
*/
+ at SuppressWarnings("unchecked")
public class AttributeStatementImpl extends AbstractXMLObject implements AttributeStatement {
/** Attributes and EncryptedAttributes in this statement. */
- private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
/**
* Constructor.
@@ -47,29 +54,26 @@ public class AttributeStatementImpl extends AbstractXMLObject implements Attribu
* @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);
indexedChildren = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<Attribute> getAttributes() {
+ @Nonnull @Live public List<Attribute> getAttributes() {
return (List<Attribute>) indexedChildren.subList(Attribute.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<EncryptedAttribute> getEncryptedAttributes() {
+ @Nonnull @Live public List<EncryptedAttribute> getEncryptedAttributes() {
return (List<EncryptedAttribute>) indexedChildren.subList(EncryptedAttribute.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<>();
-
- children.addAll(indexedChildren);
-
- return Collections.unmodifiableList(children);
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+ return CollectionSupport.copyToList(indexedChildren);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AudienceRestrictionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AudienceRestrictionImpl.java
index 9f489a553..dbd9fb1ab 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AudienceRestrictionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AudienceRestrictionImpl.java
@@ -21,23 +21,29 @@
package org.opensaml.saml.saml2.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.saml2.core.Audience;
import org.opensaml.saml.saml2.core.AudienceRestriction;
+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.AudienceRestriction}.
+ * Concrete implementation of {@link AudienceRestriction}.
*/
public class AudienceRestrictionImpl extends AbstractXMLObject implements AudienceRestriction {
/** List of the audiences. */
- private final XMLObjectChildrenList<Audience> audience;
+ @Nonnull private final XMLObjectChildrenList<Audience> audiences;
/**
* Constructor.
@@ -46,23 +52,20 @@ public class AudienceRestrictionImpl extends AbstractXMLObject implements Audien
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AudienceRestrictionImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AudienceRestrictionImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
- audience = new XMLObjectChildrenList<>(this);
+ audiences = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<Audience> getAudiences() {
- return audience;
+ @Nonnull @Live public List<Audience> getAudiences() {
+ return audiences;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<>();
-
- children.addAll(audience);
-
- 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/saml2/core/impl/AuthenticatingAuthorityImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthenticatingAuthorityImpl.java
index 5159d9d67..d344f79c9 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthenticatingAuthorityImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthenticatingAuthorityImpl.java
@@ -21,11 +21,14 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.core.AuthenticatingAuthority;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.AuthenticatingAuthority}.
+ * A concrete implementation of {@link AuthenticatingAuthority}.
*/
public class AuthenticatingAuthorityImpl extends XSURIImpl implements AuthenticatingAuthority {
@@ -36,8 +39,8 @@ public class AuthenticatingAuthorityImpl extends XSURIImpl implements Authentica
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthenticatingAuthorityImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthenticatingAuthorityImpl(@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/saml2/core/impl/AuthnContextClassRefImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnContextClassRefImpl.java
index d83a4f37d..4be07b3ab 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnContextClassRefImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnContextClassRefImpl.java
@@ -27,7 +27,6 @@ import javax.annotation.Nullable;
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.core.AuthnContextClassRef;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
/**
* A concrete implementation of {@link AuthnContextClassRef}.
@@ -41,8 +40,8 @@ public class AuthnContextClassRefImpl extends XSURIImpl implements AuthnContextC
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthnContextClassRefImpl(@Nullable final String namespaceURI,
- @Nonnull @NotEmpty final String elementLocalName, @Nullable final String namespacePrefix) {
+ protected AuthnContextClassRefImpl(@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/saml2/core/impl/AuthnContextImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnContextImpl.java
index ee937b2ea..f9be1a8ce 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnContextImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnContextImpl.java
@@ -15,16 +15,14 @@
* limitations under the License.
*/
-/**
- *
- */
-
package org.opensaml.saml.saml2.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;
@@ -34,22 +32,27 @@ import org.opensaml.saml.saml2.core.AuthnContextClassRef;
import org.opensaml.saml.saml2.core.AuthnContextDecl;
import org.opensaml.saml.saml2.core.AuthnContextDeclRef;
+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 implemenation of {@link org.opensaml.saml.saml2.core.AuthnContext}.
+ * A concrete implemenation of {@link AuthnContext}.
*/
public class AuthnContextImpl extends AbstractXMLObject implements AuthnContext {
/** URI of the Context Class. */
- private AuthnContextClassRef authnContextClassRef;
+ @Nullable private AuthnContextClassRef authnContextClassRef;
/** Declaration of the Authentication Context. */
- private AuthnContextDecl authnContextDecl;
+ @Nullable private AuthnContextDecl authnContextDecl;
/** URI of the Declaration of the Authentication Context. */
- private AuthnContextDeclRef authnContextDeclRef;
+ @Nullable private AuthnContextDeclRef authnContextDeclRef;
/** List of the Authenticating Authorities. */
- private final XMLObjectChildrenList<AuthenticatingAuthority> authenticatingAuthority;
+ @Nonnull private final XMLObjectChildrenList<AuthenticatingAuthority> authenticatingAuthority;
/**
* Constructor.
@@ -58,55 +61,66 @@ public class AuthnContextImpl extends AbstractXMLObject implements AuthnContext
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthnContextImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AuthnContextImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
authenticatingAuthority = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public AuthnContextClassRef getAuthnContextClassRef() {
+ @Nullable public AuthnContextClassRef getAuthnContextClassRef() {
return authnContextClassRef;
}
/** {@inheritDoc} */
- public void setAuthnContextClassRef(final AuthnContextClassRef newAuthnContextClassRef) {
- this.authnContextClassRef = prepareForAssignment(this.authnContextClassRef, newAuthnContextClassRef);
+ public void setAuthnContextClassRef(@Nullable final AuthnContextClassRef newAuthnContextClassRef) {
+ authnContextClassRef = prepareForAssignment(authnContextClassRef, newAuthnContextClassRef);
}
/** {@inheritDoc} */
- public AuthnContextDecl getAuthContextDecl() {
+ @Nullable public AuthnContextDecl getAuthContextDecl() {
return authnContextDecl;
}
/** {@inheritDoc} */
- public void setAuthnContextDecl(final AuthnContextDecl newAuthnContextDecl) {
- this.authnContextDecl = prepareForAssignment(this.authnContextDecl, newAuthnContextDecl);
+ public void setAuthnContextDecl(@Nullable final AuthnContextDecl newAuthnContextDecl) {
+ authnContextDecl = prepareForAssignment(authnContextDecl, newAuthnContextDecl);
}
/** {@inheritDoc} */
- public AuthnContextDeclRef getAuthnContextDeclRef() {
+ @Nullable public AuthnContextDeclRef getAuthnContextDeclRef() {
return authnContextDeclRef;
}
/** {@inheritDoc} */
- public void setAuthnContextDeclRef(final AuthnContextDeclRef newAuthnContextDeclRef) {
- this.authnContextDeclRef = prepareForAssignment(this.authnContextDeclRef, newAuthnContextDeclRef);
+ public void setAuthnContextDeclRef(@Nullable final AuthnContextDeclRef newAuthnContextDeclRef) {
+ authnContextDeclRef = prepareForAssignment(authnContextDeclRef, newAuthnContextDeclRef);
}
/** {@inheritDoc} */
- public List<AuthenticatingAuthority> getAuthenticatingAuthorities() {
+ @Nonnull @Live public List<AuthenticatingAuthority> getAuthenticatingAuthorities() {
return authenticatingAuthority;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- children.add(authnContextClassRef);
- children.add(authnContextDecl);
- children.add(authnContextDeclRef);
+ if (authnContextClassRef != null) {
+ children.add(authnContextClassRef);
+ }
+
+ if (authnContextDecl != null) {
+ children.add(authnContextDecl);
+ }
+
+ if (authnContextDeclRef != null) {
+ children.add(authnContextDeclRef);
+ }
+
children.addAll(authenticatingAuthority);
- 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/saml2/core/impl/AuthnQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnQueryImpl.java
index 964058b85..77ce3f18a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnQueryImpl.java
@@ -22,23 +22,29 @@
package org.opensaml.saml.saml2.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.saml2.core.AuthnQuery;
import org.opensaml.saml.saml2.core.RequestedAuthnContext;
+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.AuthnQuery}.
+ * Concrete implementation of {@link AuthnQuery}.
*/
public class AuthnQueryImpl extends SubjectQueryImpl implements AuthnQuery {
/** SessionIndex attribute. */
- private String sessionIndex;
+ @Nullable private String sessionIndex;
/** RequestedAuthnContext child element. */
- private RequestedAuthnContext requestedAuthnContext;
+ @Nullable private RequestedAuthnContext requestedAuthnContext;
/**
* Constructor.
@@ -47,46 +53,46 @@ public class AuthnQueryImpl extends SubjectQueryImpl implements AuthnQuery {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthnQueryImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AuthnQueryImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getSessionIndex() {
- return this.sessionIndex;
+ @Nullable public String getSessionIndex() {
+ return sessionIndex;
}
/** {@inheritDoc} */
- public void setSessionIndex(final String newSessionIndex) {
- this.sessionIndex = prepareForAssignment(this.sessionIndex, newSessionIndex);
+ public void setSessionIndex(@Nullable final String newSessionIndex) {
+ sessionIndex = prepareForAssignment(sessionIndex, newSessionIndex);
}
/** {@inheritDoc} */
- public RequestedAuthnContext getRequestedAuthnContext() {
- return this.requestedAuthnContext;
+ @Nullable public RequestedAuthnContext getRequestedAuthnContext() {
+ return requestedAuthnContext;
}
/** {@inheritDoc} */
- public void setRequestedAuthnContext(final RequestedAuthnContext newRequestedAuthnContext) {
- this.requestedAuthnContext = prepareForAssignment(this.requestedAuthnContext, newRequestedAuthnContext);
+ public void setRequestedAuthnContext(@Nullable final RequestedAuthnContext newRequestedAuthnContext) {
+ requestedAuthnContext = prepareForAssignment(requestedAuthnContext, newRequestedAuthnContext);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
if (requestedAuthnContext != null) {
children.add(requestedAuthnContext);
}
- 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/saml2/core/impl/AuthnRequestImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnRequestImpl.java
index 8c55f9743..52b46a489 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnRequestImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnRequestImpl.java
@@ -22,9 +22,11 @@
package org.opensaml.saml.saml2.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.schema.XSBooleanValue;
import org.opensaml.saml.saml2.core.AuthnRequest;
@@ -34,46 +36,50 @@ import org.opensaml.saml.saml2.core.RequestedAuthnContext;
import org.opensaml.saml.saml2.core.Scoping;
import org.opensaml.saml.saml2.core.Subject;
+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.saml2.core.AuthnRequest}.
+ * A concrete implementation of {@link AuthnRequest}.
*/
public class AuthnRequestImpl extends RequestAbstractTypeImpl implements AuthnRequest {
/** Subject child element. */
- private Subject subject;
+ @Nullable private Subject subject;
/** NameIDPolicy child element. */
- private NameIDPolicy nameIDPolicy;
+ @Nullable private NameIDPolicy nameIDPolicy;
/** Conditions child element. */
- private Conditions conditions;
+ @Nullable private Conditions conditions;
/** RequestedAuthnContext child element. */
- private RequestedAuthnContext requestedAuthnContext;
+ @Nullable private RequestedAuthnContext requestedAuthnContext;
/** Scoping child element. */
- private Scoping scoping;
+ @Nullable private Scoping scoping;
/** ForeceAuthn attribute. */
- private XSBooleanValue forceAuthn;
+ @Nullable private XSBooleanValue forceAuthn;
/** IsPassive attribute. */
- private XSBooleanValue isPassive;
+ @Nullable private XSBooleanValue isPassive;
/** ProtocolBinding attribute. */
- private String protocolBinding;
+ @Nullable private String protocolBinding;
/** AssertionConsumerServiceIndex attribute. */
- private Integer assertionConsumerServiceIndex;
+ @Nullable private Integer assertionConsumerServiceIndex;
/** AssertionConsumerServiceURL attribute. */
- private String assertionConsumerServiceURL;
+ @Nullable private String assertionConsumerServiceURL;
/** AttributeConsumingServiceIndex attribute. */
- private Integer attributeConsumingServiceIndex;
+ @Nullable private Integer attributeConsumingServiceIndex;
/** ProviderName attribute. */
- private String providerName;
+ @Nullable private String providerName;
/**
* Constructor.
@@ -82,12 +88,13 @@ public class AuthnRequestImpl extends RequestAbstractTypeImpl implements AuthnRe
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthnRequestImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AuthnRequestImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public Boolean isForceAuthn() {
+ @Nullable public Boolean isForceAuthn() {
if (forceAuthn != null) {
return forceAuthn.getValue();
}
@@ -96,12 +103,12 @@ public class AuthnRequestImpl extends RequestAbstractTypeImpl implements AuthnRe
}
/** {@inheritDoc} */
- public XSBooleanValue isForceAuthnXSBoolean() {
+ @Nullable public XSBooleanValue isForceAuthnXSBoolean() {
return forceAuthn;
}
/** {@inheritDoc} */
- public void setForceAuthn(final Boolean newForceAuth) {
+ public void setForceAuthn(@Nullable final Boolean newForceAuth) {
if (newForceAuth != null) {
forceAuthn = prepareForAssignment(forceAuthn, new XSBooleanValue(newForceAuth, false));
} else {
@@ -110,12 +117,12 @@ public class AuthnRequestImpl extends RequestAbstractTypeImpl implements AuthnRe
}
/** {@inheritDoc} */
- public void setForceAuthn(final XSBooleanValue newForceAuthn) {
- forceAuthn = prepareForAssignment(this.forceAuthn, newForceAuthn);
+ public void setForceAuthn(@Nullable final XSBooleanValue newForceAuthn) {
+ forceAuthn = prepareForAssignment(forceAuthn, newForceAuthn);
}
/** {@inheritDoc} */
- public Boolean isPassive() {
+ @Nullable public Boolean isPassive() {
if (isPassive != null) {
return isPassive.getValue();
}
@@ -124,12 +131,12 @@ public class AuthnRequestImpl extends RequestAbstractTypeImpl implements AuthnRe
}
/** {@inheritDoc} */
- public XSBooleanValue isPassiveXSBoolean() {
+ @Nullable public XSBooleanValue isPassiveXSBoolean() {
return isPassive;
}
/** {@inheritDoc} */
- public void setIsPassive(final Boolean newIsPassive) {
+ public void setIsPassive(@Nullable final Boolean newIsPassive) {
if (newIsPassive != null) {
isPassive = prepareForAssignment(isPassive, new XSBooleanValue(newIsPassive, false));
} else {
@@ -138,119 +145,121 @@ public class AuthnRequestImpl extends RequestAbstractTypeImpl implements AuthnRe
}
/** {@inheritDoc} */
- public void setIsPassive(final XSBooleanValue newIsPassive) {
- this.isPassive = prepareForAssignment(this.isPassive, newIsPassive);
+ public void setIsPassive(@Nullable final XSBooleanValue newIsPassive) {
+ isPassive = prepareForAssignment(isPassive, newIsPassive);
}
/** {@inheritDoc} */
- public String getProtocolBinding() {
- return this.protocolBinding;
+ @Nullable public String getProtocolBinding() {
+ return protocolBinding;
}
/** {@inheritDoc} */
- public void setProtocolBinding(final String newProtocolBinding) {
- this.protocolBinding = prepareForAssignment(this.protocolBinding, newProtocolBinding);
+ public void setProtocolBinding(@Nullable final String newProtocolBinding) {
+ protocolBinding = prepareForAssignment(protocolBinding, newProtocolBinding);
}
/** {@inheritDoc} */
- public Integer getAssertionConsumerServiceIndex() {
+ @Nullable public Integer getAssertionConsumerServiceIndex() {
return assertionConsumerServiceIndex;
}
/** {@inheritDoc} */
- public void setAssertionConsumerServiceIndex(final Integer newAssertionConsumerServiceIndex) {
- this.assertionConsumerServiceIndex = prepareForAssignment(this.assertionConsumerServiceIndex,
+ public void setAssertionConsumerServiceIndex(@Nullable final Integer newAssertionConsumerServiceIndex) {
+ assertionConsumerServiceIndex = prepareForAssignment(assertionConsumerServiceIndex,
newAssertionConsumerServiceIndex);
}
/** {@inheritDoc} */
- public String getAssertionConsumerServiceURL() {
- return this.assertionConsumerServiceURL;
+ @Nullable public String getAssertionConsumerServiceURL() {
+ return assertionConsumerServiceURL;
}
/** {@inheritDoc} */
- public void setAssertionConsumerServiceURL(final String newAssertionConsumerServiceURL) {
- this.assertionConsumerServiceURL = prepareForAssignment(this.assertionConsumerServiceURL,
+ public void setAssertionConsumerServiceURL(@Nullable final String newAssertionConsumerServiceURL) {
+ assertionConsumerServiceURL = prepareForAssignment(assertionConsumerServiceURL,
newAssertionConsumerServiceURL);
}
/** {@inheritDoc} */
- public Integer getAttributeConsumingServiceIndex() {
- return this.attributeConsumingServiceIndex;
+ @Nullable public Integer getAttributeConsumingServiceIndex() {
+ return attributeConsumingServiceIndex;
}
/** {@inheritDoc} */
- public void setAttributeConsumingServiceIndex(final Integer newAttributeConsumingServiceIndex) {
- this.attributeConsumingServiceIndex = prepareForAssignment(this.attributeConsumingServiceIndex,
+ public void setAttributeConsumingServiceIndex(@Nullable final Integer newAttributeConsumingServiceIndex) {
+ attributeConsumingServiceIndex = prepareForAssignment(attributeConsumingServiceIndex,
newAttributeConsumingServiceIndex);
}
/** {@inheritDoc} */
- public String getProviderName() {
- return this.providerName;
+ @Nullable public String getProviderName() {
+ return providerName;
}
/** {@inheritDoc} */
- public void setProviderName(final String newProviderName) {
- this.providerName = prepareForAssignment(this.providerName, newProviderName);
+ public void setProviderName(@Nullable final String newProviderName) {
+ providerName = prepareForAssignment(providerName, newProviderName);
}
/** {@inheritDoc} */
- public Subject getSubject() {
- return this.subject;
+ @Nullable public Subject getSubject() {
+ return subject;
}
/** {@inheritDoc} */
- public void setSubject(final Subject newSubject) {
- this.subject = prepareForAssignment(this.subject, newSubject);
+ public void setSubject(@Nullable final Subject newSubject) {
+ subject = prepareForAssignment(subject, newSubject);
}
/** {@inheritDoc} */
- public NameIDPolicy getNameIDPolicy() {
- return this.nameIDPolicy;
+ @Nullable public NameIDPolicy getNameIDPolicy() {
+ return nameIDPolicy;
}
/** {@inheritDoc} */
- public void setNameIDPolicy(final NameIDPolicy newNameIDPolicy) {
- this.nameIDPolicy = prepareForAssignment(this.nameIDPolicy, newNameIDPolicy);
+ public void setNameIDPolicy(@Nullable final NameIDPolicy newNameIDPolicy) {
+ nameIDPolicy = prepareForAssignment(nameIDPolicy, newNameIDPolicy);
}
/** {@inheritDoc} */
- public Conditions getConditions() {
- return this.conditions;
+ @Nullable public Conditions getConditions() {
+ return conditions;
}
/** {@inheritDoc} */
- public void setConditions(final Conditions newConditions) {
- this.conditions = prepareForAssignment(this.conditions, newConditions);
+ public void setConditions(@Nullable final Conditions newConditions) {
+ conditions = prepareForAssignment(conditions, newConditions);
}
/** {@inheritDoc} */
- public RequestedAuthnContext getRequestedAuthnContext() {
- return this.requestedAuthnContext;
+ @Nullable public RequestedAuthnContext getRequestedAuthnContext() {
+ return requestedAuthnContext;
}
/** {@inheritDoc} */
- public void setRequestedAuthnContext(final RequestedAuthnContext newRequestedAuthnContext) {
- this.requestedAuthnContext = prepareForAssignment(this.requestedAuthnContext, newRequestedAuthnContext);
+ public void setRequestedAuthnContext(@Nullable final RequestedAuthnContext newRequestedAuthnContext) {
+ requestedAuthnContext = prepareForAssignment(requestedAuthnContext, newRequestedAuthnContext);
}
/** {@inheritDoc} */
- public Scoping getScoping() {
- return this.scoping;
+ @Nullable public Scoping getScoping() {
+ return scoping;
}
/** {@inheritDoc} */
- public void setScoping(final Scoping newScoping) {
- this.scoping = prepareForAssignment(this.scoping, newScoping);
+ public void setScoping(@Nullable final Scoping newScoping) {
+ scoping = prepareForAssignment(scoping, newScoping);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
if (subject != null) {
@@ -273,10 +282,7 @@ public class AuthnRequestImpl extends RequestAbstractTypeImpl implements AuthnRe
children.add(scoping);
}
- 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/saml2/core/impl/AuthnStatementImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnStatementImpl.java
index d31499089..c0e0e6671 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnStatementImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthnStatementImpl.java
@@ -23,34 +23,40 @@ package org.opensaml.saml.saml2.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.AbstractXMLObject;
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml2.core.AuthnContext;
import org.opensaml.saml.saml2.core.AuthnStatement;
import org.opensaml.saml.saml2.core.SubjectLocality;
+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.saml2.core.AuthnStatement}.
+ * A concrete implementation of {@link AuthnStatement}.
*/
public class AuthnStatementImpl extends AbstractXMLObject implements AuthnStatement {
/** Subject Locality of the Authentication Statement. */
- private SubjectLocality subjectLocality;
+ @Nullable private SubjectLocality subjectLocality;
/** Authentication Context of the Authentication Statement. */
- private AuthnContext authnContext;
+ @Nullable private AuthnContext authnContext;
/** Time of the authentication. */
- private Instant authnInstant;
+ @Nullable private Instant authnInstant;
/** Index of the session. */
- private String sessionIndex;
+ @Nullable private String sessionIndex;
/** Time at which the session ends. */
- private Instant sessionNotOnOrAfter;
+ @Nullable private Instant sessionNotOnOrAfter;
/**
* Constructor.
@@ -59,68 +65,74 @@ public class AuthnStatementImpl extends AbstractXMLObject implements AuthnStatem
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthnStatementImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthnStatementImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public SubjectLocality getSubjectLocality() {
+ @Nullable public SubjectLocality getSubjectLocality() {
return subjectLocality;
}
/** {@inheritDoc} */
- public void setSubjectLocality(final SubjectLocality newSubjectLocality) {
- this.subjectLocality = prepareForAssignment(this.subjectLocality, newSubjectLocality);
+ public void setSubjectLocality(@Nullable final SubjectLocality newSubjectLocality) {
+ subjectLocality = prepareForAssignment(subjectLocality, newSubjectLocality);
}
/** {@inheritDoc} */
- public AuthnContext getAuthnContext() {
+ @Nullable public AuthnContext getAuthnContext() {
return authnContext;
}
/** {@inheritDoc} */
- public void setAuthnContext(final AuthnContext newAuthnContext) {
- this.authnContext = prepareForAssignment(this.authnContext, newAuthnContext);
+ public void setAuthnContext(@Nullable final AuthnContext newAuthnContext) {
+ authnContext = prepareForAssignment(authnContext, newAuthnContext);
}
/** {@inheritDoc} */
- public Instant getAuthnInstant() {
+ @Nullable public Instant getAuthnInstant() {
return authnInstant;
}
/** {@inheritDoc} */
- public void setAuthnInstant(final Instant newAuthnInstant) {
- this.authnInstant = prepareForAssignment(this.authnInstant, newAuthnInstant);
+ public void setAuthnInstant(@Nullable final Instant newAuthnInstant) {
+ authnInstant = prepareForAssignment(authnInstant, newAuthnInstant);
}
/** {@inheritDoc} */
- public String getSessionIndex() {
+ @Nullable public String getSessionIndex() {
return sessionIndex;
}
/** {@inheritDoc} */
- public void setSessionIndex(final String newSessionIndex) {
- this.sessionIndex = prepareForAssignment(this.sessionIndex, newSessionIndex);
+ public void setSessionIndex(@Nullable final String newSessionIndex) {
+ sessionIndex = prepareForAssignment(sessionIndex, newSessionIndex);
}
/** {@inheritDoc} */
- public Instant getSessionNotOnOrAfter() {
+ @Nullable public Instant getSessionNotOnOrAfter() {
return sessionNotOnOrAfter;
}
/** {@inheritDoc} */
- public void setSessionNotOnOrAfter(final Instant newSessionNotOnOrAfter) {
- this.sessionNotOnOrAfter = prepareForAssignment(this.sessionNotOnOrAfter, newSessionNotOnOrAfter);
+ public void setSessionNotOnOrAfter(@Nullable final Instant newSessionNotOnOrAfter) {
+ sessionNotOnOrAfter = prepareForAssignment(sessionNotOnOrAfter, newSessionNotOnOrAfter);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- children.add(subjectLocality);
- children.add(authnContext);
-
- return Collections.unmodifiableList(children);
+ if (subjectLocality != null) {
+ children.add(subjectLocality);
+ }
+
+ if (authnContext != null) {
+ children.add(authnContext);
+ }
+
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthzDecisionQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthzDecisionQueryImpl.java
index cd6dd88ac..bc89ce90c 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthzDecisionQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthzDecisionQueryImpl.java
@@ -22,28 +22,35 @@
package org.opensaml.saml.saml2.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.saml2.core.Action;
import org.opensaml.saml.saml2.core.AuthzDecisionQuery;
import org.opensaml.saml.saml2.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 {@link org.opensaml.saml.saml2.core.AuthzDecisionQuery}.
+ * Concrete implementation of {@link AuthzDecisionQuery}.
*/
public class AuthzDecisionQueryImpl extends SubjectQueryImpl implements AuthzDecisionQuery {
/** Resource attribute value. */
- private String resource;
+ @Nullable private String resource;
/** Evidence child element. */
- private Evidence evidence;
+ @Nullable private Evidence evidence;
/** Action child elements. */
- private final XMLObjectChildrenList<Action> actions;
+ @Nonnull private final XMLObjectChildrenList<Action> actions;
/**
* Constructor.
@@ -52,53 +59,54 @@ public class AuthzDecisionQueryImpl extends SubjectQueryImpl implements AuthzDec
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthzDecisionQueryImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthzDecisionQueryImpl(@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 this.resource;
}
/** {@inheritDoc} */
- public void setResource(final String newResource) {
+ public void setResource(@Nullable final String newResource) {
this.resource = prepareForAssignment(this.resource, newResource);
}
/** {@inheritDoc} */
- public List<Action> getActions() {
+ @Nonnull @Live public List<Action> getActions() {
return actions;
}
/** {@inheritDoc} */
- public Evidence getEvidence() {
+ @Nullable public Evidence getEvidence() {
return this.evidence;
}
/** {@inheritDoc} */
- public void setEvidence(final Evidence newEvidence) {
+ public void setEvidence(@Nullable final Evidence newEvidence) {
this.evidence = prepareForAssignment(this.evidence, newEvidence);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
+
children.addAll(actions);
+
if (evidence != null) {
children.add(evidence);
}
- 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/saml2/core/impl/AuthzDecisionStatementImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthzDecisionStatementImpl.java
index 5d1a466a1..5e60ed9a9 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthzDecisionStatementImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/AuthzDecisionStatementImpl.java
@@ -22,9 +22,11 @@
package org.opensaml.saml.saml2.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;
@@ -33,22 +35,27 @@ import org.opensaml.saml.saml2.core.AuthzDecisionStatement;
import org.opensaml.saml.saml2.core.DecisionTypeEnumeration;
import org.opensaml.saml.saml2.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.saml2.core.AuthzDecisionStatement}.
+ * A concrete implementation of {@link AuthzDecisionStatement}.
*/
public class AuthzDecisionStatementImpl extends AbstractXMLObject implements AuthzDecisionStatement {
/** URI of the resource to which authorization is sought. */
- private String resource;
+ @Nullable private String resource;
/** Decision of the authorization request. */
- private DecisionTypeEnumeration decision;
+ @Nullable private DecisionTypeEnumeration decision;
/** Actions authorized to be performed. */
- private final XMLObjectChildrenList<Action> actions;
+ @Nonnull private final XMLObjectChildrenList<Action> actions;
/** SAML assertion the authority relied on when making the authorization decision. */
- private Evidence evidence;
+ @Nullable private Evidence evidence;
/**
* Constructor.
@@ -57,53 +64,58 @@ public class AuthzDecisionStatementImpl extends AbstractXMLObject implements Aut
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthzDecisionStatementImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthzDecisionStatementImpl(@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 newResourceURI) {
- this.resource = prepareForAssignment(this.resource, newResourceURI, false);
+ public void setResource(@Nullable final String newResourceURI) {
+ resource = prepareForAssignment(resource, newResourceURI, false);
}
/** {@inheritDoc} */
- public DecisionTypeEnumeration getDecision() {
+ @Nullable public DecisionTypeEnumeration getDecision() {
return decision;
}
/** {@inheritDoc} */
- public void setDecision(final DecisionTypeEnumeration newDecision) {
- this.decision = prepareForAssignment(this.decision, newDecision);
+ public void setDecision(@Nullable final DecisionTypeEnumeration newDecision) {
+ decision = prepareForAssignment(decision, newDecision);
}
/** {@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 newEvidence) {
- this.evidence = prepareForAssignment(this.evidence, newEvidence);
+ public void setEvidence(@Nullable final Evidence newEvidence) {
+ evidence = prepareForAssignment(evidence, newEvidence);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
children.addAll(actions);
- children.add(evidence);
- return Collections.unmodifiableList(children);
+
+ if (evidence != null) {
+ children.add(evidence);
+ }
+
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/BaseIDImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/BaseIDImpl.java
index da0090242..f0a69ca2d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/BaseIDImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/BaseIDImpl.java
@@ -19,20 +19,26 @@ package org.opensaml.saml.saml2.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.saml2.core.BaseID;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.BaseID}.
+ * Concrete implementation of {@link BaseID}.
*/
public abstract class BaseIDImpl extends AbstractXMLObject implements BaseID {
/** Name Qualifier of BaseID. */
- private String nameQualifier;
+ @Nullable private String nameQualifier;
/** SP Name Qualifier of Base. */
- private String spNameQualfier;
+ @Nullable private String spNameQualfier;
/**
* Constructor.
@@ -41,32 +47,34 @@ public abstract class BaseIDImpl extends AbstractXMLObject implements BaseID {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected BaseIDImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected BaseIDImpl(@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 void setNameQualifier(final String newNameQualifier) {
- this.nameQualifier = prepareForAssignment(this.nameQualifier, newNameQualifier);
+ public void setNameQualifier(@Nullable final String newNameQualifier) {
+ nameQualifier = prepareForAssignment(nameQualifier, newNameQualifier);
}
/** {@inheritDoc} */
- public String getSPNameQualifier() {
+ @Nullable public String getSPNameQualifier() {
return spNameQualfier;
}
/** {@inheritDoc} */
- public void setSPNameQualifier(final String newSPNameQualifier) {
- this.spNameQualfier = prepareForAssignment(this.spNameQualfier, newSPNameQualifier);
+ public void setSPNameQualifier(@Nullable final String newSPNameQualifier) {
+ spNameQualfier = prepareForAssignment(spNameQualfier, newSPNameQualifier);
}
/** {@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/saml2/core/impl/ConditionsImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ConditionsImpl.java
index fedc0afb0..1ae7d0e3b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ConditionsImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ConditionsImpl.java
@@ -22,10 +22,10 @@
package org.opensaml.saml.saml2.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;
@@ -38,19 +38,25 @@ import org.opensaml.saml.saml2.core.Conditions;
import org.opensaml.saml.saml2.core.OneTimeUse;
import org.opensaml.saml.saml2.core.ProxyRestriction;
+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.Conditions}.
+ * Concrete implementation of {@link Conditions}.
*/
+ at SuppressWarnings("unchecked")
public class ConditionsImpl extends AbstractXMLObject implements Conditions {
/** A Condition. */
- private final IndexedXMLObjectChildrenList<Condition> conditions;
+ @Nonnull private final IndexedXMLObjectChildrenList<Condition> conditions;
/** Not Before conditions. */
- private Instant notBefore;
+ @Nullable private Instant notBefore;
/** Not On Or After conditions. */
- private Instant notOnOrAfter;
+ @Nullable private Instant notOnOrAfter;
/**
* Constructor.
@@ -59,30 +65,31 @@ 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 List<Condition> getConditions() {
+ @Nonnull @Live public List<Condition> getConditions() {
return conditions;
}
/** {@inheritDoc} */
- public List<Condition> getConditions(QName typeOrName) {
+ @Nonnull @Live public List<Condition> getConditions(@Nonnull final QName typeOrName) {
return (List<Condition>) conditions.subList(typeOrName);
}
/** {@inheritDoc} */
- public List<AudienceRestriction> getAudienceRestrictions() {
+ @Nonnull @Live public List<AudienceRestriction> getAudienceRestrictions() {
final QName conditionQName = new QName(SAMLConstants.SAML20_NS, AudienceRestriction.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20_PREFIX);
return (List<AudienceRestriction>) conditions.subList(conditionQName);
}
/** {@inheritDoc} */
- public OneTimeUse getOneTimeUse() {
+ @Nullable public OneTimeUse getOneTimeUse() {
final QName conditionQName = new QName(SAMLConstants.SAML20_NS, OneTimeUse.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20_PREFIX);
final List<OneTimeUse> list = (List<OneTimeUse>) conditions.subList(conditionQName);
@@ -94,7 +101,7 @@ public class ConditionsImpl extends AbstractXMLObject implements Conditions {
}
/** {@inheritDoc} */
- public ProxyRestriction getProxyRestriction() {
+ @Nullable public ProxyRestriction getProxyRestriction() {
final QName conditionQName = new QName(SAMLConstants.SAML20_NS, ProxyRestriction.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20_PREFIX);
final List<ProxyRestriction> list = (List<ProxyRestriction>) conditions.subList(conditionQName);
@@ -106,32 +113,28 @@ public class ConditionsImpl extends AbstractXMLObject implements Conditions {
}
/** {@inheritDoc} */
- public Instant getNotBefore() {
+ @Nullable public Instant getNotBefore() {
return notBefore;
}
/** {@inheritDoc} */
- public void setNotBefore(final Instant newNotBefore) {
+ public void setNotBefore(@Nullable final Instant newNotBefore) {
this.notBefore = prepareForAssignment(this.notBefore, newNotBefore);
}
/** {@inheritDoc} */
- public Instant getNotOnOrAfter() {
+ @Nullable public Instant getNotOnOrAfter() {
return notOnOrAfter;
}
/** {@inheritDoc} */
- public void setNotOnOrAfter(final Instant newNotOnOrAfter) {
+ public void setNotOnOrAfter(@Nullable final Instant newNotOnOrAfter) {
this.notOnOrAfter = prepareForAssignment(this.notOnOrAfter, newNotOnOrAfter);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- 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/saml2/core/impl/EncryptedAssertionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedAssertionImpl.java
index 391d0ffb1..f455e7a82 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedAssertionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedAssertionImpl.java
@@ -17,10 +17,13 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.EncryptedAssertion;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.EncryptedAssertion}.
+ * A concrete implementation of {@link EncryptedAssertion}.
*/
public class EncryptedAssertionImpl extends EncryptedElementTypeImpl implements EncryptedAssertion {
@@ -31,9 +34,9 @@ public class EncryptedAssertionImpl extends EncryptedElementTypeImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EncryptedAssertionImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected EncryptedAssertionImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
-}
+}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedAttributeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedAttributeImpl.java
index 881b6441c..dd9d40020 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedAttributeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedAttributeImpl.java
@@ -17,10 +17,13 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.EncryptedAttribute;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.EncryptedAttribute}.
+ * A concrete implementation of {@link EncryptedAttribute}.
*/
public class EncryptedAttributeImpl extends EncryptedElementTypeImpl implements EncryptedAttribute {
@@ -31,9 +34,9 @@ public class EncryptedAttributeImpl extends EncryptedElementTypeImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EncryptedAttributeImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected EncryptedAttributeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
-}
+}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedElementTypeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedElementTypeImpl.java
index f254bf966..c1687b8e4 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedElementTypeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedElementTypeImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml2.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,16 +30,21 @@ import org.opensaml.saml.saml2.core.EncryptedElementType;
import org.opensaml.xmlsec.encryption.EncryptedData;
import org.opensaml.xmlsec.encryption.EncryptedKey;
+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.saml2.core.EncryptedElementType}.
+ * A concrete implementation of {@link EncryptedElementType}.
*/
public class EncryptedElementTypeImpl extends AbstractXMLObject implements EncryptedElementType {
/** EncryptedData child element. */
- private EncryptedData encryptedData;
+ @Nullable private EncryptedData encryptedData;
/** EncryptedKey children. */
- private final XMLObjectChildrenList<EncryptedKey> encryptedKeys;
+ @Nonnull private final XMLObjectChildrenList<EncryptedKey> encryptedKeys;
/**
* Constructor.
@@ -46,29 +53,29 @@ public class EncryptedElementTypeImpl extends AbstractXMLObject implements Encry
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EncryptedElementTypeImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected EncryptedElementTypeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
encryptedKeys = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public EncryptedData getEncryptedData() {
- return this.encryptedData;
+ @Nullable public EncryptedData getEncryptedData() {
+ return encryptedData;
}
/** {@inheritDoc} */
- public void setEncryptedData(final EncryptedData newEncryptedData) {
- this.encryptedData = prepareForAssignment(this.encryptedData, newEncryptedData);
+ public void setEncryptedData(@Nullable final EncryptedData newEncryptedData) {
+ encryptedData = prepareForAssignment(encryptedData, newEncryptedData);
}
/** {@inheritDoc} */
- public List<EncryptedKey> getEncryptedKeys() {
- return this.encryptedKeys;
+ @Nonnull @Live public List<EncryptedKey> getEncryptedKeys() {
+ return encryptedKeys;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
if (encryptedData != null) {
@@ -77,11 +84,7 @@ public class EncryptedElementTypeImpl extends AbstractXMLObject implements Encry
children.addAll(encryptedKeys);
- 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/saml2/core/impl/EncryptedIDImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedIDImpl.java
index 1b5bd9c74..24378c850 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedIDImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EncryptedIDImpl.java
@@ -17,10 +17,13 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.EncryptedID;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.EncryptedID}.
+ * A concrete implementation of {@link EncryptedID}.
*/
public class EncryptedIDImpl extends EncryptedElementTypeImpl implements EncryptedID {
@@ -31,8 +34,9 @@ public class EncryptedIDImpl extends EncryptedElementTypeImpl implements Encrypt
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EncryptedIDImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected EncryptedIDImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
-}
+}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EvidenceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EvidenceImpl.java
index e296575e6..52daf612e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EvidenceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/EvidenceImpl.java
@@ -21,10 +21,11 @@
package org.opensaml.saml.saml2.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.IndexedXMLObjectChildrenList;
@@ -35,13 +36,19 @@ import org.opensaml.saml.saml2.core.EncryptedAssertion;
import org.opensaml.saml.saml2.core.Evidence;
import org.opensaml.saml.saml2.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;
+
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.Evidence}.
+ * A concrete implementation of {@link Evidence}.
*/
+ at SuppressWarnings("unchecked")
public class EvidenceImpl extends AbstractXMLObject implements Evidence {
/** Assertion of the Evidence. */
- private final IndexedXMLObjectChildrenList<Evidentiary> evidence;
+ @Nonnull private final IndexedXMLObjectChildrenList<Evidentiary> evidence;
/**
* Constructor.
@@ -50,46 +57,40 @@ 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<Evidentiary> getEvidence() {
+ @Nonnull @Live public List<Evidentiary> getEvidence() {
return evidence;
}
/** {@inheritDoc} */
- public List<AssertionIDRef> getAssertionIDReferences() {
+ @Nonnull @Live public List<AssertionIDRef> getAssertionIDReferences() {
return (List<AssertionIDRef>) evidence.subList(AssertionIDRef.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<AssertionURIRef> getAssertionURIReferences() {
+ @Nonnull @Live public List<AssertionURIRef> getAssertionURIReferences() {
return (List<AssertionURIRef>) evidence.subList(AssertionURIRef.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<Assertion> getAssertions() {
+ @Nonnull @Live public List<Assertion> getAssertions() {
return (List<Assertion>) evidence.subList(Assertion.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<EncryptedAssertion> getEncryptedAssertions() {
+ @Nonnull @Live public List<EncryptedAssertion> getEncryptedAssertions() {
return (List<EncryptedAssertion>) evidence.subList(EncryptedAssertion.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<>();
-
- if (evidence.size() == 0) {
- return null;
- }
-
- children.addAll(evidence);
-
- return Collections.unmodifiableList(children);
+ @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/saml2/core/impl/ExtensionsImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ExtensionsImpl.java
index e5e11c039..8cdf6185c 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ExtensionsImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ExtensionsImpl.java
@@ -17,10 +17,10 @@
package org.opensaml.saml.saml2.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;
@@ -28,13 +28,18 @@ import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.IndexedXMLObjectChildrenList;
import org.opensaml.saml.saml2.core.Extensions;
+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.saml2.core.Extensions}.
+ * Implementation of {@link Extensions}.
*/
public class ExtensionsImpl extends AbstractXMLObject implements Extensions {
/** "any" children. */
- private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
/**
* Constructor.
@@ -43,7 +48,8 @@ public class ExtensionsImpl extends AbstractXMLObject implements Extensions {
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected ExtensionsImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ExtensionsImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownChildren = new IndexedXMLObjectChildrenList<>(this);
}
@@ -51,17 +57,19 @@ public class ExtensionsImpl extends AbstractXMLObject implements Extensions {
/**
* {@inheritDoc}
*/
- public List<XMLObject> getUnknownXMLObjects() {
+ @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);
+ @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/saml2/core/impl/GetCompleteImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/GetCompleteImpl.java
index d1d361541..ca73adfad 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/GetCompleteImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/GetCompleteImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.core.GetComplete;
@@ -36,7 +39,8 @@ public class GetCompleteImpl extends XSURIImpl implements GetComplete {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected GetCompleteImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected GetCompleteImpl(@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/saml2/core/impl/IDPEntryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IDPEntryImpl.java
index 40dedaa76..3e1dc066c 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IDPEntryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IDPEntryImpl.java
@@ -23,26 +23,32 @@ package org.opensaml.saml.saml2.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.saml2.core.IDPEntry;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.IDPEntry}.
+ * Concrete implementation of {@link IDPEntry}.
*/
public class IDPEntryImpl extends AbstractXMLObject implements IDPEntry {
/** The unique identifier of the IdP. */
- private String providerID;
+ @Nullable private String providerID;
/** Human-readable name for the IdP. */
- private String name;
+ @Nullable private String name;
/**
* URI reference representing the location of a profile-specific endpoint supporting the authentication request
* protocol.
*/
- private String loc;
+ @Nullable private String loc;
/**
* Constructor.
@@ -51,46 +57,48 @@ public class IDPEntryImpl extends AbstractXMLObject implements IDPEntry {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected IDPEntryImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected IDPEntryImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getProviderID() {
- return this.providerID;
+ @Nullable public String getProviderID() {
+ return providerID;
}
/** {@inheritDoc} */
- public void setProviderID(final String newProviderID) {
- this.providerID = prepareForAssignment(this.providerID, newProviderID);
+ public void setProviderID(@Nullable final String newProviderID) {
+ providerID = prepareForAssignment(providerID, newProviderID);
}
/** {@inheritDoc} */
- public String getName() {
- return this.name;
+ @Nullable public String getName() {
+ return name;
}
/** {@inheritDoc} */
- public void setName(final String newName) {
- this.name = prepareForAssignment(this.name, newName);
+ public void setName(@Nullable final String newName) {
+ name = prepareForAssignment(name, newName);
}
/** {@inheritDoc} */
- public String getLoc() {
- return this.loc;
+ @Nullable public String getLoc() {
+ return loc;
}
/** {@inheritDoc} */
- public void setLoc(final String newLoc) {
- this.loc = prepareForAssignment(this.loc, newLoc);
+ public void setLoc(@Nullable final String newLoc) {
+ loc = prepareForAssignment(loc, newLoc);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
// no children
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IDPListImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IDPListImpl.java
index af496dbdf..1d3ce1724 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IDPListImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IDPListImpl.java
@@ -22,9 +22,11 @@
package org.opensaml.saml.saml2.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;
@@ -32,16 +34,21 @@ import org.opensaml.saml.saml2.core.GetComplete;
import org.opensaml.saml.saml2.core.IDPEntry;
import org.opensaml.saml.saml2.core.IDPList;
+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.IDPList}.
+ * Concrete implementation of {@link IDPList}.
*/
public class IDPListImpl extends AbstractXMLObject implements IDPList {
/** List of IDPEntry's. */
- private final XMLObjectChildrenList<IDPEntry> idpEntries;
+ @Nonnull private final XMLObjectChildrenList<IDPEntry> idpEntries;
/** GetComplete child element. */
- private GetComplete getComplete;
+ @Nullable private GetComplete getComplete;
/**
* Constructor.
@@ -50,35 +57,38 @@ public class IDPListImpl extends AbstractXMLObject implements IDPList {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected IDPListImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected IDPListImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
idpEntries = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<IDPEntry> getIDPEntrys() {
+ @Nonnull @Live public List<IDPEntry> getIDPEntrys() {
return idpEntries;
}
/** {@inheritDoc} */
- public GetComplete getGetComplete() {
+ @Nullable public GetComplete getGetComplete() {
return getComplete;
}
/** {@inheritDoc} */
- public void setGetComplete(final GetComplete newGetComplete) {
- this.getComplete = prepareForAssignment(this.getComplete, newGetComplete);
+ public void setGetComplete(@Nullable final GetComplete newGetComplete) {
+ getComplete = prepareForAssignment(getComplete, newGetComplete);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
+
children.addAll(idpEntries);
- children.add(getComplete);
- if (children.size() > 0) {
- return Collections.unmodifiableList(children);
- } else {
- return null;
+
+ if (getComplete != null) {
+ children.add(getComplete);
}
+
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IssuerImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IssuerImpl.java
index 0d26be4a2..8ee99a8f6 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IssuerImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/IssuerImpl.java
@@ -17,10 +17,13 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.Issuer;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.Issuer}.
+ * A concrete implementation of {@link Issuer}.
*/
public class IssuerImpl extends AbstractNameIDType implements Issuer {
@@ -31,7 +34,9 @@ public class IssuerImpl extends AbstractNameIDType implements Issuer {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected IssuerImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected IssuerImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/KeyInfoConfirmationDataTypeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/KeyInfoConfirmationDataTypeImpl.java
index 3ae3a123c..005e83cb6 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/KeyInfoConfirmationDataTypeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/KeyInfoConfirmationDataTypeImpl.java
@@ -19,12 +19,17 @@ package org.opensaml.saml.saml2.core.impl;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.saml.saml2.core.KeyInfoConfirmationDataType;
import org.opensaml.xmlsec.signature.KeyInfo;
+import net.shibboleth.shared.annotation.constraint.Live;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.SubjectConfirmationData}.
+ * Concrete implementation of {@link KeyInfoConfirmationDataType}.
*/
public class KeyInfoConfirmationDataTypeImpl extends SubjectConfirmationDataImpl
implements KeyInfoConfirmationDataType {
@@ -36,14 +41,14 @@ public class KeyInfoConfirmationDataTypeImpl extends SubjectConfirmationDataImpl
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected KeyInfoConfirmationDataTypeImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected KeyInfoConfirmationDataTypeImpl(@Nullable final String namespaceURI,
+ @Nonnull final String elementLocalName, @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public List<XMLObject> getKeyInfos() {
+ @Nonnull @Live public List<XMLObject> getKeyInfos() {
return getUnknownXMLObjects(KeyInfo.DEFAULT_ELEMENT_NAME);
}
-}
+}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/LogoutRequestImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/LogoutRequestImpl.java
index 7c181dd9a..dc04aa013 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/LogoutRequestImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/LogoutRequestImpl.java
@@ -19,9 +19,11 @@ package org.opensaml.saml.saml2.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.saml2.core.BaseID;
@@ -30,29 +32,33 @@ import org.opensaml.saml.saml2.core.LogoutRequest;
import org.opensaml.saml.saml2.core.NameID;
import org.opensaml.saml.saml2.core.SessionIndex;
+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.saml2.core.LogoutRequest}.
+ * A concrete implementation of {@link LogoutRequest}.
*/
public class LogoutRequestImpl extends RequestAbstractTypeImpl implements LogoutRequest {
/** Reason attribute. */
- private String reason;
+ @Nullable private String reason;
/** NotOnOrAfter attribute. */
- private Instant notOnOrAfter;
+ @Nullable private Instant notOnOrAfter;
/** BaseID child element. */
- private BaseID baseID;
+ @Nullable private BaseID baseID;
/** NameID child element. */
- private NameID nameID;
+ @Nullable private NameID nameID;
/** EncryptedID child element. */
- private EncryptedID encryptedID;
-
+ @Nullable private EncryptedID encryptedID;
/** SessionIndex child elements. */
- private final XMLObjectChildrenList<SessionIndex> sessionIndexes;
+ @Nonnull private final XMLObjectChildrenList<SessionIndex> sessionIndexes;
/**
* Constructor.
@@ -61,73 +67,75 @@ public class LogoutRequestImpl extends RequestAbstractTypeImpl implements Logout
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected LogoutRequestImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected LogoutRequestImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
sessionIndexes = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getReason() {
- return this.reason;
+ @Nullable public String getReason() {
+ return reason;
}
/** {@inheritDoc} */
- public void setReason(final String newReason) {
- this.reason = prepareForAssignment(this.reason, newReason);
+ public void setReason(@Nullable final String newReason) {
+ reason = prepareForAssignment(reason, newReason);
}
/** {@inheritDoc} */
- public Instant getNotOnOrAfter() {
- return this.notOnOrAfter;
+ @Nullable public Instant getNotOnOrAfter() {
+ return notOnOrAfter;
}
/** {@inheritDoc} */
- public void setNotOnOrAfter(final Instant newNotOnOrAfter) {
- this.notOnOrAfter = prepareForAssignment(this.notOnOrAfter, newNotOnOrAfter);
+ public void setNotOnOrAfter(@Nullable final Instant newNotOnOrAfter) {
+ notOnOrAfter = prepareForAssignment(notOnOrAfter, newNotOnOrAfter);
}
/** {@inheritDoc} */
- public BaseID getBaseID() {
+ @Nullable public BaseID getBaseID() {
return baseID;
}
/** {@inheritDoc} */
- public void setBaseID(final BaseID newBaseID) {
+ public void setBaseID(@Nullable final BaseID newBaseID) {
baseID = prepareForAssignment(baseID, newBaseID);
}
/** {@inheritDoc} */
- public NameID getNameID() {
+ @Nullable public NameID getNameID() {
return nameID;
}
/** {@inheritDoc} */
- public void setNameID(final NameID newNameID) {
+ public void setNameID(@Nullable final NameID newNameID) {
nameID = prepareForAssignment(nameID, newNameID);
}
/** {@inheritDoc} */
- public EncryptedID getEncryptedID() {
- return this.encryptedID;
+ @Nullable public EncryptedID getEncryptedID() {
+ return encryptedID;
}
/** {@inheritDoc} */
- public void setEncryptedID(final EncryptedID newEncryptedID) {
- this.encryptedID = prepareForAssignment(this.encryptedID, newEncryptedID);
+ public void setEncryptedID(@Nullable final EncryptedID newEncryptedID) {
+ encryptedID = prepareForAssignment(encryptedID, newEncryptedID);
}
/** {@inheritDoc} */
- public List<SessionIndex> getSessionIndexes() {
+ @Nonnull @Live public List<SessionIndex> getSessionIndexes() {
return sessionIndexes;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
if (baseID != null) {
@@ -144,10 +152,7 @@ public class LogoutRequestImpl extends RequestAbstractTypeImpl implements Logout
children.addAll(sessionIndexes);
- 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/saml2/core/impl/LogoutResponseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/LogoutResponseImpl.java
index 270d46db0..078252505 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/LogoutResponseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/LogoutResponseImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.LogoutResponse;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.LogoutResponse}.
+ * A concrete implementation of {@link LogoutResponse}.
*/
public class LogoutResponseImpl extends StatusResponseTypeImpl implements LogoutResponse {
@@ -35,8 +38,9 @@ public class LogoutResponseImpl extends StatusResponseTypeImpl implements Logout
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected LogoutResponseImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected LogoutResponseImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ManageNameIDRequestImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ManageNameIDRequestImpl.java
index cc5026015..a46cf630d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ManageNameIDRequestImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ManageNameIDRequestImpl.java
@@ -22,9 +22,11 @@
package org.opensaml.saml.saml2.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.saml2.core.EncryptedID;
import org.opensaml.saml.saml2.core.ManageNameIDRequest;
@@ -33,25 +35,29 @@ import org.opensaml.saml.saml2.core.NewEncryptedID;
import org.opensaml.saml.saml2.core.NewID;
import org.opensaml.saml.saml2.core.Terminate;
+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.saml2.core.ManageNameIDRequest}.
+ * A concrete implementation of {@link ManageNameIDRequest}.
*/
public class ManageNameIDRequestImpl extends RequestAbstractTypeImpl implements ManageNameIDRequest {
/** NameID child element. */
- private NameID nameID;
+ @Nullable private NameID nameID;
/** EncryptedID child element. */
- private EncryptedID encryptedID;
+ @Nullable private EncryptedID encryptedID;
/** NewID child element. */
- private NewID newID;
+ @Nullable private NewID newID;
/** NameID child element. */
- private NewEncryptedID newEncryptedID;
+ @Nullable private NewEncryptedID newEncryptedID;
/** Terminate child element. */
- private Terminate terminate;
+ @Nullable private Terminate terminate;
/**
* Constructor.
@@ -60,68 +66,71 @@ public class ManageNameIDRequestImpl extends RequestAbstractTypeImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ManageNameIDRequestImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ManageNameIDRequestImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public NameID getNameID() {
- return this.nameID;
+ @Nullable public NameID getNameID() {
+ return nameID;
}
/** {@inheritDoc} */
- public void setNameID(final NameID newNameID) {
- this.nameID = prepareForAssignment(this.nameID, newNameID);
+ public void setNameID(@Nullable final NameID newNameID) {
+ nameID = prepareForAssignment(nameID, newNameID);
}
/** {@inheritDoc} */
- public EncryptedID getEncryptedID() {
- return this.encryptedID;
+ @Nullable public EncryptedID getEncryptedID() {
+ return encryptedID;
}
/** {@inheritDoc} */
- public void setEncryptedID(final EncryptedID newEncID) {
- this.encryptedID = prepareForAssignment(this.encryptedID, newEncID);
+ public void setEncryptedID(@Nullable final EncryptedID newEncID) {
+ encryptedID = prepareForAssignment(encryptedID, newEncID);
}
/** {@inheritDoc} */
- public NewID getNewID() {
- return this.newID;
+ @Nullable public NewID getNewID() {
+ return newID;
}
/** {@inheritDoc} */
- public void setNewID(final NewID newNewID) {
- this.newID = prepareForAssignment(this.newID, newNewID);
+ public void setNewID(@Nullable final NewID newNewID) {
+ newID = prepareForAssignment(newID, newNewID);
}
/** {@inheritDoc} */
- public NewEncryptedID getNewEncryptedID() {
- return this.newEncryptedID;
+ @Nullable public NewEncryptedID getNewEncryptedID() {
+ return newEncryptedID;
}
/** {@inheritDoc} */
- public void setNewEncryptedID(final NewEncryptedID newNewEncryptedID) {
- this.newEncryptedID = prepareForAssignment(this.newEncryptedID, newNewEncryptedID);
+ public void setNewEncryptedID(@Nullable final NewEncryptedID newNewEncryptedID) {
+ newEncryptedID = prepareForAssignment(newEncryptedID, newNewEncryptedID);
}
/** {@inheritDoc} */
- public Terminate getTerminate() {
- return this.terminate;
+ @Nullable public Terminate getTerminate() {
+ return terminate;
}
/** {@inheritDoc} */
- public void setTerminate(final Terminate newTerminate) {
- this.terminate = prepareForAssignment(this.terminate, newTerminate);
+ public void setTerminate(@Nullable final Terminate newTerminate) {
+ terminate = prepareForAssignment(terminate, newTerminate);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
+
if (nameID != null) {
children.add(nameID);
}
@@ -138,10 +147,7 @@ public class ManageNameIDRequestImpl extends RequestAbstractTypeImpl implements
children.add(terminate);
}
- 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/saml2/core/impl/ManageNameIDResponseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ManageNameIDResponseImpl.java
index 0797fb3bf..765825a62 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ManageNameIDResponseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ManageNameIDResponseImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.ManageNameIDResponse;
/**
- * A Builder for {@link ManageNameIDResponse} objects.
+ * Concrete implementation for {@link ManageNameIDResponse} objects.
*/
public class ManageNameIDResponseImpl extends StatusResponseTypeImpl implements ManageNameIDResponse {
@@ -35,8 +38,9 @@ public class ManageNameIDResponseImpl extends StatusResponseTypeImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ManageNameIDResponseImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ManageNameIDResponseImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDImpl.java
index 06905c819..9ece613e3 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.NameID;
/**
@@ -31,7 +34,9 @@ public class NameIDImpl extends AbstractNameIDType implements NameID {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected NameIDImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected NameIDImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDMappingRequestImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDMappingRequestImpl.java
index a95c56d13..9eb671dc7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDMappingRequestImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDMappingRequestImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml2.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.saml2.core.BaseID;
import org.opensaml.saml.saml2.core.EncryptedID;
@@ -28,22 +30,26 @@ import org.opensaml.saml.saml2.core.NameID;
import org.opensaml.saml.saml2.core.NameIDMappingRequest;
import org.opensaml.saml.saml2.core.NameIDPolicy;
+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.saml2.core.NameIDMappingRequest}.
+ * A concrete implementation of {@link NameIDMappingRequest}.
*/
public class NameIDMappingRequestImpl extends RequestAbstractTypeImpl implements NameIDMappingRequest {
/** BaseID child element. */
- private BaseID baseID;
+ @Nullable private BaseID baseID;
/** NameID child element. */
- private NameID nameID;
+ @Nullable private NameID nameID;
/** EncryptedID child element. */
- private EncryptedID encryptedID;
+ @Nullable private EncryptedID encryptedID;
/** NameIDPolicy child element. */
- private NameIDPolicy nameIDPolicy;
+ @Nullable private NameIDPolicy nameIDPolicy;
/**
* Constructor.
@@ -52,57 +58,59 @@ public class NameIDMappingRequestImpl extends RequestAbstractTypeImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected NameIDMappingRequestImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected NameIDMappingRequestImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public BaseID getBaseID() {
+ @Nullable public BaseID getBaseID() {
return baseID;
}
/** {@inheritDoc} */
- public void setBaseID(final BaseID newBaseID) {
+ public void setBaseID(@Nullable final BaseID newBaseID) {
baseID = prepareForAssignment(baseID, newBaseID);
}
/** {@inheritDoc} */
- public NameID getNameID() {
+ @Nullable public NameID getNameID() {
return nameID;
}
/** {@inheritDoc} */
- public void setNameID(final NameID newNameID) {
+ public void setNameID(@Nullable final NameID newNameID) {
nameID = prepareForAssignment(nameID, newNameID);
}
/** {@inheritDoc} */
- public EncryptedID getEncryptedID() {
- return this.encryptedID;
+ @Nullable public EncryptedID getEncryptedID() {
+ return encryptedID;
}
/** {@inheritDoc} */
- public void setEncryptedID(final EncryptedID newEncryptedID) {
- this.encryptedID = prepareForAssignment(this.encryptedID, newEncryptedID);
+ public void setEncryptedID(@Nullable final EncryptedID newEncryptedID) {
+ encryptedID = prepareForAssignment(encryptedID, newEncryptedID);
}
/** {@inheritDoc} */
- public NameIDPolicy getNameIDPolicy() {
- return this.nameIDPolicy;
+ @Nullable public NameIDPolicy getNameIDPolicy() {
+ return nameIDPolicy;
}
/** {@inheritDoc} */
- public void setNameIDPolicy(final NameIDPolicy newNameIDPolicy) {
- this.nameIDPolicy = prepareForAssignment(this.nameIDPolicy, newNameIDPolicy);
+ public void setNameIDPolicy(@Nullable final NameIDPolicy newNameIDPolicy) {
+ nameIDPolicy = prepareForAssignment(nameIDPolicy, newNameIDPolicy);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
if (baseID != null) {
@@ -121,10 +129,7 @@ public class NameIDMappingRequestImpl extends RequestAbstractTypeImpl implements
children.add(nameIDPolicy);
}
- 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/saml2/core/impl/NameIDMappingResponseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDMappingResponseImpl.java
index 76dddbd4f..6559e206d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDMappingResponseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDMappingResponseImpl.java
@@ -18,24 +18,30 @@
package org.opensaml.saml.saml2.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.saml2.core.EncryptedID;
import org.opensaml.saml.saml2.core.NameID;
import org.opensaml.saml.saml2.core.NameIDMappingResponse;
+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.NameIDMappingResponse}.
+ * Concrete implementation of {@link NameIDMappingResponse}.
*/
public class NameIDMappingResponseImpl extends StatusResponseTypeImpl implements NameIDMappingResponse {
/** NameID child element. */
- private NameID nameID;
+ @Nullable private NameID nameID;
/** EncryptedID child element. */
- private EncryptedID encryptedID;
+ @Nullable private EncryptedID encryptedID;
/**
* Constructor.
@@ -44,37 +50,39 @@ public class NameIDMappingResponseImpl extends StatusResponseTypeImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected NameIDMappingResponseImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected NameIDMappingResponseImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public NameID getNameID() {
+ @Nullable public NameID getNameID() {
return this.nameID;
}
/** {@inheritDoc} */
- public void setNameID(final NameID newNameID) {
+ public void setNameID(@Nullable final NameID newNameID) {
this.nameID = prepareForAssignment(this.nameID, newNameID);
}
/** {@inheritDoc} */
- public EncryptedID getEncryptedID() {
+ @Nullable public EncryptedID getEncryptedID() {
return this.encryptedID;
}
/** {@inheritDoc} */
- public void setEncryptedID(final EncryptedID newEncryptedID) {
+ public void setEncryptedID(@Nullable final EncryptedID newEncryptedID) {
this.encryptedID = prepareForAssignment(this.encryptedID, newEncryptedID);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
if (nameID != null) {
@@ -85,10 +93,7 @@ public class NameIDMappingResponseImpl extends StatusResponseTypeImpl implements
children.add(encryptedID);
}
- 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/saml2/core/impl/NameIDPolicyImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDPolicyImpl.java
index 88fa2f87d..8dc2fe6c1 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDPolicyImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NameIDPolicyImpl.java
@@ -23,24 +23,30 @@ package org.opensaml.saml.saml2.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.core.xml.schema.XSBooleanValue;
import org.opensaml.saml.saml2.core.NameIDPolicy;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.NameIDPolicy}.
+ * Concrete implementation of {@link NameIDPolicy}.
*/
public class NameIDPolicyImpl extends AbstractXMLObject implements NameIDPolicy {
/** NameID Format URI. */
- private String format;
+ @Nullable private String format;
/** NameID Format URI. */
- private String spNameQualifier;
+ @Nullable private String spNameQualifier;
/** NameID Format URI. */
- private XSBooleanValue allowCreate;
+ @Nullable private XSBooleanValue allowCreate;
/**
* Constructor.
@@ -49,34 +55,35 @@ public class NameIDPolicyImpl extends AbstractXMLObject implements NameIDPolicy
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected NameIDPolicyImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected NameIDPolicyImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getFormat() {
+ @Nullable public String getFormat() {
return format;
}
/** {@inheritDoc} */
- public void setFormat(final String newFormat) {
+ public void setFormat(@Nullable final String newFormat) {
format = prepareForAssignment(format, newFormat);
}
/** {@inheritDoc} */
- public String getSPNameQualifier() {
+ @Nullable public String getSPNameQualifier() {
return spNameQualifier;
}
/** {@inheritDoc} */
- public void setSPNameQualifier(final String newSPNameQualifier) {
+ public void setSPNameQualifier(@Nullable final String newSPNameQualifier) {
spNameQualifier = prepareForAssignment(spNameQualifier, newSPNameQualifier);
}
/** {@inheritDoc} */
- public Boolean getAllowCreate(){
+ @Nullable public Boolean getAllowCreate() {
if(allowCreate != null){
return allowCreate.getValue();
}
@@ -85,12 +92,12 @@ public class NameIDPolicyImpl extends AbstractXMLObject implements NameIDPolicy
}
/** {@inheritDoc} */
- public XSBooleanValue getAllowCreateXSBoolean() {
+ @Nullable public XSBooleanValue getAllowCreateXSBoolean() {
return allowCreate;
}
/** {@inheritDoc} */
- public void setAllowCreate(final Boolean newAllowCreate){
+ public void setAllowCreate(@Nullable final Boolean newAllowCreate){
if(newAllowCreate != null){
allowCreate = prepareForAssignment(allowCreate, new XSBooleanValue(newAllowCreate, false));
}else{
@@ -99,14 +106,15 @@ public class NameIDPolicyImpl extends AbstractXMLObject implements NameIDPolicy
}
/** {@inheritDoc} */
- public void setAllowCreate(final XSBooleanValue newAllowCreate) {
+ public void setAllowCreate(@Nullable final XSBooleanValue newAllowCreate) {
allowCreate = prepareForAssignment(allowCreate, newAllowCreate);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
// no children
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewEncryptedIDImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewEncryptedIDImpl.java
index b484eb8c5..a589b8fa2 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewEncryptedIDImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewEncryptedIDImpl.java
@@ -17,10 +17,13 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.core.NewEncryptedID;
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.NewEncryptedID}.
+ * A concrete implementation of {@link NewEncryptedID}.
*/
public class NewEncryptedIDImpl extends EncryptedElementTypeImpl implements NewEncryptedID {
@@ -31,9 +34,9 @@ public class NewEncryptedIDImpl extends EncryptedElementTypeImpl implements NewE
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected NewEncryptedIDImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected NewEncryptedIDImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
-}
+}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewIDImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewIDImpl.java
index b7111c481..15db93d69 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewIDImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/NewIDImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.core.NewID;
@@ -36,7 +39,8 @@ public class NewIDImpl extends XSStringImpl implements NewID {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected NewIDImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected NewIDImpl(@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/saml2/core/impl/OneTimeUseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/OneTimeUseImpl.java
index 8c7a46f19..39fce4ae4 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/OneTimeUseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/OneTimeUseImpl.java
@@ -23,12 +23,18 @@ package org.opensaml.saml.saml2.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.saml2.core.OneTimeUse;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.OneTimeUse}.
+ * Concrete implementation of {@link OneTimeUse}.
*/
public class OneTimeUseImpl extends AbstractXMLObject implements OneTimeUse {
@@ -39,12 +45,14 @@ public class OneTimeUseImpl extends AbstractXMLObject implements OneTimeUse {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected OneTimeUseImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected OneTimeUseImpl(@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/saml2/core/impl/ProxyRestrictionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ProxyRestrictionImpl.java
index 7d12f33c9..b104dc4d1 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ProxyRestrictionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ProxyRestrictionImpl.java
@@ -21,8 +21,6 @@
package org.opensaml.saml.saml2.core.impl;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
@@ -34,10 +32,13 @@ import org.opensaml.core.xml.util.XMLObjectChildrenList;
import org.opensaml.saml.saml2.core.Audience;
import org.opensaml.saml.saml2.core.ProxyRestriction;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
+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.ProxyRestriction}.
+ * Concrete implementation of {@link ProxyRestriction}.
*/
public class ProxyRestrictionImpl extends AbstractXMLObject implements ProxyRestriction {
@@ -54,14 +55,14 @@ public class ProxyRestrictionImpl extends AbstractXMLObject implements ProxyRest
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ProxyRestrictionImpl(@Nullable @NotEmpty final String namespaceURI,
- @Nonnull @NotEmpty final String elementLocalName, @Nullable @NotEmpty final String namespacePrefix) {
+ protected ProxyRestrictionImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
audiences = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- @Nullable public List<Audience> getAudiences() {
+ @Nonnull @Live public List<Audience> getAudiences() {
return audiences;
}
@@ -80,11 +81,8 @@ public class ProxyRestrictionImpl extends AbstractXMLObject implements ProxyRest
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- 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/saml2/core/impl/RequestAbstractTypeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequestAbstractTypeImpl.java
index 72346e3f3..dce21dbcb 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequestAbstractTypeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequestAbstractTypeImpl.java
@@ -23,41 +23,48 @@ package org.opensaml.saml.saml2.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.saml2.core.Extensions;
import org.opensaml.saml.saml2.core.Issuer;
import org.opensaml.saml.saml2.core.RequestAbstractType;
+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;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.RequestAbstractType}.
+ * Concrete implementation of {@link RequestAbstractType}.
*/
public abstract class RequestAbstractTypeImpl extends AbstractSignableSAMLObject implements RequestAbstractType {
/** SAML Version of the request. */
- private SAMLVersion version;
+ @Nullable private SAMLVersion version;
/** Unique identifier of the request. */
- private String id;
+ @Nullable private String id;
/** Date/time request was issued. */
- private Instant issueInstant;
+ @Nullable private Instant issueInstant;
/** URI of the request destination. */
- private String destination;
+ @Nullable private String destination;
/** URI of the SAML user consent type. */
- private String consent;
+ @Nullable private String consent;
/** URI of the SAML user consent type. */
- private Issuer issuer;
+ @Nullable private Issuer issuer;
/** Extensions child element. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/**
* Constructor.
@@ -66,107 +73,107 @@ 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_20;
}
/** {@inheritDoc} */
- public SAMLVersion getVersion() {
+ @Nullable public SAMLVersion getVersion() {
return version;
}
/** {@inheritDoc} */
- public void setVersion(final SAMLVersion newVersion) {
+ public void setVersion(@Nullable final SAMLVersion newVersion) {
this.version = prepareForAssignment(this.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 Instant getIssueInstant() {
+ @Nullable public Instant getIssueInstant() {
return issueInstant;
}
/** {@inheritDoc} */
- public void setIssueInstant(final Instant newIssueInstant) {
+ public void setIssueInstant(@Nullable final Instant newIssueInstant) {
issueInstant = prepareForAssignment(issueInstant, newIssueInstant);
}
/** {@inheritDoc} */
- public String getDestination() {
+ @Nullable public String getDestination() {
return destination;
}
/** {@inheritDoc} */
- public void setDestination(final String newDestination) {
+ public void setDestination(@Nullable final String newDestination) {
destination = prepareForAssignment(destination, newDestination);
}
/** {@inheritDoc} */
- public String getConsent() {
+ @Nullable public String getConsent() {
return consent;
}
/** {@inheritDoc} */
- public void setConsent(final String newConsent) {
+ public void setConsent(@Nullable final String newConsent) {
consent = prepareForAssignment(consent, newConsent);
}
/** {@inheritDoc} */
- public Issuer getIssuer() {
+ @Nullable public Issuer getIssuer() {
return issuer;
}
/** {@inheritDoc} */
- public void setIssuer(final Issuer newIssuer) {
+ public void setIssuer(@Nullable final Issuer newIssuer) {
issuer = prepareForAssignment(issuer, newIssuer);
}
/** {@inheritDoc} */
- public Extensions getExtensions() {
+ @Nullable public Extensions getExtensions() {
return extensions;
}
/** {@inheritDoc} */
- public void setExtensions(final Extensions newExtensions) {
+ public void setExtensions(@Nullable final Extensions newExtensions) {
extensions = prepareForAssignment(extensions, newExtensions);
}
/** {@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<>();
if (issuer != null) {
children.add(issuer);
}
- if (getSignature() != null) {
- children.add(getSignature());
+
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
+
if (extensions != null) {
children.add(extensions);
}
- 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/saml2/core/impl/RequestedAuthnContextImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequestedAuthnContextImpl.java
index 69c3efda0..08d5dbc23 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequestedAuthnContextImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequestedAuthnContextImpl.java
@@ -22,9 +22,11 @@
package org.opensaml.saml.saml2.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;
@@ -33,16 +35,21 @@ import org.opensaml.saml.saml2.core.AuthnContextComparisonTypeEnumeration;
import org.opensaml.saml.saml2.core.AuthnContextDeclRef;
import org.opensaml.saml.saml2.core.RequestedAuthnContext;
+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.RequestedAuthnContext}.
+ * Concrete implementation of {@link RequestedAuthnContext}.
*/
public class RequestedAuthnContextImpl extends AbstractXMLObject implements RequestedAuthnContext {
/** AuthnContextClassRef child elements. */
- private final XMLObjectChildrenList<AuthnContextClassRef> authnContextClassRefs;
+ @Nonnull private final XMLObjectChildrenList<AuthnContextClassRef> authnContextClassRefs;
/** AuthnContextDeclRef child elements. */
- private final XMLObjectChildrenList<AuthnContextDeclRef> authnContextDeclRefs;
+ @Nonnull private final XMLObjectChildrenList<AuthnContextDeclRef> authnContextDeclRefs;
/** Comparison attribute. */
private AuthnContextComparisonTypeEnumeration comparison;
@@ -54,44 +61,41 @@ public class RequestedAuthnContextImpl extends AbstractXMLObject implements Requ
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RequestedAuthnContextImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected RequestedAuthnContextImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
authnContextClassRefs = new XMLObjectChildrenList<>(this);
authnContextDeclRefs = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public AuthnContextComparisonTypeEnumeration getComparison() {
+ @Nullable public AuthnContextComparisonTypeEnumeration getComparison() {
return this.comparison;
}
/** {@inheritDoc} */
- public void setComparison(final AuthnContextComparisonTypeEnumeration newComparison) {
+ public void setComparison(@Nullable final AuthnContextComparisonTypeEnumeration newComparison) {
this.comparison = prepareForAssignment(this.comparison, newComparison);
}
/** {@inheritDoc} */
- public List<AuthnContextClassRef> getAuthnContextClassRefs() {
+ @Nonnull @Live public List<AuthnContextClassRef> getAuthnContextClassRefs() {
return this.authnContextClassRefs;
}
/** {@inheritDoc} */
- public List<AuthnContextDeclRef> getAuthnContextDeclRefs() {
+ @Nonnull @Live public List<AuthnContextDeclRef> getAuthnContextDeclRefs() {
return this.authnContextDeclRefs;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
children.addAll(authnContextClassRefs);
children.addAll(authnContextDeclRefs);
- 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/saml2/core/impl/RequesterIDImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequesterIDImpl.java
index e9a25cb97..fe86e656b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequesterIDImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/RequesterIDImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.core.RequesterID;
@@ -36,7 +39,8 @@ public class RequesterIDImpl extends XSURIImpl implements RequesterID {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RequesterIDImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected RequesterIDImpl(@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/saml2/core/impl/ResponseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ResponseImpl.java
index 533373cf1..81654118c 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ResponseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ResponseImpl.java
@@ -22,22 +22,30 @@
package org.opensaml.saml.saml2.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.IndexedXMLObjectChildrenList;
import org.opensaml.saml.saml2.core.Assertion;
import org.opensaml.saml.saml2.core.EncryptedAssertion;
import org.opensaml.saml.saml2.core.Response;
+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.Response}.
+ * Concrete implementation of {@link Response}.
*/
+ at SuppressWarnings("unchecked")
public class ResponseImpl extends StatusResponseTypeImpl implements Response {
/** Assertion child elements. */
- private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> indexedChildren;
/**
* Constructor.
@@ -46,35 +54,35 @@ public class ResponseImpl extends StatusResponseTypeImpl 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);
indexedChildren = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public List<Assertion> getAssertions() {
+ @Nonnull @Live public List<Assertion> getAssertions() {
return (List<Assertion>) indexedChildren.subList(Assertion.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<EncryptedAssertion> getEncryptedAssertions() {
+ @Nonnull @Live public List<EncryptedAssertion> getEncryptedAssertions() {
return (List<EncryptedAssertion>) indexedChildren.subList(EncryptedAssertion.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
children.addAll(indexedChildren);
- 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/saml2/core/impl/ScopingImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ScopingImpl.java
index d108db7cc..f3ce4fa8c 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ScopingImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/ScopingImpl.java
@@ -22,9 +22,11 @@
package org.opensaml.saml.saml2.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;
@@ -32,19 +34,24 @@ import org.opensaml.saml.saml2.core.IDPList;
import org.opensaml.saml.saml2.core.RequesterID;
import org.opensaml.saml.saml2.core.Scoping;
+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.Scoping}.
+ * Concrete implementation of {@link Scoping}.
*/
public class ScopingImpl extends AbstractXMLObject implements Scoping {
/** IDPList child element. */
- private IDPList idpList;
+ @Nullable private IDPList idpList;
/** List of RequesterID child elements. */
- private final XMLObjectChildrenList<RequesterID> requesterIDs;
+ @Nonnull private final XMLObjectChildrenList<RequesterID> requesterIDs;
/** ProxyCount attribute. */
- private Integer proxyCount;
+ @Nullable private Integer proxyCount;
/**
* Constructor.
@@ -53,39 +60,40 @@ public class ScopingImpl extends AbstractXMLObject implements Scoping {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ScopingImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ScopingImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
requesterIDs = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public Integer getProxyCount() {
+ @Nullable public Integer getProxyCount() {
return this.proxyCount;
}
/** {@inheritDoc} */
- public void setProxyCount(final Integer newProxyCount) {
+ public void setProxyCount(@Nullable final Integer newProxyCount) {
this.proxyCount = prepareForAssignment(this.proxyCount, newProxyCount);
}
/** {@inheritDoc} */
- public IDPList getIDPList() {
+ @Nullable public IDPList getIDPList() {
return idpList;
}
/** {@inheritDoc} */
- public void setIDPList(final IDPList newIDPList) {
+ public void setIDPList(@Nullable final IDPList newIDPList) {
this.idpList = prepareForAssignment(this.idpList, newIDPList);
}
/** {@inheritDoc} */
- public List<RequesterID> getRequesterIDs() {
+ @Nonnull @Live public List<RequesterID> getRequesterIDs() {
return requesterIDs;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
if (idpList != null) {
@@ -94,10 +102,7 @@ public class ScopingImpl extends AbstractXMLObject implements Scoping {
children.addAll(requesterIDs);
- if (children.size() > 0) {
- return Collections.unmodifiableList(children);
- } else {
- return null;
- }
+ return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SessionIndexImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SessionIndexImpl.java
index bd6cd42db..3a66d24bb 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SessionIndexImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SessionIndexImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.core.SessionIndex;
@@ -36,7 +39,8 @@ public class SessionIndexImpl extends XSStringImpl implements SessionIndex {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SessionIndexImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected SessionIndexImpl(@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/saml2/core/impl/StatusCodeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusCodeImpl.java
index 11a4e043c..c2c4d4177 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusCodeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusCodeImpl.java
@@ -21,24 +21,29 @@
package org.opensaml.saml.saml2.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.saml2.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.saml2.core.StatusCode}.
+ * Concrete implementation of {@link StatusCode}.
*/
public class StatusCodeImpl extends AbstractXMLObject implements StatusCode {
/** Value attribute URI. */
- private String value;
+ @Nullable private String value;
/** Nested secondary StatusCode child element. */
- private StatusCode childStatusCode;
+ @Nullable private StatusCode childStatusCode;
/**
* Constructor.
@@ -47,38 +52,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 StatusCode getStatusCode() {
+ @Nullable public StatusCode getStatusCode() {
return childStatusCode;
}
/** {@inheritDoc} */
- public void setStatusCode(final StatusCode newStatusCode) {
- this.childStatusCode = prepareForAssignment(this.childStatusCode, newStatusCode);
+ public void setStatusCode(@Nullable final StatusCode newStatusCode) {
+ childStatusCode = prepareForAssignment(childStatusCode, newStatusCode);
}
/** {@inheritDoc} */
- public String getValue() {
+ @Nullable public String getValue() {
return value;
}
/** {@inheritDoc} */
- public void setValue(final String newValue) {
- this.value = prepareForAssignment(this.value, newValue);
+ public void setValue(@Nullable final String newValue) {
+ value = prepareForAssignment(value, newValue);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+
if (childStatusCode != null) {
- final ArrayList<XMLObject> children = new ArrayList<>();
- children.add(childStatusCode);
- return Collections.unmodifiableList(children);
- } 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/saml2/core/impl/StatusDetailImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusDetailImpl.java
index 7351c91e8..31d015993 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusDetailImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusDetailImpl.java
@@ -17,9 +17,10 @@
package org.opensaml.saml.saml2.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.saml2.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,7 +48,8 @@ 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);
}
@@ -50,19 +57,21 @@ public class StatusDetailImpl extends AbstractXMLObject implements StatusDetail
/**
* {@inheritDoc}
*/
- public List<XMLObject> getUnknownXMLObjects() {
+ @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);
+ @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/saml2/core/impl/StatusImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusImpl.java
index f8043bb3b..b148ea463 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusImpl.java
@@ -22,9 +22,11 @@
package org.opensaml.saml.saml2.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.saml2.core.Status;
@@ -32,19 +34,23 @@ import org.opensaml.saml.saml2.core.StatusCode;
import org.opensaml.saml.saml2.core.StatusDetail;
import org.opensaml.saml.saml2.core.StatusMessage;
+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.Status}.
+ * Concrete implementation of {@link Status}.
*/
public class StatusImpl extends AbstractXMLObject implements Status {
/** StatusCode element. */
- private StatusCode statusCode;
+ @Nullable private StatusCode statusCode;
/** StatusMessage element. */
- private StatusMessage statusMessage;
+ @Nullable private StatusMessage statusMessage;
/** StatusDetail element. */
- private StatusDetail statusDetail;
+ @Nullable private StatusDetail statusDetail;
/**
* Constructor.
@@ -53,52 +59,59 @@ public class StatusImpl extends AbstractXMLObject implements Status {
* @param elementLocalName element name
* @param namespacePrefix namespace prefix
*/
- 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 StatusCode getStatusCode() {
+ @Nullable public StatusCode getStatusCode() {
return this.statusCode;
}
/** {@inheritDoc} */
- public void setStatusCode(final StatusCode newStatusCode) {
+ public void setStatusCode(@Nullable final StatusCode newStatusCode) {
this.statusCode = prepareForAssignment(this.statusCode, newStatusCode);
}
/** {@inheritDoc} */
- public StatusMessage getStatusMessage() {
+ @Nullable public StatusMessage getStatusMessage() {
return this.statusMessage;
}
/** {@inheritDoc} */
- public void setStatusMessage(final StatusMessage newStatusMessage) {
+ public void setStatusMessage(@Nullable final StatusMessage newStatusMessage) {
this.statusMessage = prepareForAssignment(this.getStatusMessage(), newStatusMessage);
}
/** {@inheritDoc} */
- public StatusDetail getStatusDetail() {
+ @Nullable public StatusDetail getStatusDetail() {
return this.statusDetail;
}
/** {@inheritDoc} */
- public void setStatusDetail(final StatusDetail newStatusDetail) {
+ public void setStatusDetail(@Nullable final StatusDetail newStatusDetail) {
this.statusDetail = prepareForAssignment(this.statusDetail, newStatusDetail);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- children.add(statusCode);
+ if (statusCode != null) {
+ children.add(statusCode);
+ }
+
if (statusMessage != null) {
children.add(statusMessage);
}
+
if (statusDetail != null) {
children.add(statusDetail);
}
- 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/saml2/core/impl/StatusMessageImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusMessageImpl.java
index fe3ba6e18..f1f1e751e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusMessageImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusMessageImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.core.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.core.StatusMessage;
@@ -36,8 +39,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/saml2/core/impl/StatusResponseTypeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusResponseTypeImpl.java
index 59383eb91..197d7a16a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusResponseTypeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/StatusResponseTypeImpl.java
@@ -15,17 +15,15 @@
* limitations under the License.
*/
-/**
- *
- */
-
package org.opensaml.saml.saml2.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;
@@ -33,38 +31,43 @@ import org.opensaml.saml.saml2.core.Extensions;
import org.opensaml.saml.saml2.core.Issuer;
import org.opensaml.saml.saml2.core.Status;
import org.opensaml.saml.saml2.core.StatusResponseType;
+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;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.StatusResponseType}.
+ * Concrete implementation of {@link StatusResponseType}.
*/
public abstract class StatusResponseTypeImpl extends AbstractSignableSAMLObject implements StatusResponseType {
/** SAML Version attribute. */
- private SAMLVersion version;
+ @Nullable private SAMLVersion version;
/** ID attribute. */
- private String id;
+ @Nullable private String id;
/** InResponseTo attribute. */
- private String inResponseTo;
+ @Nullable private String inResponseTo;
/** IssueInstant attribute. */
- private Instant issueInstant;
+ @Nullable private Instant issueInstant;
/** Destination attribute. */
- private String destination;
+ @Nullable private String destination;
/** Consent attribute. */
- private String consent;
+ @Nullable private String consent;
/** Issuer child element. */
- private Issuer issuer;
+ @Nullable private Issuer issuer;
/** Extensions child element. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/** Status child element. */
- private Status status;
+ @Nullable private Status status;
/**
* Constructor.
@@ -73,126 +76,131 @@ public abstract class StatusResponseTypeImpl extends AbstractSignableSAMLObject
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected StatusResponseTypeImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected StatusResponseTypeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
version = SAMLVersion.VERSION_20;
}
/** {@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 String getID() {
- return this.id;
+ @Nullable public String getID() {
+ return id;
}
/** {@inheritDoc} */
- public void setID(final String newID) {
- final String oldID = this.id;
- this.id = prepareForAssignment(this.id, newID);
- registerOwnID(oldID, this.id);
+ public void setID(@Nullable final String newID) {
+ final String oldID = id;
+ id = prepareForAssignment(id, newID);
+ registerOwnID(oldID, id);
}
/** {@inheritDoc} */
- public String getInResponseTo() {
- return this.inResponseTo;
+ @Nullable public String getInResponseTo() {
+ return inResponseTo;
}
/** {@inheritDoc} */
- public void setInResponseTo(final String newInResponseTo) {
- this.inResponseTo = prepareForAssignment(this.inResponseTo, newInResponseTo);
+ public void setInResponseTo(@Nullable final String newInResponseTo) {
+ inResponseTo = prepareForAssignment(inResponseTo, newInResponseTo);
}
/** {@inheritDoc} */
- public Instant getIssueInstant() {
+ @Nullable public Instant getIssueInstant() {
return issueInstant;
}
/** {@inheritDoc} */
- public void setIssueInstant(final Instant newIssueInstant) {
+ public void setIssueInstant(@Nullable final Instant newIssueInstant) {
issueInstant = prepareForAssignment(issueInstant, newIssueInstant);
}
/** {@inheritDoc} */
- public String getDestination() {
- return this.destination;
+ @Nullable public String getDestination() {
+ return destination;
}
/** {@inheritDoc} */
- public void setDestination(final String newDestination) {
- this.destination = prepareForAssignment(this.destination, newDestination);
+ public void setDestination(@Nullable final String newDestination) {
+ destination = prepareForAssignment(destination, newDestination);
}
/** {@inheritDoc} */
- public String getConsent() {
- return this.consent;
+ @Nullable public String getConsent() {
+ return consent;
}
/** {@inheritDoc} */
- public void setConsent(final String newConsent) {
- this.consent = prepareForAssignment(this.consent, newConsent);
+ public void setConsent(@Nullable final String newConsent) {
+ consent = prepareForAssignment(consent, newConsent);
}
/** {@inheritDoc} */
- public Issuer getIssuer() {
- return this.issuer;
+ @Nullable public Issuer getIssuer() {
+ return issuer;
}
/** {@inheritDoc} */
- public void setIssuer(final Issuer newIssuer) {
- this.issuer = prepareForAssignment(this.issuer, newIssuer);
+ public void setIssuer(@Nullable final Issuer newIssuer) {
+ issuer = prepareForAssignment(issuer, newIssuer);
}
/** {@inheritDoc} */
- public Extensions getExtensions() {
- return this.extensions;
+ @Nullable public Extensions getExtensions() {
+ return extensions;
}
/** {@inheritDoc} */
- public void setExtensions(final Extensions newExtensions) {
- this.extensions = prepareForAssignment(this.extensions, newExtensions);
+ public void setExtensions(@Nullable final Extensions newExtensions) {
+ extensions = prepareForAssignment(extensions, newExtensions);
}
/** {@inheritDoc} */
- public Status getStatus() {
- return this.status;
+ @Nullable public Status getStatus() {
+ return status;
}
/** {@inheritDoc} */
- public void setStatus(final Status newStatus) {
- this.status = prepareForAssignment(this.status, newStatus);
+ public void setStatus(@Nullable final Status newStatus) {
+ status = prepareForAssignment(status, newStatus);
}
/** {@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<>();
- if (issuer != null){
+ if (issuer != null) {
children.add(issuer);
}
- if(getSignature() != null){
- children.add(getSignature());
+
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
- if (extensions != null){
+
+ if (extensions != null) {
children.add(extensions);
}
- if (status != null){
+
+ if (status != null) {
children.add(status);
}
- 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/saml2/core/impl/SubjectConfirmationDataImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectConfirmationDataImpl.java
index 100114688..c033e96f6 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectConfirmationDataImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectConfirmationDataImpl.java
@@ -22,9 +22,10 @@
package org.opensaml.saml.saml2.core.impl;
import java.time.Instant;
-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;
@@ -33,31 +34,36 @@ import org.opensaml.core.xml.util.AttributeMap;
import org.opensaml.core.xml.util.IndexedXMLObjectChildrenList;
import org.opensaml.saml.saml2.core.SubjectConfirmationData;
+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.SubjectConfirmationData}.
+ * Concrete implementation of {@link SubjectConfirmationData}.
*/
public class SubjectConfirmationDataImpl extends AbstractXMLObject implements SubjectConfirmationData {
/** NotBefore of the Confirmation Data. */
- private Instant notBefore;
+ @Nullable private Instant notBefore;
/** NotOnOrAfter of the Confirmation Data. */
- private Instant notOnOrAfter;
+ @Nullable private Instant notOnOrAfter;
/** Recipient of the Confirmation Data. */
- private String recipient;
+ @Nullable private String recipient;
/** InResponseTo of the Confirmation Data. */
- private String inResponseTo;
+ @Nullable private String inResponseTo;
/** Address of the Confirmation Data. */
- private String address;
+ @Nullable private String address;
/** "anyAttribute" attributes. */
- private final AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/** "any" children. */
- private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
/**
* Constructor.
@@ -66,84 +72,86 @@ public class SubjectConfirmationDataImpl extends AbstractXMLObject implements Su
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SubjectConfirmationDataImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SubjectConfirmationDataImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownAttributes = new AttributeMap(this);
unknownChildren = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public Instant getNotBefore() {
+ @Nullable public Instant getNotBefore() {
return notBefore;
}
/** {@inheritDoc} */
- public void setNotBefore(final Instant newNotBefore) {
+ public void setNotBefore(@Nullable final Instant newNotBefore) {
this.notBefore = prepareForAssignment(this.notBefore, newNotBefore);
}
/** {@inheritDoc} */
- public Instant getNotOnOrAfter() {
+ @Nullable public Instant getNotOnOrAfter() {
return notOnOrAfter;
}
/** {@inheritDoc} */
- public void setNotOnOrAfter(final Instant newNotOnOrAfter) {
+ public void setNotOnOrAfter(@Nullable final Instant newNotOnOrAfter) {
this.notOnOrAfter = prepareForAssignment(this.notOnOrAfter, newNotOnOrAfter);
}
/** {@inheritDoc} */
- public String getRecipient() {
+ @Nullable public String getRecipient() {
return recipient;
}
/** {@inheritDoc} */
- public void setRecipient(final String newRecipient) {
+ public void setRecipient(@Nullable final String newRecipient) {
this.recipient = prepareForAssignment(this.recipient, newRecipient);
}
/** {@inheritDoc} */
- public String getInResponseTo() {
+ @Nullable public String getInResponseTo() {
return inResponseTo;
}
/** {@inheritDoc} */
- public void setInResponseTo(final String newInResponseTo) {
+ public void setInResponseTo(@Nullable final String newInResponseTo) {
this.inResponseTo = prepareForAssignment(this.inResponseTo, newInResponseTo);
}
/** {@inheritDoc} */
- public String getAddress() {
+ @Nullable public String getAddress() {
return address;
}
/** {@inheritDoc} */
- public void setAddress(final String newAddress) {
+ public void setAddress(@Nullable final String newAddress) {
this.address = prepareForAssignment(this.address, newAddress);
}
/**
* {@inheritDoc}
*/
- public AttributeMap getUnknownAttributes() {
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/**
* {@inheritDoc}
*/
- public List<XMLObject> getUnknownXMLObjects() {
+ @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);
+ @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/saml2/core/impl/SubjectConfirmationImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectConfirmationImpl.java
index 5f50c73a4..701b17145 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectConfirmationImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectConfirmationImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml2.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.saml2.core.BaseID;
@@ -29,25 +31,29 @@ import org.opensaml.saml.saml2.core.NameID;
import org.opensaml.saml.saml2.core.SubjectConfirmation;
import org.opensaml.saml.saml2.core.SubjectConfirmationData;
+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.SubjectConfirmation}.
+ * Concrete implementation of {@link SubjectConfirmation}.
*/
public class SubjectConfirmationImpl extends AbstractXMLObject implements SubjectConfirmation {
/** BaseID child element. */
- private BaseID baseID;
+ @Nullable private BaseID baseID;
/** NameID child element. */
- private NameID nameID;
+ @Nullable private NameID nameID;
/** EncryptedID child element. */
- private EncryptedID encryptedID;
+ @Nullable private EncryptedID encryptedID;
/** SubjectConfirmationData of the Confirmation. */
- private SubjectConfirmationData subjectConfirmationData;
+ @Nullable private SubjectConfirmationData subjectConfirmationData;
/** Method of the Confirmation. */
- private String method;
+ @Nullable private String method;
/**
* Constructor.
@@ -56,64 +62,64 @@ 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);
}
/** {@inheritDoc} */
- public BaseID getBaseID() {
+ @Nullable public BaseID getBaseID() {
return baseID;
}
/** {@inheritDoc} */
- public void setBaseID(final BaseID newBaseID) {
+ public void setBaseID(@Nullable final BaseID newBaseID) {
baseID = prepareForAssignment(baseID, newBaseID);
}
/** {@inheritDoc} */
- public NameID getNameID() {
+ @Nullable public NameID getNameID() {
return nameID;
}
/** {@inheritDoc} */
- public void setNameID(final NameID newNameID) {
+ public void setNameID(@Nullable final NameID newNameID) {
nameID = prepareForAssignment(nameID, newNameID);
}
/** {@inheritDoc} */
- public EncryptedID getEncryptedID() {
+ @Nullable public EncryptedID getEncryptedID() {
return this.encryptedID;
}
/** {@inheritDoc} */
- public void setEncryptedID(final EncryptedID newEncryptedID) {
+ public void setEncryptedID(@Nullable final EncryptedID newEncryptedID) {
this.encryptedID = prepareForAssignment(this.encryptedID, newEncryptedID);
}
/** {@inheritDoc} */
- public SubjectConfirmationData getSubjectConfirmationData() {
+ @Nullable public SubjectConfirmationData getSubjectConfirmationData() {
return subjectConfirmationData;
}
/** {@inheritDoc} */
- public void setSubjectConfirmationData(final SubjectConfirmationData newSubjectConfirmationData) {
+ public void setSubjectConfirmationData(@Nullable final SubjectConfirmationData newSubjectConfirmationData) {
this.subjectConfirmationData = prepareForAssignment(this.subjectConfirmationData, newSubjectConfirmationData);
}
/** {@inheritDoc} */
- public String getMethod() {
+ @Nullable public String getMethod() {
return method;
}
/** {@inheritDoc} */
- public void setMethod(final String newMethod) {
+ public void setMethod(@Nullable final String newMethod) {
this.method = prepareForAssignment(this.method, newMethod);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
if (baseID != null) {
@@ -128,8 +134,11 @@ public class SubjectConfirmationImpl extends AbstractXMLObject implements Subjec
children.add(encryptedID);
}
- children.add(subjectConfirmationData);
+ if (subjectConfirmationData != null) {
+ children.add(subjectConfirmationData);
+ }
- 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/saml2/core/impl/SubjectImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectImpl.java
index fc7d12253..d13ff7ee7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml2.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;
@@ -30,22 +32,27 @@ import org.opensaml.saml.saml2.core.NameID;
import org.opensaml.saml.saml2.core.Subject;
import org.opensaml.saml.saml2.core.SubjectConfirmation;
+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.Subject}.
+ * Concrete implementation of {@link Subject}.
*/
public class SubjectImpl extends AbstractXMLObject implements Subject {
/** BaseID child element. */
- private BaseID baseID;
+ @Nullable private BaseID baseID;
/** NameID child element. */
- private NameID nameID;
+ @Nullable private NameID nameID;
/** EncryptedID child element. */
- private EncryptedID encryptedID;
+ @Nullable private EncryptedID encryptedID;
/** Subject Confirmations of the Subject. */
- private final XMLObjectChildrenList<SubjectConfirmation> subjectConfirmations;
+ @Nonnull private final XMLObjectChildrenList<SubjectConfirmation> subjectConfirmations;
/**
* Constructor.
@@ -54,48 +61,49 @@ 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);
subjectConfirmations = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public BaseID getBaseID() {
+ @Nullable public BaseID getBaseID() {
return baseID;
}
/** {@inheritDoc} */
- public void setBaseID(final BaseID newBaseID) {
+ public void setBaseID(@Nullable final BaseID newBaseID) {
baseID = prepareForAssignment(baseID, newBaseID);
}
/** {@inheritDoc} */
- public NameID getNameID() {
+ @Nullable public NameID getNameID() {
return nameID;
}
/** {@inheritDoc} */
- public void setNameID(final NameID newNameID) {
+ public void setNameID(@Nullable final NameID newNameID) {
nameID = prepareForAssignment(nameID, newNameID);
}
/** {@inheritDoc} */
- public EncryptedID getEncryptedID() {
+ @Nullable public EncryptedID getEncryptedID() {
return this.encryptedID;
}
/** {@inheritDoc} */
- public void setEncryptedID(final EncryptedID newEncryptedID) {
+ public void setEncryptedID(@Nullable final EncryptedID newEncryptedID) {
this.encryptedID = prepareForAssignment(this.encryptedID, newEncryptedID);
}
/** {@inheritDoc} */
- public List<SubjectConfirmation> getSubjectConfirmations() {
+ @Nonnull @Live public List<SubjectConfirmation> getSubjectConfirmations() {
return subjectConfirmations;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
if (baseID != null) {
@@ -112,6 +120,7 @@ public class SubjectImpl extends AbstractXMLObject implements Subject {
children.addAll(subjectConfirmations);
- 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/saml2/core/impl/SubjectLocalityImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectLocalityImpl.java
index cd5b8199a..666544972 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectLocalityImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectLocalityImpl.java
@@ -23,20 +23,26 @@ package org.opensaml.saml.saml2.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.saml2.core.SubjectLocality;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * A concrete implementation of {@link org.opensaml.saml.saml2.core.SubjectLocality}.
+ * A concrete implementation of {@link SubjectLocality}.
*/
public class SubjectLocalityImpl extends AbstractXMLObject implements SubjectLocality {
/** The Address of the assertion. */
- private String address;
+ @Nullable private String address;
/** The DNS Name of the assertion. */
- private String dnsName;
+ @Nullable private String dnsName;
/**
* Constructor.
@@ -45,33 +51,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 getAddress() {
+ @Nullable public String getAddress() {
return address;
}
/** {@inheritDoc} */
- public void setAddress(final String newAddress) {
+ public void setAddress(@Nullable final String newAddress) {
this.address = prepareForAssignment(this.address, newAddress);
}
/** {@inheritDoc} */
- public String getDNSName() {
+ @Nullable public String getDNSName() {
return dnsName;
}
/** {@inheritDoc} */
- public void setDNSName(final String newDNSName) {
+ public void setDNSName(@Nullable final String newDNSName) {
this.dnsName = prepareForAssignment(this.dnsName, newDNSName);
}
/** {@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/saml2/core/impl/SubjectQueryImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectQueryImpl.java
index 9253e0fcd..5f17d7d71 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectQueryImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/SubjectQueryImpl.java
@@ -22,15 +22,21 @@
package org.opensaml.saml.saml2.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.saml2.core.Subject;
import org.opensaml.saml.saml2.core.SubjectQuery;
+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.SubjectQuery}.
+ * Concrete implementation of {@link SubjectQuery}.
*/
public abstract class SubjectQueryImpl extends RequestAbstractTypeImpl implements SubjectQuery {
@@ -44,38 +50,38 @@ public abstract class SubjectQueryImpl extends RequestAbstractTypeImpl implement
* @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() {
- return this.subject;
+ @Nullable public Subject getSubject() {
+ return subject;
}
/**
* {@inheritDoc}
*/
- public void setSubject(final Subject newSubject) {
- this.subject = prepareForAssignment(this.subject, newSubject);
+ public void setSubject(@Nullable final Subject newSubject) {
+ subject = prepareForAssignment(subject, newSubject);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (super.getOrderedChildren() != null) {
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> superKids = super.getOrderedChildren();
+ if (superKids != null) {
+ children.addAll(superKids);
}
+
if (subject != null) {
children.add(subject);
}
- 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/saml2/core/impl/TerminateImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/TerminateImpl.java
index e6f5b1ea9..d44ac674e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/TerminateImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/core/impl/TerminateImpl.java
@@ -23,12 +23,18 @@ package org.opensaml.saml.saml2.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.saml2.core.Terminate;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.core.Terminate}.
+ * Concrete implementation of {@link Terminate}.
*/
public class TerminateImpl extends AbstractXMLObject implements Terminate {
@@ -39,13 +45,15 @@ public class TerminateImpl extends AbstractXMLObject implements Terminate {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected TerminateImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected TerminateImpl(@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() {
// no children
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateImpl.java
index f5b550f1e..4093dc43f 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RelayStateImpl.java
@@ -19,6 +19,9 @@ package org.opensaml.saml.saml2.ecp.impl;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.schema.XSBooleanValue;
import org.opensaml.core.xml.schema.impl.XSStringImpl;
@@ -26,16 +29,19 @@ import org.opensaml.saml.saml2.ecp.RelayState;
import org.opensaml.soap.soap11.ActorBearing;
import org.opensaml.soap.soap11.MustUnderstandBearing;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
* A concrete implementation of {@link RelayState}.
*/
public class RelayStateImpl extends XSStringImpl implements RelayState {
/** soap11:actor attribute. */
- private String soap11Actor;
+ @Nullable private String soap11Actor;
/** soap11:mustUnderstand. */
- private XSBooleanValue soap11MustUnderstand;
+ @Nullable private XSBooleanValue soap11MustUnderstand;
/**
* Constructor.
@@ -44,12 +50,13 @@ public class RelayStateImpl extends XSStringImpl implements RelayState {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RelayStateImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected RelayStateImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public Boolean isSOAP11MustUnderstand() {
+ @Nullable public Boolean isSOAP11MustUnderstand() {
if (soap11MustUnderstand != null) {
return soap11MustUnderstand.getValue();
}
@@ -57,12 +64,12 @@ public class RelayStateImpl extends XSStringImpl implements RelayState {
}
/** {@inheritDoc} */
- public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
+ @Nullable public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
return soap11MustUnderstand;
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final Boolean newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final Boolean newMustUnderstand) {
if (newMustUnderstand != null) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand,
new XSBooleanValue(newMustUnderstand, true));
@@ -74,26 +81,26 @@ public class RelayStateImpl extends XSStringImpl implements RelayState {
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final XSBooleanValue newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final XSBooleanValue newMustUnderstand) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
soap11MustUnderstand != null);
}
/** {@inheritDoc} */
- public String getSOAP11Actor() {
+ @Nullable public String getSOAP11Actor() {
return soap11Actor;
}
/** {@inheritDoc} */
- public void setSOAP11Actor(final String newActor) {
+ public void setSOAP11Actor(@Nullable final String newActor) {
soap11Actor = prepareForAssignment(soap11Actor, newActor);
manageQualifiedAttributeNamespace(ActorBearing.SOAP11_ACTOR_ATTR_NAME, soap11Actor != null);
}
/** {@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/saml2/ecp/impl/RequestAuthenticatedImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestAuthenticatedImpl.java
index 71f47c768..92093a96a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestAuthenticatedImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestAuthenticatedImpl.java
@@ -23,6 +23,9 @@ package org.opensaml.saml.saml2.ecp.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.core.xml.schema.XSBooleanValue;
@@ -30,6 +33,9 @@ import org.opensaml.saml.saml2.ecp.RequestAuthenticated;
import org.opensaml.soap.soap11.ActorBearing;
import org.opensaml.soap.soap11.MustUnderstandBearing;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
* Concrete implementation of {@link RequestAuthenticated}.
@@ -37,10 +43,10 @@ import org.opensaml.soap.soap11.MustUnderstandBearing;
public class RequestAuthenticatedImpl extends AbstractXMLObject implements RequestAuthenticated {
/** soap11:actor attribute. */
- private String soap11Actor;
+ @Nullable private String soap11Actor;
/** soap11:mustUnderstand. */
- private XSBooleanValue soap11MustUnderstand;
+ @Nullable private XSBooleanValue soap11MustUnderstand;
/**
* Constructor.
@@ -49,13 +55,13 @@ public class RequestAuthenticatedImpl extends AbstractXMLObject implements Reque
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RequestAuthenticatedImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected RequestAuthenticatedImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public Boolean isSOAP11MustUnderstand() {
+ @Nullable public Boolean isSOAP11MustUnderstand() {
if (soap11MustUnderstand != null) {
return soap11MustUnderstand.getValue();
}
@@ -63,12 +69,12 @@ public class RequestAuthenticatedImpl extends AbstractXMLObject implements Reque
}
/** {@inheritDoc} */
- public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
+ @Nullable public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
return soap11MustUnderstand;
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final Boolean newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final Boolean newMustUnderstand) {
if (newMustUnderstand != null) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand,
new XSBooleanValue(newMustUnderstand, true));
@@ -80,26 +86,27 @@ public class RequestAuthenticatedImpl extends AbstractXMLObject implements Reque
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final XSBooleanValue newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final XSBooleanValue newMustUnderstand) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
soap11MustUnderstand != null);
}
/** {@inheritDoc} */
- public String getSOAP11Actor() {
+ @Nullable public String getSOAP11Actor() {
return soap11Actor;
}
/** {@inheritDoc} */
- public void setSOAP11Actor(final String newActor) {
+ public void setSOAP11Actor(@Nullable final String newActor) {
soap11Actor = prepareForAssignment(soap11Actor, newActor);
manageQualifiedAttributeNamespace(ActorBearing.SOAP11_ACTOR_ATTR_NAME, soap11Actor != null);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
// no children
return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestImpl.java
index 1d8d78353..de91f92ff 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/RequestImpl.java
@@ -18,9 +18,11 @@
package org.opensaml.saml.saml2.ecp.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.schema.XSBooleanValue;
@@ -30,28 +32,32 @@ import org.opensaml.saml.saml2.ecp.Request;
import org.opensaml.soap.soap11.ActorBearing;
import org.opensaml.soap.soap11.MustUnderstandBearing;
+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 Request}.
*/
public class RequestImpl extends AbstractXMLObject implements Request {
/** IDPList child element. */
- private IDPList idpList;
+ @Nullable private IDPList idpList;
/** Issuer child element. */
- private Issuer issuer;
+ @Nullable private Issuer issuer;
/** ProviderName attribute. */
- private String providerName;
+ @Nullable private String providerName;
/** IsPassive attribute value. */
- private XSBooleanValue isPassive;
+ @Nullable private XSBooleanValue isPassive;
/** soap11:actor attribute. */
- private String soap11Actor;
+ @Nullable private String soap11Actor;
/** soap11:mustUnderstand. */
- private XSBooleanValue soap11MustUnderstand;
+ @Nullable private XSBooleanValue soap11MustUnderstand;
/**
* Constructor.
@@ -60,42 +66,43 @@ public class RequestImpl extends AbstractXMLObject 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);
}
/** {@inheritDoc} */
- public IDPList getIDPList() {
+ @Nullable public IDPList getIDPList() {
return idpList;
}
/** {@inheritDoc} */
- public void setIDPList(final IDPList newIDPList) {
+ public void setIDPList(@Nullable final IDPList newIDPList) {
idpList = prepareForAssignment(idpList, newIDPList);
}
/** {@inheritDoc} */
- public Issuer getIssuer() {
+ @Nullable public Issuer getIssuer() {
return issuer;
}
/** {@inheritDoc} */
- public void setIssuer(final Issuer newIssuer) {
+ public void setIssuer(@Nullable final Issuer newIssuer) {
issuer = prepareForAssignment(issuer, newIssuer);
}
/** {@inheritDoc} */
- public String getProviderName() {
+ @Nullable public String getProviderName() {
return providerName;
}
/** {@inheritDoc} */
- public void setProviderName(final String newProviderName) {
+ public void setProviderName(@Nullable final String newProviderName) {
providerName = prepareForAssignment(providerName, newProviderName);
}
/** {@inheritDoc} */
- public Boolean isPassive() {
+ @Nullable public Boolean isPassive() {
if (isPassive != null) {
return isPassive.getValue();
}
@@ -104,12 +111,12 @@ public class RequestImpl extends AbstractXMLObject implements Request {
}
/** {@inheritDoc} */
- public XSBooleanValue isPassiveXSBoolean() {
+ @Nullable public XSBooleanValue isPassiveXSBoolean() {
return isPassive;
}
/** {@inheritDoc} */
- public void setPassive(final Boolean newIsPassive) {
+ public void setPassive(@Nullable final Boolean newIsPassive) {
if (newIsPassive != null) {
isPassive = prepareForAssignment(isPassive, new XSBooleanValue(newIsPassive, false));
} else {
@@ -118,12 +125,12 @@ public class RequestImpl extends AbstractXMLObject implements Request {
}
/** {@inheritDoc} */
- public void setPassive(final XSBooleanValue newIsPassive) {
+ public void setPassive(@Nullable final XSBooleanValue newIsPassive) {
this.isPassive = prepareForAssignment(this.isPassive, newIsPassive);
}
/** {@inheritDoc} */
- public Boolean isSOAP11MustUnderstand() {
+ @Nullable public Boolean isSOAP11MustUnderstand() {
if (soap11MustUnderstand != null) {
return soap11MustUnderstand.getValue();
}
@@ -131,12 +138,12 @@ public class RequestImpl extends AbstractXMLObject implements Request {
}
/** {@inheritDoc} */
- public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
+ @Nullable public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
return soap11MustUnderstand;
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final Boolean newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final Boolean newMustUnderstand) {
if (newMustUnderstand != null) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand,
new XSBooleanValue(newMustUnderstand, true));
@@ -148,33 +155,36 @@ public class RequestImpl extends AbstractXMLObject implements Request {
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final XSBooleanValue newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final XSBooleanValue newMustUnderstand) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
soap11MustUnderstand != null);
}
/** {@inheritDoc} */
- public String getSOAP11Actor() {
+ @Nullable public String getSOAP11Actor() {
return soap11Actor;
}
/** {@inheritDoc} */
- public void setSOAP11Actor(final String newActor) {
+ public void setSOAP11Actor(@Nullable final String newActor) {
soap11Actor = prepareForAssignment(soap11Actor, newActor);
manageQualifiedAttributeNamespace(ActorBearing.SOAP11_ACTOR_ATTR_NAME, soap11Actor != null);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (issuer!=null) {
+
+ if (issuer != null) {
children.add(issuer);
}
- if (idpList!=null) {
+
+ if (idpList != null) {
children.add(idpList);
}
- 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/saml2/ecp/impl/ResponseImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/ResponseImpl.java
index 8804a4bd1..f33b52d5e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/ResponseImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/ResponseImpl.java
@@ -19,6 +19,9 @@ package org.opensaml.saml.saml2.ecp.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.core.xml.schema.XSBooleanValue;
@@ -26,19 +29,22 @@ import org.opensaml.saml.saml2.ecp.Response;
import org.opensaml.soap.soap11.ActorBearing;
import org.opensaml.soap.soap11.MustUnderstandBearing;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
* A concrete implementation of {@link Response}.
*/
public class ResponseImpl extends AbstractXMLObject implements Response {
/** soap11:actor attribute. */
- private String soap11Actor;
+ @Nullable private String soap11Actor;
/** soap11:mustUnderstand. */
- private XSBooleanValue soap11MustUnderstand;
+ @Nullable private XSBooleanValue soap11MustUnderstand;
/** The AssertionConsumerServiceURL attribute value. */
- private String acsURL;
+ @Nullable private String acsURL;
/**
* Constructor.
@@ -47,22 +53,23 @@ public class ResponseImpl extends AbstractXMLObject 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);
}
/** {@inheritDoc} */
- public String getAssertionConsumerServiceURL() {
+ @Nullable public String getAssertionConsumerServiceURL() {
return acsURL;
}
/** {@inheritDoc} */
- public void setAssertionConsumerServiceURL(final String newAssertionConsumerServiceURL) {
+ public void setAssertionConsumerServiceURL(@Nullable final String newAssertionConsumerServiceURL) {
acsURL = prepareForAssignment(acsURL, newAssertionConsumerServiceURL);
}
/** {@inheritDoc} */
- public Boolean isSOAP11MustUnderstand() {
+ @Nullable public Boolean isSOAP11MustUnderstand() {
if (soap11MustUnderstand != null) {
return soap11MustUnderstand.getValue();
}
@@ -70,12 +77,12 @@ public class ResponseImpl extends AbstractXMLObject implements Response {
}
/** {@inheritDoc} */
- public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
+ @Nullable public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
return soap11MustUnderstand;
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final Boolean newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final Boolean newMustUnderstand) {
if (newMustUnderstand != null) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand,
new XSBooleanValue(newMustUnderstand, true));
@@ -87,26 +94,26 @@ public class ResponseImpl extends AbstractXMLObject implements Response {
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final XSBooleanValue newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final XSBooleanValue newMustUnderstand) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
soap11MustUnderstand != null);
}
/** {@inheritDoc} */
- public String getSOAP11Actor() {
+ @Nullable public String getSOAP11Actor() {
return soap11Actor;
}
/** {@inheritDoc} */
- public void setSOAP11Actor(final String newActor) {
+ public void setSOAP11Actor(@Nullable final String newActor) {
soap11Actor = prepareForAssignment(soap11Actor, newActor);
manageQualifiedAttributeNamespace(ActorBearing.SOAP11_ACTOR_ATTR_NAME, soap11Actor != null);
}
/** {@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/saml2/ecp/impl/SubjectConfirmationImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/SubjectConfirmationImpl.java
index 722813543..c0a4d3207 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/SubjectConfirmationImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/ecp/impl/SubjectConfirmationImpl.java
@@ -17,10 +17,11 @@
package org.opensaml.saml.saml2.ecp.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.schema.XSBooleanValue;
@@ -29,6 +30,10 @@ import org.opensaml.saml.saml2.ecp.SubjectConfirmation;
import org.opensaml.soap.soap11.ActorBearing;
import org.opensaml.soap.soap11.MustUnderstandBearing;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
* Concrete implementation of {@link SubjectConfirmation}.
@@ -36,16 +41,16 @@ import org.opensaml.soap.soap11.MustUnderstandBearing;
public class SubjectConfirmationImpl extends AbstractXMLObject implements SubjectConfirmation {
/** soap11:actor attribute. */
- private String soap11Actor;
+ @Nullable private String soap11Actor;
/** soap11:mustUnderstand. */
- private XSBooleanValue soap11MustUnderstand;
+ @Nullable private XSBooleanValue soap11MustUnderstand;
/** Method of the Confirmation. */
- private String method;
+ @Nullable private String method;
/** SubjectConfirmationData of the Confirmation. */
- private SubjectConfirmationData subjectConfirmationData;
+ @Nullable private SubjectConfirmationData subjectConfirmationData;
/**
* Constructor.
@@ -54,13 +59,13 @@ 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);
}
/** {@inheritDoc} */
- public Boolean isSOAP11MustUnderstand() {
+ @Nullable public Boolean isSOAP11MustUnderstand() {
if (soap11MustUnderstand != null) {
return soap11MustUnderstand.getValue();
}
@@ -68,12 +73,12 @@ public class SubjectConfirmationImpl extends AbstractXMLObject implements Subjec
}
/** {@inheritDoc} */
- public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
+ @Nullable public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
return soap11MustUnderstand;
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final Boolean newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final Boolean newMustUnderstand) {
if (newMustUnderstand != null) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand,
new XSBooleanValue(newMustUnderstand, true));
@@ -85,52 +90,52 @@ public class SubjectConfirmationImpl extends AbstractXMLObject implements Subjec
}
/** {@inheritDoc} */
- public void setSOAP11MustUnderstand(final XSBooleanValue newMustUnderstand) {
+ public void setSOAP11MustUnderstand(@Nullable final XSBooleanValue newMustUnderstand) {
soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
manageQualifiedAttributeNamespace(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
soap11MustUnderstand != null);
}
/** {@inheritDoc} */
- public String getSOAP11Actor() {
+ @Nullable public String getSOAP11Actor() {
return soap11Actor;
}
/** {@inheritDoc} */
- public void setSOAP11Actor(final String newActor) {
+ public void setSOAP11Actor(@Nullable final String newActor) {
soap11Actor = prepareForAssignment(soap11Actor, newActor);
manageQualifiedAttributeNamespace(ActorBearing.SOAP11_ACTOR_ATTR_NAME, soap11Actor != null);
}
/** {@inheritDoc} */
- public String getMethod() {
+ @Nullable public String getMethod() {
return method;
}
/** {@inheritDoc} */
- public void setMethod(final String newMethod) {
+ public void setMethod(@Nullable final String newMethod) {
method = prepareForAssignment(method, newMethod);
}
/** {@inheritDoc} */
- public SubjectConfirmationData getSubjectConfirmationData() {
+ @Nullable public SubjectConfirmationData getSubjectConfirmationData() {
return subjectConfirmationData;
}
/** {@inheritDoc} */
- public void setSubjectConfirmationData(final SubjectConfirmationData newSubjectConfirmationData) {
+ public void setSubjectConfirmationData(@Nullable final SubjectConfirmationData newSubjectConfirmationData) {
subjectConfirmationData = prepareForAssignment(subjectConfirmationData, newSubjectConfirmationData);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
- final ArrayList<XMLObject> children = new ArrayList<>();
-
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
+
if (subjectConfirmationData != null) {
- children.add(subjectConfirmationData);
+ return CollectionSupport.singletonList(subjectConfirmationData);
}
- return Collections.unmodifiableList(children);
+ return null;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AdditionalMetadataLocationImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AdditionalMetadataLocationImpl.java
index 31b659472..7f4072a17 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AdditionalMetadataLocationImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AdditionalMetadataLocationImpl.java
@@ -17,6 +17,7 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensaml.core.xml.schema.impl.XSURIImpl;
@@ -37,8 +38,8 @@ public class AdditionalMetadataLocationImpl extends XSURIImpl implements Additio
* @param elementLocalName the local name
* @param namespacePrefix the prefix name space
*/
- protected AdditionalMetadataLocationImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AdditionalMetadataLocationImpl(@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/saml2/metadata/impl/AffiliateMemberImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliateMemberImpl.java
index ea6205165..994a31eb0 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliateMemberImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliateMemberImpl.java
@@ -17,13 +17,14 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.metadata.AffiliateMember;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.AffiliateMember}.
+ * Concrete implementation of {@link AffiliateMember}.
*/
public class AffiliateMemberImpl extends XSURIImpl implements AffiliateMember {
@@ -34,8 +35,8 @@ public class AffiliateMemberImpl extends XSURIImpl implements AffiliateMember {
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AffiliateMemberImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AffiliateMemberImpl(@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/saml2/metadata/impl/AffiliationDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorImpl.java
index d21941163..e09a9de7a 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AffiliationDescriptorImpl.java
@@ -26,6 +26,9 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.AttributeMap;
import org.opensaml.core.xml.util.XMLObjectChildrenList;
@@ -34,37 +37,41 @@ import org.opensaml.saml.saml2.metadata.Extensions;
import org.opensaml.saml.saml2.metadata.AffiliateMember;
import org.opensaml.saml.saml2.metadata.AffiliationDescriptor;
import org.opensaml.saml.saml2.metadata.KeyDescriptor;
+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;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.AffiliationDescriptor}.
+ * Concrete implementation of {@link AffiliationDescriptor}.
*/
public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implements AffiliationDescriptor {
/** ID of the owner of this affiliation. */
- private String ownerID;
+ @Nullable private String ownerID;
/** ID attribute. */
- private String id;
+ @Nullable private String id;
/** validUntil attribute. */
- private Instant validUntil;
+ @Nullable private Instant validUntil;
/** cacheDurection attribute. */
- private Duration cacheDuration;
+ @Nullable private Duration cacheDuration;
/** Extensions child. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/** "anyAttribute" attributes. */
- private final AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/** Members of this affiliation. */
- private final XMLObjectChildrenList<AffiliateMember> members;
+ @Nonnull private final XMLObjectChildrenList<AffiliateMember> members;
/** Key descriptors for this role. */
- private final XMLObjectChildrenList<KeyDescriptor> keyDescriptors;
+ @Nonnull private final XMLObjectChildrenList<KeyDescriptor> keyDescriptors;
/**
* Constructor.
@@ -73,8 +80,8 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
* @param elementLocalName localname
* @param namespacePrefix prefix
*/
- protected AffiliationDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AffiliationDescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownAttributes = new AttributeMap(this);
members = new XMLObjectChildrenList<>(this);
@@ -82,12 +89,12 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
}
/** {@inheritDoc} */
- public String getOwnerID() {
+ @Nullable public String getOwnerID() {
return ownerID;
}
/** {@inheritDoc} */
- public void setOwnerID(final String newOwnerID) {
+ public void setOwnerID(@Nullable final String newOwnerID) {
if (newOwnerID != null && newOwnerID.length() > 1024) {
throw new IllegalArgumentException("Owner ID can not exceed 1024 characters in length");
}
@@ -95,12 +102,12 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
}
/** {@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;
this.id = prepareForAssignment(id, newID);
registerOwnID(oldID, id);
@@ -116,71 +123,71 @@ public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implem
}
/** {@inheritDoc} */
- public Instant getValidUntil() {
+ @Nullable public Instant getValidUntil() {
return validUntil;
}
/** {@inheritDoc} */
- public void setValidUntil(final Instant theValidUntil) {
+ public void setValidUntil(@Nullable final Instant theValidUntil) {
validUntil = prepareForAssignment(validUntil, theValidUntil);
}
/** {@inheritDoc} */
- public Duration getCacheDuration() {
+ @Nullable public Duration getCacheDuration() {
return cacheDuration;
}
/** {@inheritDoc} */
- public void setCacheDuration(final Duration duration) {
+ public void setCacheDuration(@Nullable final Duration duration) {
cacheDuration = prepareForAssignment(cacheDuration, duration);
}
/** {@inheritDoc} */
- public Extensions getExtensions() {
+ @Nullable public Extensions getExtensions() {
return extensions;
}
/** {@inheritDoc} */
- public void setExtensions(final Extensions theExtensions) {
+ public void setExtensions(@Nullable final Extensions theExtensions) {
extensions = prepareForAssignment(extensions, theExtensions);
}
/** {@inheritDoc} */
- public List<AffiliateMember> getMembers() {
+ @Nonnull @Live public List<AffiliateMember> getMembers() {
return members;
}
/** {@inheritDoc} */
- public List<KeyDescriptor> getKeyDescriptors() {
+ @Nonnull @Live public List<KeyDescriptor> getKeyDescriptors() {
return keyDescriptors;
}
/** {@inheritDoc} */
- public AttributeMap getUnknownAttributes() {
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/** {@inheritDoc} */
@Override
- public String getSignatureReferenceID(){
+ @Nullable public String getSignatureReferenceID() {
return id;
}
/** {@inheritDoc} */
@Override
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if(getSignature() != null){
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
- if (getExtensions() != null) {
- children.add(getExtensions());
+ if (extensions != null) {
+ children.add(extensions);
}
children.addAll(getMembers());
-
children.addAll(getKeyDescriptors());
return CollectionSupport.copyToList(children);
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ArtifactResolutionServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ArtifactResolutionServiceImpl.java
index dd81620e4..80e9b70e3 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ArtifactResolutionServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ArtifactResolutionServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.ArtifactResolutionService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.ArtifactResolutionService}.
+ * Concrete implementation of {@link ArtifactResolutionService}.
*/
public class ArtifactResolutionServiceImpl extends IndexedEndpointImpl implements ArtifactResolutionService {
@@ -35,8 +38,9 @@ public class ArtifactResolutionServiceImpl extends IndexedEndpointImpl implement
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected ArtifactResolutionServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ArtifactResolutionServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionConsumerServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionConsumerServiceImpl.java
index 668b64c2f..7e9511cc1 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionConsumerServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionConsumerServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.AssertionConsumerService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.AssertionConsumerService}.
+ * Concrete implementation of {@link AssertionConsumerService}.
*/
public class AssertionConsumerServiceImpl extends IndexedEndpointImpl implements AssertionConsumerService {
@@ -35,8 +38,9 @@ public class AssertionConsumerServiceImpl extends IndexedEndpointImpl implements
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AssertionConsumerServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AssertionConsumerServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionIDRequestServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionIDRequestServiceImpl.java
index 8d5ab3b4b..ee4af7517 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionIDRequestServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AssertionIDRequestServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.AssertionIDRequestService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.AssertionIDRequestService}.
+ * Concrete implementation of {@link AssertionIDRequestService}.
*/
public class AssertionIDRequestServiceImpl extends EndpointImpl implements AssertionIDRequestService {
@@ -35,8 +38,9 @@ public class AssertionIDRequestServiceImpl extends EndpointImpl implements Asser
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AssertionIDRequestServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AssertionIDRequestServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorImpl.java
index e1d787545..52453802e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorImpl.java
@@ -18,9 +18,10 @@
package org.opensaml.saml.saml2.metadata.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.XMLObject;
@@ -33,27 +34,30 @@ import org.opensaml.saml.saml2.metadata.AttributeService;
import org.opensaml.saml.saml2.metadata.Endpoint;
import org.opensaml.saml.saml2.metadata.NameIDFormat;
+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.saml2.metadata.AttributeAuthorityDescriptor}.
+ * A concrete implementation of {@link AttributeAuthorityDescriptor}.
*/
public class AttributeAuthorityDescriptorImpl extends RoleDescriptorImpl implements AttributeAuthorityDescriptor {
/** Attribte query endpoints. */
- private final XMLObjectChildrenList<AttributeService> attributeServices;
+ @Nonnull private final XMLObjectChildrenList<AttributeService> attributeServices;
/** Assertion request endpoints. */
- private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
+ @Nonnull private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
/** Supported NameID formats. */
- private final XMLObjectChildrenList<NameIDFormat> nameFormats;
+ @Nonnull private final XMLObjectChildrenList<NameIDFormat> nameFormats;
/** Supported attribute profiles. */
- private final XMLObjectChildrenList<AttributeProfile> attributeProfiles;
+ @Nonnull private final XMLObjectChildrenList<AttributeProfile> attributeProfiles;
/** Supported attribute. */
- private final XMLObjectChildrenList<Attribute> attributes;
+ @Nonnull private final XMLObjectChildrenList<Attribute> attributes;
/**
* Constructor.
@@ -62,8 +66,8 @@ public class AttributeAuthorityDescriptorImpl extends RoleDescriptorImpl impleme
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AttributeAuthorityDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AttributeAuthorityDescriptorImpl(@Nullable final String namespaceURI,
+ @Nonnull final String elementLocalName, @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
attributeServices = new XMLObjectChildrenList<>(this);
assertionIDRequestServices = new XMLObjectChildrenList<>(this);
@@ -73,51 +77,52 @@ public class AttributeAuthorityDescriptorImpl extends RoleDescriptorImpl impleme
}
/** {@inheritDoc} */
- public List<AttributeService> getAttributeServices() {
+ @Nonnull @Live public List<AttributeService> getAttributeServices() {
return attributeServices;
}
/** {@inheritDoc} */
- public List<AssertionIDRequestService> getAssertionIDRequestServices() {
+ @Nonnull @Live public List<AssertionIDRequestService> getAssertionIDRequestServices() {
return assertionIDRequestServices;
}
/** {@inheritDoc} */
- public List<NameIDFormat> getNameIDFormats() {
+ @Nonnull @Live public List<NameIDFormat> getNameIDFormats() {
return nameFormats;
}
/** {@inheritDoc} */
- public List<AttributeProfile> getAttributeProfiles() {
+ @Nonnull @Live public List<AttributeProfile> getAttributeProfiles() {
return attributeProfiles;
}
/** {@inheritDoc} */
- public List<Attribute> getAttributes() {
+ @Nonnull @Live public List<Attribute> getAttributes() {
return attributes;
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints() {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints() {
final List<Endpoint> endpoints = new ArrayList<>();
endpoints.addAll(attributeServices);
endpoints.addAll(assertionIDRequestServices);
- return Collections.unmodifiableList(endpoints);
+ return CollectionSupport.copyToList(endpoints);
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints(final QName type) {
- if(type.equals(AttributeService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(attributeServices));
- }else if(type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(assertionIDRequestServices));
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints(@Nonnull final QName type) {
+ if (type.equals(AttributeService.DEFAULT_ELEMENT_NAME)) {
+ return CollectionSupport.copyToList(attributeServices);
+ } else if (type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)) {
+ return CollectionSupport.copyToList(assertionIDRequestServices);
}
- return null;
+ return CollectionSupport.emptyList();
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
final List<XMLObject> parentChildren = super.getOrderedChildren();
@@ -133,4 +138,5 @@ public class AttributeAuthorityDescriptorImpl extends RoleDescriptorImpl impleme
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeConsumingServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeConsumingServiceImpl.java
index 50f52ca03..f492ab47d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeConsumingServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeConsumingServiceImpl.java
@@ -22,9 +22,9 @@
package org.opensaml.saml.saml2.metadata.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;
@@ -36,25 +36,30 @@ import org.opensaml.saml.saml2.metadata.RequestedAttribute;
import org.opensaml.saml.saml2.metadata.ServiceDescription;
import org.opensaml.saml.saml2.metadata.ServiceName;
+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.metadata.AttributeConsumingService}.
+ * Concrete implementation of {@link AttributeConsumingService}.
*/
public class AttributeConsumingServiceImpl extends AbstractXMLObject implements AttributeConsumingService {
/** Index of this service. */
- private Integer index;
+ @Nullable private Integer index;
/** isDefault attribute of this service. */
- private XSBooleanValue isDefault;
+ @Nullable private XSBooleanValue isDefault;
/** ServiceName children. */
- private final XMLObjectChildrenList<ServiceName> serviceNames;
+ @Nonnull private final XMLObjectChildrenList<ServiceName> serviceNames;
/** ServiceDescription children. */
- private final XMLObjectChildrenList<ServiceDescription> serviceDescriptions;
+ @Nonnull private final XMLObjectChildrenList<ServiceDescription> serviceDescriptions;
/** RequestedAttribute children. */
- private final XMLObjectChildrenList<RequestedAttribute> requestedAttributes;
+ @Nonnull private final XMLObjectChildrenList<RequestedAttribute> requestedAttributes;
/**
* Constructor.
@@ -63,8 +68,8 @@ public class AttributeConsumingServiceImpl extends AbstractXMLObject implements
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AttributeConsumingServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AttributeConsumingServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
serviceNames = new XMLObjectChildrenList<>(this);
serviceDescriptions = new XMLObjectChildrenList<>(this);
@@ -72,7 +77,7 @@ public class AttributeConsumingServiceImpl extends AbstractXMLObject implements
}
/** {@inheritDoc} */
- public Integer getIndex() {
+ @Nullable public Integer getIndex() {
return index;
}
@@ -82,7 +87,7 @@ public class AttributeConsumingServiceImpl extends AbstractXMLObject implements
}
/** {@inheritDoc} */
- public Boolean isDefault(){
+ @Nullable public Boolean isDefault(){
if(isDefault != null){
return isDefault.getValue();
}
@@ -91,12 +96,12 @@ public class AttributeConsumingServiceImpl extends AbstractXMLObject implements
}
/** {@inheritDoc} */
- public XSBooleanValue isDefaultXSBoolean() {
+ @Nullable public XSBooleanValue isDefaultXSBoolean() {
return isDefault;
}
/** {@inheritDoc} */
- public void setIsDefault(final Boolean newIsDefault){
+ public void setIsDefault(@Nullable final Boolean newIsDefault){
if(newIsDefault != null){
isDefault = prepareForAssignment(isDefault, new XSBooleanValue(newIsDefault, false));
}else{
@@ -105,33 +110,34 @@ public class AttributeConsumingServiceImpl extends AbstractXMLObject implements
}
/** {@inheritDoc} */
- public void setIsDefault(final XSBooleanValue newIsDefault) {
+ public void setIsDefault(@Nullable final XSBooleanValue newIsDefault) {
isDefault = prepareForAssignment(isDefault, newIsDefault);
}
/** {@inheritDoc} */
- public List<ServiceName> getNames() {
+ @Nonnull @Live public List<ServiceName> getNames() {
return serviceNames;
}
/** {@inheritDoc} */
- public List<ServiceDescription> getDescriptions() {
+ @Nonnull @Live public List<ServiceDescription> getDescriptions() {
return serviceDescriptions;
}
/** {@inheritDoc} */
- public List<RequestedAttribute> getRequestedAttributes() {
+ @Nonnull @Live public List<RequestedAttribute> getRequestedAttributes() {
return requestedAttributes;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
children.addAll(serviceNames);
children.addAll(serviceDescriptions);
children.addAll(requestedAttributes);
- 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/saml2/metadata/impl/AttributeProfileImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeProfileImpl.java
index 45b899f6c..725704d6d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeProfileImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeProfileImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.metadata.AttributeProfile;
@@ -36,8 +39,8 @@ public class AttributeProfileImpl extends XSURIImpl implements AttributeProfile
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AttributeProfileImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AttributeProfileImpl(@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/saml2/metadata/impl/AttributeServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeServiceImpl.java
index 31d4a8131..2d0d391ef 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AttributeServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.AttributeService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.AttributeService}.
+ * Concrete implementation of {@link AttributeService}.
*/
public class AttributeServiceImpl extends EndpointImpl implements AttributeService {
@@ -35,8 +38,9 @@ public class AttributeServiceImpl extends EndpointImpl implements AttributeServi
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AttributeServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AttributeServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorImpl.java
index 0061a8521..979b97963 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorImpl.java
@@ -18,9 +18,10 @@
package org.opensaml.saml.saml2.metadata.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.XMLObject;
@@ -31,21 +32,24 @@ import org.opensaml.saml.saml2.metadata.AuthnQueryService;
import org.opensaml.saml.saml2.metadata.Endpoint;
import org.opensaml.saml.saml2.metadata.NameIDFormat;
+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.metadata.AuthnAuthorityDescriptor}.
+ * Concrete implementation of {@link AuthnAuthorityDescriptor}.
*/
public class AuthnAuthorityDescriptorImpl extends RoleDescriptorImpl implements AuthnAuthorityDescriptor {
/** AuthnQueryService endpoints. */
- private final XMLObjectChildrenList<AuthnQueryService> authnQueryServices;
+ @Nonnull private final XMLObjectChildrenList<AuthnQueryService> authnQueryServices;
/** AuthnQueryService endpoints. */
- private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
+ @Nonnull private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
/** NameID formats supported by this descriptor. */
- private final XMLObjectChildrenList<NameIDFormat> nameIDFormats;
+ @Nonnull private final XMLObjectChildrenList<NameIDFormat> nameIDFormats;
/**
* Constructor .
@@ -54,8 +58,8 @@ public class AuthnAuthorityDescriptorImpl extends RoleDescriptorImpl implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected AuthnAuthorityDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthnAuthorityDescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
authnQueryServices = new XMLObjectChildrenList<>(this);
assertionIDRequestServices = new XMLObjectChildrenList<>(this);
@@ -63,41 +67,42 @@ public class AuthnAuthorityDescriptorImpl extends RoleDescriptorImpl implements
}
/** {@inheritDoc} */
- public List<AuthnQueryService> getAuthnQueryServices() {
+ @Nonnull @Live public List<AuthnQueryService> getAuthnQueryServices() {
return authnQueryServices;
}
/** {@inheritDoc} */
- public List<AssertionIDRequestService> getAssertionIDRequestServices() {
+ @Nonnull @Live public List<AssertionIDRequestService> getAssertionIDRequestServices() {
return assertionIDRequestServices;
}
/** {@inheritDoc} */
- public List<NameIDFormat> getNameIDFormats() {
+ @Nonnull @Live public List<NameIDFormat> getNameIDFormats() {
return nameIDFormats;
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints() {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints() {
final List<Endpoint> endpoints = new ArrayList<>();
endpoints.addAll(authnQueryServices);
endpoints.addAll(assertionIDRequestServices);
- return Collections.unmodifiableList(endpoints);
+ return CollectionSupport.copyToList(endpoints);
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints(final QName type) {
- if(type.equals(AuthnQueryService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(authnQueryServices));
- }else if(type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(assertionIDRequestServices));
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints(@Nonnull final QName type) {
+ if (type.equals(AuthnQueryService.DEFAULT_ELEMENT_NAME)) {
+ return CollectionSupport.copyToList(authnQueryServices);
+ } else if (type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)) {
+ return CollectionSupport.copyToList(assertionIDRequestServices);
}
- return null;
+ return CollectionSupport.emptyList();
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
final List<XMLObject> parentChildren = super.getOrderedChildren();
@@ -111,4 +116,5 @@ public class AuthnAuthorityDescriptorImpl extends RoleDescriptorImpl implements
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnQueryServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnQueryServiceImpl.java
index 7803f5b9c..3ab341f97 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnQueryServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthnQueryServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.AuthnQueryService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.AuthnQueryService}.
+ * Concrete implementation of {@link AuthnQueryService}.
*/
public class AuthnQueryServiceImpl extends EndpointImpl implements AuthnQueryService {
@@ -35,8 +38,9 @@ public class AuthnQueryServiceImpl extends EndpointImpl implements AuthnQuerySer
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AuthnQueryServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected AuthnQueryServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthzServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthzServiceImpl.java
index 28e2971c9..7a39478ef 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthzServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/AuthzServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.AuthzService;
/**
- * Concrete implmentation of {@link org.opensaml.saml.saml2.metadata.AuthzService}.
+ * Concrete implmentation of {@link AuthzService}.
*/
public class AuthzServiceImpl extends EndpointImpl implements AuthzService {
@@ -35,7 +38,9 @@ public class AuthzServiceImpl extends EndpointImpl implements AuthzService {
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected AuthzServiceImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected AuthzServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/CompanyImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/CompanyImpl.java
index 523797f3f..f5f801ecb 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/CompanyImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/CompanyImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.metadata.Company;
@@ -36,7 +39,8 @@ public class CompanyImpl extends XSStringImpl implements Company {
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected CompanyImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected CompanyImpl(@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/saml2/metadata/impl/ContactPersonImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ContactPersonImpl.java
index 6087c12d7..a2d005049 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ContactPersonImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ContactPersonImpl.java
@@ -24,6 +24,9 @@ package org.opensaml.saml.saml2.metadata.impl;
import java.util.ArrayList;
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.AttributeMap;
@@ -37,36 +40,39 @@ import org.opensaml.saml.saml2.metadata.GivenName;
import org.opensaml.saml.saml2.metadata.SurName;
import org.opensaml.saml.saml2.metadata.TelephoneNumber;
+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.metadata.ContactPerson}.
+ * Concrete implementation of {@link ContactPerson}.
*/
public class ContactPersonImpl extends AbstractXMLObject implements ContactPerson {
/** Contact person type. */
- private ContactPersonTypeEnumeration type;
+ @Nullable private ContactPersonTypeEnumeration type;
/** Extensions child object. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/** Company child element. */
- private Company company;
+ @Nullable private Company company;
/** GivenName child objectobject. */
- private GivenName givenName;
+ @Nullable private GivenName givenName;
/** SurName child object. */
- private SurName surName;
+ @Nullable private SurName surName;
/** "anyAttribute" attributes. */
- private final AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/** Child email address. */
- private final XMLObjectChildrenList<EmailAddress> emailAddresses;
+ @Nonnull private final XMLObjectChildrenList<EmailAddress> emailAddresses;
/** Child telephone numbers. */
- private final XMLObjectChildrenList<TelephoneNumber> telephoneNumbers;
+ @Nonnull private final XMLObjectChildrenList<TelephoneNumber> telephoneNumbers;
/**
* Constructor.
@@ -75,8 +81,8 @@ public class ContactPersonImpl extends AbstractXMLObject implements ContactPerso
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected ContactPersonImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ContactPersonImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownAttributes = new AttributeMap(this);
emailAddresses = new XMLObjectChildrenList<>(this);
@@ -84,86 +90,72 @@ public class ContactPersonImpl extends AbstractXMLObject implements ContactPerso
}
/** {@inheritDoc} */
- @Override
- public ContactPersonTypeEnumeration getType() {
+ @Nullable public ContactPersonTypeEnumeration getType() {
return type;
}
/** {@inheritDoc} */
- @Override
- public void setType(final ContactPersonTypeEnumeration theType) {
- this.type = prepareForAssignment(this.type, theType);
+ public void setType(@Nullable final ContactPersonTypeEnumeration theType) {
+ type = prepareForAssignment(type, theType);
}
/** {@inheritDoc} */
- @Override
- public Extensions getExtensions() {
+ @Nullable public Extensions getExtensions() {
return extensions;
}
/** {@inheritDoc} */
- @Override
- public void setExtensions(final Extensions theExtensions) {
- this.extensions = prepareForAssignment(this.extensions, theExtensions);
+ public void setExtensions(@Nullable final Extensions theExtensions) {
+ extensions = prepareForAssignment(extensions, theExtensions);
}
/** {@inheritDoc} */
- @Override
- public Company getCompany() {
+ @Nullable public Company getCompany() {
return company;
}
/** {@inheritDoc} */
- @Override
- public void setCompany(final Company theCompany) {
- this.company = prepareForAssignment(this.company, theCompany);
+ public void setCompany(@Nullable final Company theCompany) {
+ company = prepareForAssignment(company, theCompany);
}
/** {@inheritDoc} */
- @Override
- public GivenName getGivenName() {
+ @Nullable public GivenName getGivenName() {
return givenName;
}
/** {@inheritDoc} */
- @Override
- public void setGivenName(final GivenName name) {
+ public void setGivenName(@Nullable final GivenName name) {
givenName = prepareForAssignment(givenName, name);
}
/** {@inheritDoc} */
- @Override
- public SurName getSurName() {
+ @Nullable public SurName getSurName() {
return surName;
}
/** {@inheritDoc} */
- @Override
- public void setSurName(final SurName name) {
+ public void setSurName(@Nullable final SurName name) {
surName = prepareForAssignment(surName, name);
}
/** {@inheritDoc} */
- @Override
- public List<EmailAddress> getEmailAddresses() {
+ @Nonnull @Live public List<EmailAddress> getEmailAddresses() {
return emailAddresses;
}
/** {@inheritDoc} */
- @Override
- public List<TelephoneNumber> getTelephoneNumbers() {
+ @Nonnull @Live public List<TelephoneNumber> getTelephoneNumbers() {
return telephoneNumbers;
}
/** {@inheritDoc} */
- @Override
- public AttributeMap getUnknownAttributes() {
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/** {@inheritDoc} */
- @Override
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
if (extensions != null) {
@@ -187,4 +179,5 @@ public class ContactPersonImpl extends AbstractXMLObject implements ContactPerso
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EmailAddressImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EmailAddressImpl.java
index fe4527e1b..ea1441c81 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EmailAddressImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EmailAddressImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.metadata.EmailAddress;
@@ -36,7 +39,8 @@ public class EmailAddressImpl extends XSURIImpl implements EmailAddress {
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected EmailAddressImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected EmailAddressImpl(@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/saml2/metadata/impl/EncryptionMethodImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EncryptionMethodImpl.java
index 11c1fae81..1639b2734 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EncryptionMethodImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EncryptionMethodImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.EncryptionMethod;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.EncryptionMethod}.
+ * Concrete implementation of {@link EncryptionMethod}.
*/
public class EncryptionMethodImpl extends org.opensaml.xmlsec.encryption.impl.EncryptionMethodImpl implements
EncryptionMethod {
@@ -36,8 +39,8 @@ public class EncryptionMethodImpl extends org.opensaml.xmlsec.encryption.impl.En
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected EncryptionMethodImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected EncryptionMethodImpl(@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/saml2/metadata/impl/EndpointImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EndpointImpl.java
index 917bbcd80..9f3985769 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EndpointImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EndpointImpl.java
@@ -17,9 +17,10 @@
package org.opensaml.saml.saml2.metadata.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;
@@ -28,25 +29,30 @@ import org.opensaml.core.xml.util.AttributeMap;
import org.opensaml.core.xml.util.IndexedXMLObjectChildrenList;
import org.opensaml.saml.saml2.metadata.Endpoint;
+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.saml2.metadata.Endpoint}.
+ * A concrete implementation of {@link Endpoint}.
*/
public abstract class EndpointImpl extends AbstractXMLObject implements Endpoint {
/** Binding URI. */
- private String bindingId;
+ @Nullable private String bindingId;
/** Endpoint location URI. */
- private String location;
+ @Nullable private String location;
/** Response location URI. */
- private String responseLocation;
+ @Nullable private String responseLocation;
/** "anyAttribute" attributes. */
- private final AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/** child "any" elements. */
- private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
/**
* Constructor.
@@ -55,65 +61,66 @@ public abstract class EndpointImpl extends AbstractXMLObject implements Endpoint
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EndpointImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected EndpointImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownAttributes = new AttributeMap(this);
unknownChildren = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getBinding() {
+ @Nullable public String getBinding() {
return bindingId;
}
/** {@inheritDoc} */
- public void setBinding(final String binding) {
+ public void setBinding(@Nullable final String binding) {
bindingId = prepareForAssignment(bindingId, binding);
}
/** {@inheritDoc} */
- public String getLocation() {
+ @Nullable public String getLocation() {
return location;
}
/** {@inheritDoc} */
- public void setLocation(final String theLocation) {
+ public void setLocation(@Nullable final String theLocation) {
this.location = prepareForAssignment(this.location, theLocation);
}
/** {@inheritDoc} */
- public String getResponseLocation() {
+ @Nullable public String getResponseLocation() {
return responseLocation;
}
/** {@inheritDoc} */
- public void setResponseLocation(final String theLocation) {
+ public void setResponseLocation(@Nullable final String theLocation) {
responseLocation = prepareForAssignment(responseLocation, theLocation);
}
/**
* {@inheritDoc}
*/
- public AttributeMap getUnknownAttributes() {
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/**
* {@inheritDoc}
*/
- public List<XMLObject> getUnknownXMLObjects() {
+ @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/saml2/metadata/impl/EntitiesDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorImpl.java
index 4e26695cc..c21319270 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntitiesDescriptorImpl.java
@@ -22,39 +22,46 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObject;
import org.opensaml.core.xml.util.IndexedXMLObjectChildrenList;
import org.opensaml.saml.common.AbstractSignableSAMLObject;
import org.opensaml.saml.common.SAMLObject;
import org.opensaml.saml.saml2.metadata.Extensions;
+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;
import org.opensaml.saml.saml2.metadata.EntitiesDescriptor;
import org.opensaml.saml.saml2.metadata.EntityDescriptor;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.EntitiesDescriptor}.
+ * Concrete implementation of {@link EntitiesDescriptor}.
*/
public class EntitiesDescriptorImpl extends AbstractSignableSAMLObject implements EntitiesDescriptor {
/** Name of this descriptor group. */
- private String name;
+ @Nullable private String name;
/** ID attribute. */
- private String id;
+ @Nullable private String id;
/** validUntil attribute. */
- private Instant validUntil;
+ @Nullable private Instant validUntil;
/** cacheDurection attribute. */
- private Duration cacheDuration;
+ @Nullable private Duration cacheDuration;
/** Extensions child. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/** Ordered set of child Entity/Entities Descriptors. */
- private final IndexedXMLObjectChildrenList<SAMLObject> orderedDescriptors;
+ @Nonnull private final IndexedXMLObjectChildrenList<SAMLObject> orderedDescriptors;
/**
* Constructor.
@@ -63,32 +70,32 @@ public class EntitiesDescriptorImpl extends AbstractSignableSAMLObject implement
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EntitiesDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected EntitiesDescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
orderedDescriptors = new IndexedXMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public String getName() {
+ @Nullable public String getName() {
return name;
}
/** {@inheritDoc} */
- public void setName(final String newName) {
- this.name = prepareForAssignment(this.name, newName);
+ public void setName(@Nullable final String newName) {
+ name = prepareForAssignment(name, newName);
}
/** {@inheritDoc} */
- public String getID() {
+ @Nullable public String getID() {
return id;
}
/** {@inheritDoc} */
- public void setID(final String newID) {
- final String oldID = this.id;
- this.id = prepareForAssignment(this.id, newID);
- registerOwnID(oldID, this.id);
+ public void setID(@Nullable final String newID) {
+ final String oldID = id;
+ id = prepareForAssignment(id, newID);
+ registerOwnID(oldID, id);
}
/** {@inheritDoc} */
@@ -101,42 +108,44 @@ public class EntitiesDescriptorImpl extends AbstractSignableSAMLObject implement
}
/** {@inheritDoc} */
- public Instant getValidUntil() {
+ @Nullable public Instant getValidUntil() {
return validUntil;
}
/** {@inheritDoc} */
- public void setValidUntil(final Instant newValidUntil) {
+ public void setValidUntil(@Nullable final Instant newValidUntil) {
validUntil = prepareForAssignment(validUntil, newValidUntil);
}
/** {@inheritDoc} */
- public Duration getCacheDuration() {
+ @Nullable public Duration getCacheDuration() {
return cacheDuration;
}
/** {@inheritDoc} */
- public void setCacheDuration(final Duration duration) {
+ public void setCacheDuration(@Nullable final Duration duration) {
cacheDuration = prepareForAssignment(cacheDuration, duration);
}
/** {@inheritDoc} */
- public Extensions getExtensions() {
+ @Nullable public Extensions getExtensions() {
return extensions;
}
/** {@inheritDoc} */
- public void setExtensions(final Extensions newExtensions) {
+ public void setExtensions(@Nullable final Extensions newExtensions) {
extensions = prepareForAssignment(extensions, newExtensions);
}
/** {@inheritDoc} */
- public List<EntitiesDescriptor> getEntitiesDescriptors() {
+ @SuppressWarnings("unchecked")
+ @Nonnull @Live public List<EntitiesDescriptor> getEntitiesDescriptors() {
return (List<EntitiesDescriptor>) orderedDescriptors.subList(EntitiesDescriptor.ELEMENT_QNAME);
}
/** {@inheritDoc} */
- public List<EntityDescriptor> getEntityDescriptors() {
+ @SuppressWarnings("unchecked")
+ @Nonnull @Live public List<EntityDescriptor> getEntityDescriptors() {
return (List<EntityDescriptor>) orderedDescriptors.subList(EntityDescriptor.ELEMENT_QNAME);
}
@@ -146,19 +155,21 @@ public class EntitiesDescriptorImpl extends AbstractSignableSAMLObject implement
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if(getSignature() != null){
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
- if (getExtensions() != null) {
- children.add(getExtensions());
+ if (extensions != null) {
+ children.add(extensions);
}
children.addAll(orderedDescriptors);
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java
index c655c8221..04e2fd218 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/EntityDescriptorImpl.java
@@ -22,6 +22,8 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.namespace.QName;
import org.opensaml.core.xml.XMLObject;
@@ -41,46 +43,51 @@ import org.opensaml.saml.saml2.metadata.Organization;
import org.opensaml.saml.saml2.metadata.PDPDescriptor;
import org.opensaml.saml.saml2.metadata.RoleDescriptor;
import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
+import org.opensaml.xmlsec.signature.Signature;
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
/**
- * Concretate implementation of {@link org.opensaml.saml.saml2.metadata.EntitiesDescriptor}.
+ * Concretate implementation of {@link EntityDescriptor}.
*/
public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements EntityDescriptor {
/** Entity ID of this Entity. */
- private String entityID;
+ @Nullable private String entityID;
/** ID attribute. */
- private String id;
+ @Nullable private String id;
/** validUntil attribute. */
- private Instant validUntil;
+ @Nullable private Instant validUntil;
/** cacheDurection attribute. */
- private Duration cacheDuration;
+ @Nullable private Duration cacheDuration;
/** Extensions child. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/** Role descriptors for this entity. */
- private final IndexedXMLObjectChildrenList<RoleDescriptor> roleDescriptors;
+ @Nonnull private final IndexedXMLObjectChildrenList<RoleDescriptor> roleDescriptors;
/** Affiliatition descriptor for this entity. */
- private AffiliationDescriptor affiliationDescriptor;
+ @Nullable private AffiliationDescriptor affiliationDescriptor;
/** Organization the administers this entity. */
- private Organization organization;
+ @Nullable private Organization organization;
/** Contact persons for this entity. */
- private final XMLObjectChildrenList<ContactPerson> contactPersons;
+ @Nonnull private final XMLObjectChildrenList<ContactPerson> contactPersons;
/** Additional metadata locations for this entity. */
- private final XMLObjectChildrenList<AdditionalMetadataLocation> additionalMetadata;
+ @Nonnull private final XMLObjectChildrenList<AdditionalMetadataLocation> additionalMetadata;
/** "anyAttribute" attributes. */
- private final AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/**
* Constructor.
@@ -89,8 +96,8 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected EntityDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected EntityDescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
roleDescriptors = new IndexedXMLObjectChildrenList<>(this);
contactPersons = new XMLObjectChildrenList<>(this);
@@ -99,12 +106,12 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public String getEntityID() {
+ @Nullable public String getEntityID() {
return entityID;
}
/** {@inheritDoc} */
- public void setEntityID(final String newId) {
+ public void setEntityID(@Nullable final String newId) {
if (newId != null && newId.length() > 1024) {
throw new IllegalArgumentException("Entity ID can not exceed 1024 characters in length");
}
@@ -112,15 +119,15 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public String getID() {
+ @Nullable public String getID() {
return id;
}
/** {@inheritDoc} */
- public void setID(final String newID) {
- final String oldID = this.id;
- this.id = prepareForAssignment(this.id, newID);
- registerOwnID(oldID, this.id);
+ public void setID(@Nullable final String newID) {
+ final String oldID = id;
+ id = prepareForAssignment(id, newID);
+ registerOwnID(oldID, id);
}
/** {@inheritDoc} */
@@ -133,47 +140,49 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public Instant getValidUntil() {
+ @Nullable public Instant getValidUntil() {
return validUntil;
}
/** {@inheritDoc} */
- public void setValidUntil(final Instant newValidUntil) {
+ public void setValidUntil(@Nullable final Instant newValidUntil) {
validUntil = prepareForAssignment(validUntil, newValidUntil);
}
/** {@inheritDoc} */
- public Duration getCacheDuration() {
+ @Nullable public Duration getCacheDuration() {
return cacheDuration;
}
/** {@inheritDoc} */
- public void setCacheDuration(final Duration duration) {
+ public void setCacheDuration(@Nullable final Duration duration) {
cacheDuration = prepareForAssignment(cacheDuration, duration);
}
/** {@inheritDoc} */
- public Extensions getExtensions() {
+ @Nullable public Extensions getExtensions() {
return extensions;
}
/** {@inheritDoc} */
- public void setExtensions(final Extensions newExtensions) {
+ public void setExtensions(@Nullable final Extensions newExtensions) {
extensions = prepareForAssignment(extensions, newExtensions);
}
/** {@inheritDoc} */
- public List<RoleDescriptor> getRoleDescriptors() {
+ @Nonnull @Live public List<RoleDescriptor> getRoleDescriptors() {
return roleDescriptors;
}
/** {@inheritDoc} */
- public List<RoleDescriptor> getRoleDescriptors(final QName typeOrName) {
+ @SuppressWarnings("unchecked")
+ @Nonnull @Live public List<RoleDescriptor> getRoleDescriptors(@Nonnull final QName typeOrName) {
return (List<RoleDescriptor>) roleDescriptors.subList(typeOrName);
}
/** {@inheritDoc} */
- public List<RoleDescriptor> getRoleDescriptors(final QName type, final String supportedProtocol) {
+ @Nonnull @NotLive @Unmodifiable public List<RoleDescriptor> getRoleDescriptors(@Nonnull final QName type,
+ @Nonnull @NotEmpty final String supportedProtocol) {
final ArrayList<RoleDescriptor> supportingRoleDescriptors = new ArrayList<>();
for (final RoleDescriptor descriptor : roleDescriptors.subList(type)) {
if (descriptor.isSupportedProtocol(supportedProtocol)) {
@@ -185,7 +194,7 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public IDPSSODescriptor getIDPSSODescriptor(final String supportedProtocol) {
+ @Nullable public IDPSSODescriptor getIDPSSODescriptor(@Nonnull @NotEmpty final String supportedProtocol) {
final List<RoleDescriptor> descriptors =
getRoleDescriptors(IDPSSODescriptor.DEFAULT_ELEMENT_NAME, supportedProtocol);
if (descriptors.size() > 0) {
@@ -196,7 +205,7 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public SPSSODescriptor getSPSSODescriptor(final String supportedProtocol) {
+ @Nullable public SPSSODescriptor getSPSSODescriptor(@Nonnull @NotEmpty final String supportedProtocol) {
final List<RoleDescriptor> descriptors =
getRoleDescriptors(SPSSODescriptor.DEFAULT_ELEMENT_NAME, supportedProtocol);
if (descriptors.size() > 0) {
@@ -207,7 +216,8 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public AuthnAuthorityDescriptor getAuthnAuthorityDescriptor(final String supportedProtocol) {
+ @Nullable public AuthnAuthorityDescriptor getAuthnAuthorityDescriptor(
+ @Nonnull @NotEmpty final String supportedProtocol) {
final List<RoleDescriptor> descriptors = getRoleDescriptors(AuthnAuthorityDescriptor.DEFAULT_ELEMENT_NAME,
supportedProtocol);
if (descriptors.size() > 0) {
@@ -218,7 +228,8 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public AttributeAuthorityDescriptor getAttributeAuthorityDescriptor(final String supportedProtocol) {
+ @Nullable public AttributeAuthorityDescriptor getAttributeAuthorityDescriptor(
+ @Nonnull @NotEmpty final String supportedProtocol) {
final List<RoleDescriptor> descriptors = getRoleDescriptors(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME,
supportedProtocol);
if (descriptors.size() > 0) {
@@ -229,7 +240,7 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public PDPDescriptor getPDPDescriptor(final String supportedProtocol) {
+ @Nullable public PDPDescriptor getPDPDescriptor(@Nonnull @NotEmpty final String supportedProtocol) {
final List<RoleDescriptor> descriptors =
getRoleDescriptors(PDPDescriptor.DEFAULT_ELEMENT_NAME, supportedProtocol);
if (descriptors.size() > 0) {
@@ -240,57 +251,58 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
}
/** {@inheritDoc} */
- public AffiliationDescriptor getAffiliationDescriptor() {
+ @Nullable public AffiliationDescriptor getAffiliationDescriptor() {
return affiliationDescriptor;
}
/** {@inheritDoc} */
- public void setAffiliationDescriptor(final AffiliationDescriptor descriptor) {
+ public void setAffiliationDescriptor(@Nullable final AffiliationDescriptor descriptor) {
affiliationDescriptor = prepareForAssignment(affiliationDescriptor, descriptor);
}
/** {@inheritDoc} */
- public Organization getOrganization() {
+ @Nullable public Organization getOrganization() {
return organization;
}
/** {@inheritDoc} */
- public void setOrganization(final Organization newOrganization) {
+ public void setOrganization(@Nullable final Organization newOrganization) {
organization = prepareForAssignment(organization, newOrganization);
}
/** {@inheritDoc} */
- public List<ContactPerson> getContactPersons() {
+ @Nonnull @Live public List<ContactPerson> getContactPersons() {
return contactPersons;
}
/** {@inheritDoc} */
- public List<AdditionalMetadataLocation> getAdditionalMetadataLocations() {
+ @Nonnull @Live public List<AdditionalMetadataLocation> getAdditionalMetadataLocations() {
return additionalMetadata;
}
/**
* {@inheritDoc}
*/
- public AttributeMap getUnknownAttributes() {
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/** {@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<>();
- if (getSignature() != null) {
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
- if (getExtensions() != null) {
- children.add(getExtensions());
+ if (extensions != null) {
+ children.add(extensions);
}
children.addAll(roleDescriptors);
@@ -308,4 +320,5 @@ public class EntityDescriptorImpl extends AbstractSignableSAMLObject implements
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ExtensionsImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ExtensionsImpl.java
index a2b502f17..96e4bb242 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ExtensionsImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ExtensionsImpl.java
@@ -17,9 +17,10 @@
package org.opensaml.saml.saml2.metadata.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.saml2.metadata.Extensions;
+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.saml2.metadata.Extensions}.
*/
public class ExtensionsImpl extends AbstractXMLObject implements Extensions {
/** "any" children. */
- private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
+ @Nonnull private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
/**
* Constructor.
@@ -42,7 +48,8 @@ public class ExtensionsImpl extends AbstractXMLObject implements Extensions {
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected ExtensionsImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ExtensionsImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownChildren = new IndexedXMLObjectChildrenList<>(this);
}
@@ -50,17 +57,19 @@ public class ExtensionsImpl extends AbstractXMLObject implements Extensions {
/**
* {@inheritDoc}
*/
- public List<XMLObject> getUnknownXMLObjects() {
+ @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);
+ @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/saml2/metadata/impl/ExtensionsUnmarshaller.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ExtensionsUnmarshaller.java
index 4f6d9efd2..360c25cb1 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ExtensionsUnmarshaller.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ExtensionsUnmarshaller.java
@@ -36,9 +36,7 @@ public class ExtensionsUnmarshaller extends AbstractSAMLObjectUnmarshaller {
/** Logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(AbstractSAMLObjectUnmarshaller.class);
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
protected void processChildElement(@Nonnull final XMLObject parentObject, @Nonnull final XMLObject childObject)
throws UnmarshallingException {
@@ -47,19 +45,16 @@ public class ExtensionsUnmarshaller extends AbstractSAMLObjectUnmarshaller {
extensions.getUnknownXMLObjects().add(childObject);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
protected void processAttribute(@Nonnull final XMLObject xmlObject, @Nonnull final Attr attribute)
throws UnmarshallingException {
log.debug("Ignorning unknown attribute {}", attribute.getLocalName());
}
- /**
- * {@inheritDoc}
- */
- protected void processElementContent(final XMLObject xmlObject, final String elementContent) {
+ /** {@inheritDoc} */
+ @Override
+ protected void processElementContent(@Nonnull final XMLObject xmlObject, @Nonnull final String elementContent) {
log.debug("Ignoring element content {}", elementContent);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/GivenNameImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/GivenNameImpl.java
index 57186977d..b4d0d4536 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/GivenNameImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/GivenNameImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.metadata.GivenName;
@@ -36,7 +39,9 @@ public class GivenNameImpl extends XSStringImpl implements GivenName {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected GivenNameImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected GivenNameImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorImpl.java
index 6edd6dda9..413737461 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IDPSSODescriptorImpl.java
@@ -22,9 +22,10 @@
package org.opensaml.saml.saml2.metadata.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.XMLObject;
@@ -38,30 +39,33 @@ import org.opensaml.saml.saml2.metadata.IDPSSODescriptor;
import org.opensaml.saml.saml2.metadata.NameIDMappingService;
import org.opensaml.saml.saml2.metadata.SingleSignOnService;
+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.metadata.IDPSSODescriptor}.
+ * Concrete implementation of {@link IDPSSODescriptor}.
*/
public class IDPSSODescriptorImpl extends SSODescriptorImpl implements IDPSSODescriptor {
/** wantAuthnRequestSigned attribute. */
- private XSBooleanValue wantAuthnRequestsSigned;
+ @Nullable private XSBooleanValue wantAuthnRequestsSigned;
/** SingleSignOn services for this entity. */
- private final XMLObjectChildrenList<SingleSignOnService> singleSignOnServices;
+ @Nonnull private final XMLObjectChildrenList<SingleSignOnService> singleSignOnServices;
/** NameID mapping services for this entity. */
- private final XMLObjectChildrenList<NameIDMappingService> nameIDMappingServices;
+ @Nonnull private final XMLObjectChildrenList<NameIDMappingService> nameIDMappingServices;
/** AssertionID request services for this entity. */
- private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
+ @Nonnull private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
/** Attribute profiles supported by this entity. */
- private final XMLObjectChildrenList<AttributeProfile> attributeProfiles;
+ @Nonnull private final XMLObjectChildrenList<AttributeProfile> attributeProfiles;
/** Attributes accepted by this entity. */
- private final XMLObjectChildrenList<Attribute> attributes;
+ @Nonnull private final XMLObjectChildrenList<Attribute> attributes;
/**
* Constructor.
@@ -70,8 +74,8 @@ public class IDPSSODescriptorImpl extends SSODescriptorImpl implements IDPSSODes
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected IDPSSODescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected IDPSSODescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
singleSignOnServices = new XMLObjectChildrenList<>(this);
nameIDMappingServices = new XMLObjectChildrenList<>(this);
@@ -81,7 +85,7 @@ public class IDPSSODescriptorImpl extends SSODescriptorImpl implements IDPSSODes
}
/** {@inheritDoc} */
- public Boolean getWantAuthnRequestsSigned() {
+ @Nullable public Boolean getWantAuthnRequestsSigned() {
if (wantAuthnRequestsSigned != null) {
return wantAuthnRequestsSigned.getValue();
}
@@ -90,12 +94,12 @@ public class IDPSSODescriptorImpl extends SSODescriptorImpl implements IDPSSODes
}
/** {@inheritDoc} */
- public XSBooleanValue getWantAuthnRequestsSignedXSBoolean() {
+ @Nullable public XSBooleanValue getWantAuthnRequestsSignedXSBoolean() {
return wantAuthnRequestsSigned;
}
/** {@inheritDoc} */
- public void setWantAuthnRequestsSigned(final Boolean newWantSigned) {
+ public void setWantAuthnRequestsSigned(@Nullable final Boolean newWantSigned) {
if (newWantSigned != null) {
wantAuthnRequestsSigned =
prepareForAssignment(wantAuthnRequestsSigned, new XSBooleanValue(newWantSigned, false));
@@ -105,60 +109,61 @@ public class IDPSSODescriptorImpl extends SSODescriptorImpl implements IDPSSODes
}
/** {@inheritDoc} */
- public void setWantAuthnRequestsSigned(final XSBooleanValue wantSigned) {
+ public void setWantAuthnRequestsSigned(@Nullable final XSBooleanValue wantSigned) {
wantAuthnRequestsSigned = prepareForAssignment(wantAuthnRequestsSigned, wantSigned);
}
/** {@inheritDoc} */
- public List<SingleSignOnService> getSingleSignOnServices() {
+ @Nonnull @Live public List<SingleSignOnService> getSingleSignOnServices() {
return singleSignOnServices;
}
/** {@inheritDoc} */
- public List<NameIDMappingService> getNameIDMappingServices() {
+ @Nonnull @Live public List<NameIDMappingService> getNameIDMappingServices() {
return nameIDMappingServices;
}
/** {@inheritDoc} */
- public List<AssertionIDRequestService> getAssertionIDRequestServices() {
+ @Nonnull @Live public List<AssertionIDRequestService> getAssertionIDRequestServices() {
return assertionIDRequestServices;
}
/** {@inheritDoc} */
- public List<AttributeProfile> getAttributeProfiles() {
+ @Nonnull @Live public List<AttributeProfile> getAttributeProfiles() {
return attributeProfiles;
}
/** {@inheritDoc} */
- public List<Attribute> getAttributes() {
+ @Nonnull @Live public List<Attribute> getAttributes() {
return attributes;
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints() {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints() {
final List<Endpoint> endpoints = new ArrayList<>();
endpoints.addAll(super.getEndpoints());
endpoints.addAll(singleSignOnServices);
endpoints.addAll(nameIDMappingServices);
endpoints.addAll(assertionIDRequestServices);
- return Collections.unmodifiableList(endpoints);
+ return CollectionSupport.copyToList(endpoints);
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints(final QName type) {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints(@Nonnull final QName type) {
if (type.equals(SingleSignOnService.DEFAULT_ELEMENT_NAME)) {
- return Collections.unmodifiableList(new ArrayList<Endpoint>(singleSignOnServices));
+ return CollectionSupport.copyToList(singleSignOnServices);
} else if (type.equals(NameIDMappingService.DEFAULT_ELEMENT_NAME)) {
- return Collections.unmodifiableList(new ArrayList<Endpoint>(nameIDMappingServices));
+ return CollectionSupport.copyToList(nameIDMappingServices);
} else if (type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)) {
- return Collections.unmodifiableList(new ArrayList<Endpoint>(assertionIDRequestServices));
+ return CollectionSupport.copyToList(assertionIDRequestServices);
} else {
return super.getEndpoints(type);
}
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
final List<XMLObject> parentChildren = super.getOrderedChildren();
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IndexedEndpointImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IndexedEndpointImpl.java
index df626a13d..8f79e14e7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IndexedEndpointImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/IndexedEndpointImpl.java
@@ -28,7 +28,7 @@ import org.opensaml.core.xml.schema.XSBooleanValue;
import org.opensaml.saml.saml2.metadata.IndexedEndpoint;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.IndexedEndpoint}.
+ * Concrete implementation of {@link IndexedEndpoint}.
*/
public abstract class IndexedEndpointImpl extends EndpointImpl implements IndexedEndpoint {
@@ -56,16 +56,16 @@ public abstract class IndexedEndpointImpl extends EndpointImpl implements Indexe
}
/** {@inheritDoc} */
- public void setIndex(final Integer theIndex) {
- this.index = prepareForAssignment(this.index, theIndex);
+ public void setIndex(@Nullable final Integer theIndex) {
+ index = prepareForAssignment(index, theIndex);
}
/** {@inheritDoc} */
@Nullable public Boolean isDefault() {
- if (isDefault == null) {
- return Boolean.FALSE;
+ if (isDefault != null) {
+ return isDefault.getValue();
}
- return isDefault.getValue();
+ return Boolean.FALSE;
}
/** {@inheritDoc} */
@@ -84,7 +84,7 @@ public abstract class IndexedEndpointImpl extends EndpointImpl implements Indexe
/** {@inheritDoc} */
public void setIsDefault(@Nullable final XSBooleanValue theIsDefault) {
- this.isDefault = prepareForAssignment(this.isDefault, theIsDefault);
+ isDefault = prepareForAssignment(isDefault, theIsDefault);
}
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java
index aee0de7d6..22d9d9b1d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/KeyDescriptorImpl.java
@@ -20,6 +20,9 @@ package org.opensaml.saml.saml2.metadata.impl;
import java.util.ArrayList;
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,21 +31,24 @@ import org.opensaml.saml.saml2.metadata.KeyDescriptor;
import org.opensaml.security.credential.UsageType;
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 {@link org.opensaml.saml.saml2.metadata.KeyDescriptor}.
+ * Concrete implementation of {@link KeyDescriptor}.
*/
public class KeyDescriptorImpl extends AbstractXMLObject implements KeyDescriptor {
/** Key usage type. */
- private UsageType keyUseType;
+ @Nullable private UsageType keyUseType;
/** Key information. */
- private KeyInfo keyInfo;
+ @Nullable private KeyInfo keyInfo;
/** Encryption methods supported by the entity. */
- private final XMLObjectChildrenList<EncryptionMethod> encryptionMethods;
+ @Nonnull private final XMLObjectChildrenList<EncryptionMethod> encryptionMethods;
/**
* Constructor.
@@ -51,20 +57,20 @@ public class KeyDescriptorImpl extends AbstractXMLObject implements KeyDescripto
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected KeyDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected KeyDescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
encryptionMethods = new XMLObjectChildrenList<>(this);
keyUseType = UsageType.UNSPECIFIED;
}
/** {@inheritDoc} */
- public UsageType getUse() {
+ @Nullable public UsageType getUse() {
return keyUseType;
}
/** {@inheritDoc} */
- public void setUse(final UsageType newType) {
+ public void setUse(@Nullable final UsageType newType) {
if (newType != null) {
keyUseType = prepareForAssignment(keyUseType, newType);
} else {
@@ -73,22 +79,22 @@ public class KeyDescriptorImpl extends AbstractXMLObject implements KeyDescripto
}
/** {@inheritDoc} */
- public KeyInfo getKeyInfo() {
+ @Nullable public KeyInfo getKeyInfo() {
return keyInfo;
}
/** {@inheritDoc} */
- public void setKeyInfo(final KeyInfo newKeyInfo) {
+ public void setKeyInfo(@Nullable final KeyInfo newKeyInfo) {
keyInfo = prepareForAssignment(keyInfo, newKeyInfo);
}
/** {@inheritDoc} */
- public List<EncryptionMethod> getEncryptionMethods() {
+ @Nonnull @Live public List<EncryptionMethod> getEncryptionMethods() {
return encryptionMethods;
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
if (keyInfo != null) {
@@ -99,4 +105,5 @@ public class KeyDescriptorImpl extends AbstractXMLObject implements KeyDescripto
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedNameImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedNameImpl.java
index 8c93f75e4..8dc8f0da7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedNameImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedNameImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.LangBearing;
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.metadata.LocalizedName;
@@ -24,12 +27,12 @@ import org.opensaml.saml.saml2.metadata.LocalizedName;
import com.google.common.base.Strings;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.LocalizedName}.
+ * Concrete implementation of {@link LocalizedName}.
*/
public class LocalizedNameImpl extends XSStringImpl implements LocalizedName {
/** Language. */
- private String language;
+ @Nullable private String language;
/**
* Constructor.
@@ -38,29 +41,29 @@ public class LocalizedNameImpl extends XSStringImpl implements LocalizedName {
* @param elementLocalName the elementLocalName
* @param namespacePrefix the namespacePrefix
*/
- protected LocalizedNameImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected LocalizedNameImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getXMLLang() {
+ @Nullable public String getXMLLang() {
return language;
}
/** {@inheritDoc} */
- public void setXMLLang(final String newLang) {
+ public void setXMLLang(@Nullable final String newLang) {
final boolean hasValue = newLang != null && !Strings.isNullOrEmpty(newLang);
language = prepareForAssignment(language, newLang);
manageQualifiedAttributeNamespace(LangBearing.XML_LANG_ATTR_NAME, hasValue);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
+ @Override
public int hashCode() {
int hash = super.hashCode();
- hash = hash * 31 + language.hashCode();
+ hash = hash * 31 + (language != null ? language.hashCode() : 0);
return hash;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedURIImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedURIImpl.java
index b081a9359..9e1131272 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedURIImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/LocalizedURIImpl.java
@@ -17,6 +17,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.LangBearing;
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.metadata.LocalizedURI;
@@ -29,7 +32,7 @@ import com.google.common.base.Strings;
public class LocalizedURIImpl extends XSURIImpl implements LocalizedURI {
/** Language. */
- private String language;
+ @Nullable private String language;
/**
* Constructor.
@@ -38,17 +41,18 @@ public class LocalizedURIImpl extends XSURIImpl implements LocalizedURI {
* @param elementLocalName the elementLocalName
* @param namespacePrefix the namespacePrefix
*/
- protected LocalizedURIImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected LocalizedURIImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public String getXMLLang() {
+ @Nullable public String getXMLLang() {
return language;
}
/** {@inheritDoc} */
- public void setXMLLang(final String newLang) {
+ public void setXMLLang(@Nullable final String newLang) {
final boolean hasValue = newLang != null && !Strings.isNullOrEmpty(newLang);
language = prepareForAssignment(language, newLang);
manageQualifiedAttributeNamespace(LangBearing.XML_LANG_ATTR_NAME, hasValue);
@@ -59,7 +63,8 @@ public class LocalizedURIImpl extends XSURIImpl implements LocalizedURI {
*/
public int hashCode() {
int hash = super.hashCode();
- hash = hash * 31 + language.hashCode();
+ hash = hash * 31 + (language != null ? language.hashCode() : 0);
return hash;
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ManageNameIDServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ManageNameIDServiceImpl.java
index 8e1c3cc20..4851d3926 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ManageNameIDServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ManageNameIDServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.ManageNameIDService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.ManageNameIDService}.
+ * Concrete implementation of {@link ManageNameIDService}.
*/
public class ManageNameIDServiceImpl extends EndpointImpl implements ManageNameIDService {
@@ -35,8 +38,9 @@ public class ManageNameIDServiceImpl extends EndpointImpl implements ManageNameI
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected ManageNameIDServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ManageNameIDServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/NameIDFormatImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/NameIDFormatImpl.java
index bba29ff05..6af5391d8 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/NameIDFormatImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/NameIDFormatImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSURIImpl;
import org.opensaml.saml.saml2.metadata.NameIDFormat;
@@ -37,7 +40,8 @@ public class NameIDFormatImpl extends XSURIImpl implements NameIDFormat {
* @param namespacePrefix the prefix for the given namespace
*/
- protected NameIDFormatImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected NameIDFormatImpl(@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/saml2/metadata/impl/NameIDMappingServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/NameIDMappingServiceImpl.java
index 3f0527891..9bb89450d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/NameIDMappingServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/NameIDMappingServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.NameIDMappingService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.NameIDMappingService}.
+ * Concrete implementation of {@link NameIDMappingService}.
*/
public class NameIDMappingServiceImpl extends EndpointImpl implements NameIDMappingService {
@@ -36,8 +39,9 @@ public class NameIDMappingServiceImpl extends EndpointImpl implements NameIDMapp
* @param namespacePrefix the prefix for the given namespace
*/
- protected NameIDMappingServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected NameIDMappingServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationDisplayNameImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationDisplayNameImpl.java
index 42566ea37..ad1b1fb1b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationDisplayNameImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationDisplayNameImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.OrganizationDisplayName;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.OrganizationDisplayName}.
+ * Concrete implementation of {@link OrganizationDisplayName}.
*/
public class OrganizationDisplayNameImpl extends LocalizedNameImpl implements OrganizationDisplayName {
@@ -35,8 +38,9 @@ public class OrganizationDisplayNameImpl extends LocalizedNameImpl implements Or
* @param elementLocalName the name
* @param namespacePrefix the prefix
*/
- protected OrganizationDisplayNameImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected OrganizationDisplayNameImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationImpl.java
index 2a364096d..0efaef843 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationImpl.java
@@ -24,6 +24,9 @@ package org.opensaml.saml.saml2.metadata.impl;
import java.util.ArrayList;
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.AttributeMap;
@@ -34,27 +37,30 @@ import org.opensaml.saml.saml2.metadata.OrganizationDisplayName;
import org.opensaml.saml.saml2.metadata.OrganizationName;
import org.opensaml.saml.saml2.metadata.OrganizationURL;
+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.metadata.Organization}.
+ * Concrete implementation of {@link Organization}.
*/
public class OrganizationImpl extends AbstractXMLObject implements Organization {
/** element extensions. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/** OrganizationName children. */
- private final XMLObjectChildrenList<OrganizationName> names;
+ @Nonnull private final XMLObjectChildrenList<OrganizationName> names;
/** OrganizationDisplayName children. */
- private final XMLObjectChildrenList<OrganizationDisplayName> displayNames;
+ @Nonnull private final XMLObjectChildrenList<OrganizationDisplayName> displayNames;
/** OrganizationURL children. */
- private final XMLObjectChildrenList<OrganizationURL> urls;
+ @Nonnull private final XMLObjectChildrenList<OrganizationURL> urls;
/** "anyAttribute" attributes. */
- private final AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/**
* Constructor.
@@ -63,7 +69,8 @@ public class OrganizationImpl extends AbstractXMLObject implements Organization
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected OrganizationImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected OrganizationImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
names = new XMLObjectChildrenList<>(this);
displayNames = new XMLObjectChildrenList<>(this);
@@ -72,44 +79,37 @@ public class OrganizationImpl extends AbstractXMLObject implements Organization
}
/** {@inheritDoc} */
- @Override
- public Extensions getExtensions() {
+ @Nullable public Extensions getExtensions() {
return extensions;
}
/** {@inheritDoc} */
- @Override
- public void setExtensions(final Extensions newExtensions) {
+ public void setExtensions(@Nullable final Extensions newExtensions) {
this.extensions = prepareForAssignment(this.extensions, newExtensions);
}
/** {@inheritDoc} */
- @Override
- public List<OrganizationName> getOrganizationNames() {
+ @Nonnull @Live public List<OrganizationName> getOrganizationNames() {
return names;
}
/** {@inheritDoc} */
- @Override
- public List<OrganizationDisplayName> getDisplayNames() {
+ @Nonnull @Live public List<OrganizationDisplayName> getDisplayNames() {
return displayNames;
}
/** {@inheritDoc} */
- @Override
- public List<OrganizationURL> getURLs() {
+ @Nonnull @Live public List<OrganizationURL> getURLs() {
return urls;
}
- /** {@inheritDoc} */
- @Override
- public AttributeMap getUnknownAttributes() {
+ /** {@inheritDoc} */ @Override
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/** {@inheritDoc} */
- @Override
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
if (extensions != null) {
@@ -122,4 +122,5 @@ public class OrganizationImpl extends AbstractXMLObject implements Organization
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationNameImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationNameImpl.java
index 7a3006078..80a5884b5 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationNameImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationNameImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.OrganizationName;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.OrganizationName}.
+ * Concrete implementation of {@link OrganizationName}.
*/
public class OrganizationNameImpl extends LocalizedNameImpl implements OrganizationName {
@@ -35,8 +38,9 @@ public class OrganizationNameImpl extends LocalizedNameImpl implements Organizat
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected OrganizationNameImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected OrganizationNameImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationURLImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationURLImpl.java
index 0376c5ec3..e0fc65053 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationURLImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/OrganizationURLImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.OrganizationURL;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.OrganizationURL}.
+ * Concrete implementation of {@link OrganizationURL}.
*/
public class OrganizationURLImpl extends LocalizedURIImpl implements OrganizationURL {
@@ -35,8 +38,8 @@ public class OrganizationURLImpl extends LocalizedURIImpl implements Organizatio
* @param elementLocalName name
* @param namespacePrefix prefix
*/
- protected OrganizationURLImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected OrganizationURLImpl(@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/saml2/metadata/impl/PDPDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorImpl.java
index ccb434304..489171e67 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorImpl.java
@@ -22,9 +22,10 @@
package org.opensaml.saml.saml2.metadata.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.XMLObject;
@@ -35,21 +36,24 @@ import org.opensaml.saml.saml2.metadata.Endpoint;
import org.opensaml.saml.saml2.metadata.NameIDFormat;
import org.opensaml.saml.saml2.metadata.PDPDescriptor;
+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.metadata.PDPDescriptor}.
+ * Concrete implementation of {@link PDPDescriptor}.
*/
public class PDPDescriptorImpl extends RoleDescriptorImpl implements PDPDescriptor {
/** AuthzService children. */
- private final XMLObjectChildrenList<AuthzService> authzServices;
+ @Nonnull private final XMLObjectChildrenList<AuthzService> authzServices;
/** AssertionIDRequestService children. */
- private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
+ @Nonnull private final XMLObjectChildrenList<AssertionIDRequestService> assertionIDRequestServices;
/** NameIDFormat children. */
- private final XMLObjectChildrenList<NameIDFormat> nameIDFormats;
+ @Nonnull private final XMLObjectChildrenList<NameIDFormat> nameIDFormats;
/**
* Constructor.
@@ -58,8 +62,8 @@ public class PDPDescriptorImpl extends RoleDescriptorImpl implements PDPDescript
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected PDPDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected PDPDescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
authzServices = new XMLObjectChildrenList<>(this);
assertionIDRequestServices = new XMLObjectChildrenList<>(this);
@@ -67,48 +71,54 @@ public class PDPDescriptorImpl extends RoleDescriptorImpl implements PDPDescript
}
/** {@inheritDoc} */
- public List<AuthzService> getAuthzServices() {
+ @Nonnull @Live public List<AuthzService> getAuthzServices() {
return authzServices;
}
/** {@inheritDoc} */
- public List<AssertionIDRequestService> getAssertionIDRequestServices() {
+ @Nonnull @Live public List<AssertionIDRequestService> getAssertionIDRequestServices() {
return assertionIDRequestServices;
}
/** {@inheritDoc} */
- public List<NameIDFormat> getNameIDFormats() {
+ @Nonnull @Live public List<NameIDFormat> getNameIDFormats() {
return nameIDFormats;
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints() {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints() {
final List<Endpoint> endpoints = new ArrayList<>();
endpoints.addAll(authzServices);
endpoints.addAll(assertionIDRequestServices);
- return Collections.unmodifiableList(endpoints);
+ return CollectionSupport.copyToList(endpoints);
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints(final QName type) {
- if(type.equals(AuthzService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(authzServices));
- }else if(type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(assertionIDRequestServices));
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints(@Nonnull final QName type) {
+ if (type.equals(AuthzService.DEFAULT_ELEMENT_NAME)) {
+ return CollectionSupport.copyToList(authzServices);
+ } else if(type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)) {
+ return CollectionSupport.copyToList(assertionIDRequestServices);
}
- return null;
+ return CollectionSupport.emptyList();
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> parentChildren = super.getOrderedChildren();
+ if (parentChildren != null) {
+ children.addAll(parentChildren);
+ }
+
children.addAll(authzServices);
children.addAll(assertionIDRequestServices);
children.addAll(nameIDFormats);
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RequestedAttributeImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RequestedAttributeImpl.java
index b76d870dd..6d24df284 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RequestedAttributeImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RequestedAttributeImpl.java
@@ -21,17 +21,20 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.XSBooleanValue;
import org.opensaml.saml.saml2.core.impl.AttributeImpl;
import org.opensaml.saml.saml2.metadata.RequestedAttribute;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.RequestedAttribute}.
+ * Concrete implementation of {@link RequestedAttribute}.
*/
public class RequestedAttributeImpl extends AttributeImpl implements RequestedAttribute {
/** isRequired attribute. */
- private XSBooleanValue isRequired;
+ @Nullable private XSBooleanValue isRequired;
/**
* Constructor.
@@ -40,13 +43,13 @@ public class RequestedAttributeImpl extends AttributeImpl implements RequestedAt
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RequestedAttributeImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected RequestedAttributeImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
/** {@inheritDoc} */
- public Boolean isRequired(){
+ @Nullable public Boolean isRequired(){
if(isRequired != null){
return isRequired.getValue();
}
@@ -55,12 +58,12 @@ public class RequestedAttributeImpl extends AttributeImpl implements RequestedAt
}
/** {@inheritDoc} */
- public XSBooleanValue isRequiredXSBoolean() {
+ @Nullable public XSBooleanValue isRequiredXSBoolean() {
return isRequired;
}
/** {@inheritDoc} */
- public void setIsRequired(final Boolean newIsRequired){
+ public void setIsRequired(@Nullable final Boolean newIsRequired){
if(newIsRequired != null){
isRequired = prepareForAssignment(isRequired, new XSBooleanValue(newIsRequired, false));
}else{
@@ -69,7 +72,7 @@ public class RequestedAttributeImpl extends AttributeImpl implements RequestedAt
}
/** {@inheritDoc} */
- public void setIsRequired(final XSBooleanValue newIsRequired) {
+ public void setIsRequired(@Nullable final XSBooleanValue newIsRequired) {
isRequired = prepareForAssignment(isRequired, newIsRequired);
}
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java
index 3285a331c..46f9871ff 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/RoleDescriptorImpl.java
@@ -21,9 +21,15 @@ import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import net.shibboleth.shared.annotation.constraint.Live;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazyList;
import net.shibboleth.shared.primitive.StringSupport;
@@ -37,39 +43,40 @@ import org.opensaml.saml.saml2.metadata.ContactPerson;
import org.opensaml.saml.saml2.metadata.KeyDescriptor;
import org.opensaml.saml.saml2.metadata.Organization;
import org.opensaml.saml.saml2.metadata.RoleDescriptor;
+import org.opensaml.xmlsec.signature.Signature;
-/** Concrete implementation of {@link org.opensaml.saml.saml2.metadata.RoleDescriptor}. */
+/** Concrete implementation of {@link RoleDescriptor}. */
public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject implements RoleDescriptor {
/** ID attribute. */
- private String id;
+ @Nullable private String id;
/** validUntil attribute. */
- private Instant validUntil;
+ @Nullable private Instant validUntil;
/** cacheDurection attribute. */
- private Duration cacheDuration;
+ @Nullable private Duration cacheDuration;
/** Set of supported protocols. */
- private final List<String> supportedProtocols;
+ @Nonnull private final List<String> supportedProtocols;
/** Error URL. */
- private String errorURL;
+ @Nullable private String errorURL;
/** Extensions child. */
- private Extensions extensions;
+ @Nullable private Extensions extensions;
/** Organization administering this role. */
- private Organization organization;
+ @Nullable private Organization organization;
/** "anyAttribute" attributes. */
- private final AttributeMap unknownAttributes;
+ @Nonnull private final AttributeMap unknownAttributes;
/** Contact persons for this role. */
- private final XMLObjectChildrenList<ContactPerson> contactPersons;
+ @Nonnull private final XMLObjectChildrenList<ContactPerson> contactPersons;
/** Key descriptors for this role. */
- private final XMLObjectChildrenList<KeyDescriptor> keyDescriptors;
+ @Nonnull private final XMLObjectChildrenList<KeyDescriptor> keyDescriptors;
/**
* Constructor.
@@ -78,8 +85,8 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected RoleDescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected RoleDescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
unknownAttributes = new AttributeMap(this);
supportedProtocols = new LazyList<>();
@@ -88,15 +95,15 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
}
/** {@inheritDoc} */
- public String getID() {
+ @Nullable public String getID() {
return id;
}
/** {@inheritDoc} */
- public void setID(final String newID) {
- final String oldID = this.id;
- this.id = prepareForAssignment(this.id, newID);
- registerOwnID(oldID, this.id);
+ public void setID(@Nullable final String newID) {
+ final String oldID = id;
+ id = prepareForAssignment(id, newID);
+ registerOwnID(oldID, id);
}
/** {@inheritDoc} */
@@ -109,37 +116,37 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
}
/** {@inheritDoc} */
- public Instant getValidUntil() {
+ @Nullable public Instant getValidUntil() {
return validUntil;
}
/** {@inheritDoc} */
- public void setValidUntil(final Instant dt) {
+ public void setValidUntil(@Nullable final Instant dt) {
validUntil = prepareForAssignment(validUntil, dt);
}
/** {@inheritDoc} */
- public Duration getCacheDuration() {
+ @Nullable public Duration getCacheDuration() {
return cacheDuration;
}
/** {@inheritDoc} */
- public void setCacheDuration(final Duration duration) {
+ public void setCacheDuration(@Nullable final Duration duration) {
cacheDuration = prepareForAssignment(cacheDuration, duration);
}
/** {@inheritDoc} */
- public List<String> getSupportedProtocols() {
- return Collections.unmodifiableList(supportedProtocols);
+ @Nonnull @NotLive @Unmodifiable public List<String> getSupportedProtocols() {
+ return CollectionSupport.copyToList(supportedProtocols);
}
/** {@inheritDoc} */
- public boolean isSupportedProtocol(final String protocol) {
+ public boolean isSupportedProtocol(@Nonnull @NotEmpty final String protocol) {
return supportedProtocols.contains(protocol);
}
/** {@inheritDoc} */
- public void addSupportedProtocol(final String protocol) {
+ public void addSupportedProtocol(@Nonnull @NotEmpty final String protocol) {
final String trimmed = StringSupport.trimOrNull(protocol);
if (trimmed != null && !supportedProtocols.contains(trimmed)) {
releaseThisandParentDOM();
@@ -148,7 +155,7 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
}
/** {@inheritDoc} */
- public void removeSupportedProtocol(final String protocol) {
+ public void removeSupportedProtocol(@Nonnull @NotEmpty final String protocol) {
final String trimmed = StringSupport.trimOrNull(protocol);
if (trimmed != null && supportedProtocols.contains(trimmed)) {
releaseThisandParentDOM();
@@ -157,8 +164,9 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
}
/** {@inheritDoc} */
- public void removeSupportedProtocols(final Collection<String> protocols) {
+ public void removeSupportedProtocols(@Nonnull final Collection<String> protocols) {
for (final String protocol : protocols) {
+ assert protocol != null;
removeSupportedProtocol(protocol);
}
}
@@ -169,63 +177,62 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
}
/** {@inheritDoc} */
- public String getErrorURL() {
+ @Nullable public String getErrorURL() {
return errorURL;
}
/** {@inheritDoc} */
- public void setErrorURL(final String url) {
+ public void setErrorURL(@Nullable final String url) {
errorURL = prepareForAssignment(errorURL, url);
}
/** {@inheritDoc} */
- public Extensions getExtensions() {
+ @Nullable public Extensions getExtensions() {
return extensions;
}
/** {@inheritDoc} */
- public void setExtensions(final Extensions ext) {
+ public void setExtensions(@Nullable final Extensions ext) {
extensions = prepareForAssignment(extensions, ext);
}
/** {@inheritDoc} */
- public Organization getOrganization() {
+ @Nullable public Organization getOrganization() {
return organization;
}
/** {@inheritDoc} */
- public void setOrganization(final Organization org) {
+ public void setOrganization(@Nullable final Organization org) {
organization = prepareForAssignment(organization, org);
}
/** {@inheritDoc} */
- public List<ContactPerson> getContactPersons() {
+ @Nonnull @Live public List<ContactPerson> getContactPersons() {
return contactPersons;
}
/** {@inheritDoc} */
- public List<KeyDescriptor> getKeyDescriptors() {
+ @Nonnull @Live public List<KeyDescriptor> getKeyDescriptors() {
return keyDescriptors;
}
/** {@inheritDoc} */
- public AttributeMap getUnknownAttributes() {
+ @Nonnull public AttributeMap getUnknownAttributes() {
return unknownAttributes;
}
/** {@inheritDoc} */
- @Override
- public String getSignatureReferenceID() {
+ @Nullable public String getSignatureReferenceID() {
return id;
}
/** {@inheritDoc} */
- @Override
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- if (getSignature() != null) {
- children.add(getSignature());
+ final Signature sig = getSignature();
+ if (sig != null) {
+ children.add(sig);
}
if (extensions != null) {
@@ -242,4 +249,5 @@ public abstract class RoleDescriptorImpl extends AbstractSignableSAMLObject impl
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorImpl.java
index 170cf65e8..ed0d5e0ca 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SPSSODescriptorImpl.java
@@ -22,9 +22,10 @@
package org.opensaml.saml.saml2.metadata.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.XMLObject;
@@ -37,22 +38,27 @@ import org.opensaml.saml.saml2.metadata.AttributeConsumingService;
import org.opensaml.saml.saml2.metadata.Endpoint;
import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
+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.metadata.SPSSODescriptor}.
+ * Concrete implementation of {@link SPSSODescriptor}.
*/
public class SPSSODescriptorImpl extends SSODescriptorImpl implements SPSSODescriptor {
/** value for isAuthnRequestSigned attribute. */
- private XSBooleanValue authnRequestSigned;
+ @Nullable private XSBooleanValue authnRequestSigned;
/** value for the want assertion signed attribute. */
- private XSBooleanValue assertionSigned;
+ @Nullable private XSBooleanValue assertionSigned;
/** AssertionConsumerService children. */
- private final XMLObjectChildrenList<AssertionConsumerService> assertionConsumerServices;
+ @Nonnull private final XMLObjectChildrenList<AssertionConsumerService> assertionConsumerServices;
/** AttributeConsumingService children. */
- private final XMLObjectChildrenList<AttributeConsumingService> attributeConsumingServices;
+ @Nonnull private final XMLObjectChildrenList<AttributeConsumingService> attributeConsumingServices;
/**
* Constructor.
@@ -61,28 +67,28 @@ public class SPSSODescriptorImpl extends SSODescriptorImpl implements SPSSODescr
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SPSSODescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SPSSODescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
assertionConsumerServices = new XMLObjectChildrenList<>(this);
attributeConsumingServices = new XMLObjectChildrenList<>(this);
}
/** {@inheritDoc} */
- public Boolean isAuthnRequestsSigned() {
- if (authnRequestSigned == null) {
- return Boolean.FALSE;
+ @Nullable public Boolean isAuthnRequestsSigned() {
+ if (authnRequestSigned != null) {
+ return authnRequestSigned.getValue();
}
- return authnRequestSigned.getValue();
+ return Boolean.FALSE;
}
/** {@inheritDoc} */
- public XSBooleanValue isAuthnRequestsSignedXSBoolean() {
+ @Nullable public XSBooleanValue isAuthnRequestsSignedXSBoolean() {
return authnRequestSigned;
}
/** {@inheritDoc} */
- public void setAuthnRequestsSigned(final Boolean newIsSigned) {
+ public void setAuthnRequestsSigned(@Nullable final Boolean newIsSigned) {
if(newIsSigned != null){
authnRequestSigned = prepareForAssignment(authnRequestSigned, new XSBooleanValue(newIsSigned, false));
}else{
@@ -91,25 +97,25 @@ public class SPSSODescriptorImpl extends SSODescriptorImpl implements SPSSODescr
}
/** {@inheritDoc} */
- public void setAuthnRequestsSigned(final XSBooleanValue isSigned) {
+ public void setAuthnRequestsSigned(@Nullable final XSBooleanValue isSigned) {
authnRequestSigned = prepareForAssignment(authnRequestSigned, isSigned);
}
/** {@inheritDoc} */
- public Boolean getWantAssertionsSigned() {
- if (assertionSigned == null) {
- return Boolean.FALSE;
+ @Nullable public Boolean getWantAssertionsSigned() {
+ if (assertionSigned != null) {
+ return assertionSigned.getValue();
}
- return assertionSigned.getValue();
+ return Boolean.FALSE;
}
/** {@inheritDoc} */
- public XSBooleanValue getWantAssertionsSignedXSBoolean() {
+ @Nullable public XSBooleanValue getWantAssertionsSignedXSBoolean() {
return assertionSigned;
}
/** {@inheritDoc} */
- public void setWantAssertionsSigned(final Boolean wantAssestionSigned) {
+ public void setWantAssertionsSigned(@Nullable final Boolean wantAssestionSigned) {
if(wantAssestionSigned != null){
assertionSigned = prepareForAssignment(assertionSigned, new XSBooleanValue(wantAssestionSigned, false));
}else{
@@ -118,57 +124,63 @@ public class SPSSODescriptorImpl extends SSODescriptorImpl implements SPSSODescr
}
/** {@inheritDoc} */
- public void setWantAssertionsSigned(final XSBooleanValue wantAssestionSigned) {
+ public void setWantAssertionsSigned(@Nullable final XSBooleanValue wantAssestionSigned) {
this.assertionSigned = prepareForAssignment(this.assertionSigned, wantAssestionSigned);
}
/** {@inheritDoc} */
- public List<AssertionConsumerService> getAssertionConsumerServices() {
+ @Nonnull @Live public List<AssertionConsumerService> getAssertionConsumerServices() {
return assertionConsumerServices;
}
/** {@inheritDoc} */
- public AssertionConsumerService getDefaultAssertionConsumerService() {
+ @Nullable public AssertionConsumerService getDefaultAssertionConsumerService() {
return SAML2MetadataSupport.getDefaultIndexedEndpoint(assertionConsumerServices);
}
/** {@inheritDoc} */
- public List<AttributeConsumingService> getAttributeConsumingServices() {
+ @Nonnull @Live public List<AttributeConsumingService> getAttributeConsumingServices() {
return attributeConsumingServices;
}
/** {@inheritDoc} */
- public AttributeConsumingService getDefaultAttributeConsumingService(){
+ @Nullable public AttributeConsumingService getDefaultAttributeConsumingService(){
final AttributeConsumingServiceSelector selector = new AttributeConsumingServiceSelector();
selector.setRoleDescriptor(this);
return selector.selectService();
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints() {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints() {
final List<Endpoint> endpoints = new ArrayList<>();
endpoints.addAll(super.getEndpoints());
endpoints.addAll(assertionConsumerServices);
- return Collections.unmodifiableList(endpoints);
+ return CollectionSupport.copyToList(endpoints);
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints(final QName type) {
- if(type.equals(AssertionConsumerService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(assertionConsumerServices));
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints(@Nonnull final QName type) {
+ if( type.equals(AssertionConsumerService.DEFAULT_ELEMENT_NAME)) {
+ return CollectionSupport.copyToList(assertionConsumerServices);
}else{
return super.getEndpoints(type);
}
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
- children.addAll(super.getOrderedChildren());
+ final List<XMLObject> parentChildren = super.getOrderedChildren();
+ if (parentChildren != null) {
+ children.addAll(parentChildren);
+ }
+
children.addAll(assertionConsumerServices);
children.addAll(attributeConsumingServices);
- 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/saml2/metadata/impl/SSODescriptorImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SSODescriptorImpl.java
index dd5959989..4b1a72363 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SSODescriptorImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SSODescriptorImpl.java
@@ -22,9 +22,10 @@
package org.opensaml.saml.saml2.metadata.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.XMLObject;
@@ -37,24 +38,27 @@ import org.opensaml.saml.saml2.metadata.NameIDFormat;
import org.opensaml.saml.saml2.metadata.SSODescriptor;
import org.opensaml.saml.saml2.metadata.SingleLogoutService;
+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.metadata.SSODescriptor}.
+ * Concrete implementation of {@link SSODescriptor}.
*/
public abstract class SSODescriptorImpl extends RoleDescriptorImpl implements SSODescriptor {
/** Supported artifact resolutions services. */
- private final XMLObjectChildrenList<ArtifactResolutionService> artifactResolutionServices;
+ @Nonnull private final XMLObjectChildrenList<ArtifactResolutionService> artifactResolutionServices;
/** Logout services for this SSO entity. */
- private final XMLObjectChildrenList<SingleLogoutService> singleLogoutServices;
+ @Nonnull private final XMLObjectChildrenList<SingleLogoutService> singleLogoutServices;
/** Manage NameID services for this entity. */
- private final XMLObjectChildrenList<ManageNameIDService> manageNameIDServices;
+ @Nonnull private final XMLObjectChildrenList<ManageNameIDService> manageNameIDServices;
/** NameID formats supported by this entity. */
- private final XMLObjectChildrenList<NameIDFormat> nameIDFormats;
+ @Nonnull private final XMLObjectChildrenList<NameIDFormat> nameIDFormats;
/**
* Constructor.
@@ -63,8 +67,8 @@ public abstract class SSODescriptorImpl extends RoleDescriptorImpl implements SS
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SSODescriptorImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SSODescriptorImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
artifactResolutionServices = new XMLObjectChildrenList<>(this);
singleLogoutServices = new XMLObjectChildrenList<>(this);
@@ -73,54 +77,55 @@ public abstract class SSODescriptorImpl extends RoleDescriptorImpl implements SS
}
/** {@inheritDoc} */
- public List<ArtifactResolutionService> getArtifactResolutionServices() {
+ @Nonnull @Live public List<ArtifactResolutionService> getArtifactResolutionServices() {
return artifactResolutionServices;
}
/** {@inheritDoc} */
- public ArtifactResolutionService getDefaultArtifactResolutionService(){
+ @Nullable public ArtifactResolutionService getDefaultArtifactResolutionService() {
return SAML2MetadataSupport.getDefaultIndexedEndpoint(artifactResolutionServices);
}
/** {@inheritDoc} */
- public List<SingleLogoutService> getSingleLogoutServices() {
+ @Nonnull @Live public List<SingleLogoutService> getSingleLogoutServices() {
return singleLogoutServices;
}
/** {@inheritDoc} */
- public List<ManageNameIDService> getManageNameIDServices() {
+ @Nonnull @Live public List<ManageNameIDService> getManageNameIDServices() {
return manageNameIDServices;
}
/** {@inheritDoc} */
- public List<NameIDFormat> getNameIDFormats() {
+ @Nonnull @Live public List<NameIDFormat> getNameIDFormats() {
return nameIDFormats;
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints() {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints() {
final List<Endpoint> endpoints = new ArrayList<>();
endpoints.addAll(artifactResolutionServices);
endpoints.addAll(singleLogoutServices);
endpoints.addAll(manageNameIDServices);
- return Collections.unmodifiableList(endpoints);
+ return CollectionSupport.copyToList(endpoints);
}
/** {@inheritDoc} */
- public List<Endpoint> getEndpoints(final QName type) {
+ @Nonnull @NotLive @Unmodifiable public List<Endpoint> getEndpoints(@Nonnull final QName type) {
if(type.equals(ArtifactResolutionService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(artifactResolutionServices));
+ return CollectionSupport.copyToList(artifactResolutionServices);
}else if(type.equals(SingleLogoutService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(singleLogoutServices));
+ return CollectionSupport.copyToList(singleLogoutServices);
}else if(type.equals(ManageNameIDService.DEFAULT_ELEMENT_NAME)){
- return Collections.unmodifiableList(new ArrayList<Endpoint>(manageNameIDServices));
+ return CollectionSupport.copyToList(manageNameIDServices);
}
return CollectionSupport.emptyList();
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Override
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
final ArrayList<XMLObject> children = new ArrayList<>();
final List<XMLObject> parentChildren = super.getOrderedChildren();
@@ -134,4 +139,5 @@ public abstract class SSODescriptorImpl extends RoleDescriptorImpl implements SS
return CollectionSupport.copyToList(children);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceDescriptionImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceDescriptionImpl.java
index 112b9d95a..c48c5382d 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceDescriptionImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceDescriptionImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.ServiceDescription;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.ServiceDescription}.
+ * Concrete implementation of {@link ServiceDescription}.
*/
public class ServiceDescriptionImpl extends LocalizedNameImpl implements ServiceDescription {
@@ -35,8 +38,9 @@ public class ServiceDescriptionImpl extends LocalizedNameImpl implements Service
* @param elementLocalName Name
* @param namespacePrefix prefix
*/
- protected ServiceDescriptionImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected ServiceDescriptionImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceNameImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceNameImpl.java
index d68193b01..86eb0e63e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceNameImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/ServiceNameImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.ServiceName;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.ServiceName}.
+ * Concrete implementation of {@link ServiceName}.
*/
public class ServiceNameImpl extends LocalizedNameImpl implements ServiceName {
@@ -35,7 +38,8 @@ public class ServiceNameImpl extends LocalizedNameImpl implements ServiceName {
* @param elementLocalName local name
* @param namespacePrefix prefix
*/
- protected ServiceNameImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected ServiceNameImpl(@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/saml2/metadata/impl/SingleLogoutServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SingleLogoutServiceImpl.java
index 11816ded5..e92e0c541 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SingleLogoutServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SingleLogoutServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.SingleLogoutService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.SingleLogoutService}.
+ * Concrete implementation of {@link SingleLogoutService}.
*/
public class SingleLogoutServiceImpl extends EndpointImpl implements SingleLogoutService {
@@ -35,8 +38,9 @@ public class SingleLogoutServiceImpl extends EndpointImpl implements SingleLogou
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SingleLogoutServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SingleLogoutServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SingleSignOnServiceImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SingleSignOnServiceImpl.java
index cb2acdff1..09c28b1e7 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SingleSignOnServiceImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SingleSignOnServiceImpl.java
@@ -21,10 +21,13 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.saml.saml2.metadata.SingleSignOnService;
/**
- * Concrete implementation of {@link org.opensaml.saml.saml2.metadata.SingleSignOnService}.
+ * Concrete implementation of {@link SingleSignOnService}.
*/
public class SingleSignOnServiceImpl extends EndpointImpl implements SingleSignOnService {
@@ -35,8 +38,9 @@ public class SingleSignOnServiceImpl extends EndpointImpl implements SingleSignO
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SingleSignOnServiceImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected SingleSignOnServiceImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
+
}
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SurNameImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SurNameImpl.java
index 9ee424539..c7d22a295 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SurNameImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/SurNameImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.metadata.SurName;
@@ -36,7 +39,8 @@ public class SurNameImpl extends XSStringImpl implements SurName {
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected SurNameImpl(final String namespaceURI, final String elementLocalName, final String namespacePrefix) {
+ protected SurNameImpl(@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/saml2/metadata/impl/TelephoneNumberImpl.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/TelephoneNumberImpl.java
index c652d2438..7135565bb 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/TelephoneNumberImpl.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/metadata/impl/TelephoneNumberImpl.java
@@ -21,6 +21,9 @@
package org.opensaml.saml.saml2.metadata.impl;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.schema.impl.XSStringImpl;
import org.opensaml.saml.saml2.metadata.TelephoneNumber;
@@ -36,8 +39,8 @@ public class TelephoneNumberImpl extends XSStringImpl implements TelephoneNumber
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
- protected TelephoneNumberImpl(final String namespaceURI, final String elementLocalName,
- final String namespacePrefix) {
+ protected TelephoneNumberImpl(@Nullable final String namespaceURI, @Nonnull final String elementLocalName,
+ @Nullable final String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
}
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/core/tests/ResponseTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/core/tests/ResponseTest.java
index dd3632423..08b7f42ba 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/core/tests/ResponseTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/core/tests/ResponseTest.java
@@ -54,7 +54,7 @@ public class ResponseTest extends XMLObjectBaseTestCase {
try {
InputStream in = ResponseTest.class.getResourceAsStream(fullResponsePath);
Document responseDoc = parserPool.parse(in);
- Unmarshaller unmarshaller = XMLObjectProviderRegistrySupport.getUnmarshallerFactory().getUnmarshaller(
+ Unmarshaller unmarshaller = XMLObjectProviderRegistrySupport.getUnmarshallerFactory().ensureUnmarshaller(
responseDoc.getDocumentElement());
Response response = (Response) unmarshaller.unmarshall(responseDoc.getDocumentElement());
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/assertion/tests/SAML20AssertionValidatorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/assertion/tests/SAML20AssertionValidatorTest.java
index 0fde02414..49581f76f 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/assertion/tests/SAML20AssertionValidatorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/assertion/tests/SAML20AssertionValidatorTest.java
@@ -74,6 +74,8 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.resolver.CriteriaSet;
@@ -728,7 +730,7 @@ public class SAML20AssertionValidatorTest extends BaseAssertionValidationTest {
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
@@ -747,7 +749,7 @@ public class SAML20AssertionValidatorTest extends BaseAssertionValidationTest {
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/core/tests/MockBaseID.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/core/tests/MockBaseID.java
index ebac31fee..b52eaf401 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/core/tests/MockBaseID.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/core/tests/MockBaseID.java
@@ -19,24 +19,30 @@ package org.opensaml.saml.saml2.core.tests;
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.schema.XSString;
import org.opensaml.saml.saml2.core.BaseID;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+
/**
* Mock BaseID class for testing purposes.
*/
public class MockBaseID extends AbstractXMLObject implements BaseID, XSString {
/** String content. */
- private String content;
+ @Nullable private String content;
/** Name qualifier. */
- private String nameQualifier;
+ @Nullable private String nameQualifier;
/** SP name qualifier. */
- private String spNameQualifier;
+ @Nullable private String spNameQualifier;
/** Constructor. */
public MockBaseID() {
@@ -53,42 +59,43 @@ public class MockBaseID extends AbstractXMLObject implements BaseID, XSString {
* @param elementLocalName ...
* @param namespacePrefix ...
*/
- protected MockBaseID(String namespaceURI, String elementLocalName, String namespacePrefix) {
+ protected MockBaseID(@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 getSPNameQualifier() {
+ @Nullable public String getSPNameQualifier() {
return spNameQualifier;
}
/** {@inheritDoc} */
- public void setNameQualifier(String newNameQualifier) {
+ public void setNameQualifier(@Nullable final String newNameQualifier) {
nameQualifier = prepareForAssignment(nameQualifier, newNameQualifier);
}
/** {@inheritDoc} */
- public void setSPNameQualifier(String newSPNameQualifier) {
+ public void setSPNameQualifier(@Nullable final String newSPNameQualifier) {
spNameQualifier = prepareForAssignment(spNameQualifier, newSPNameQualifier);
}
/** {@inheritDoc} */
- public List<XMLObject> getOrderedChildren() {
+ @Nullable @NotLive @Unmodifiable public List<XMLObject> getOrderedChildren() {
return null;
}
/** {@inheritDoc} */
- public String getValue() {
+ @Nullable public String getValue() {
return content;
}
/** {@inheritDoc} */
- public void setValue(String newValue) {
+ public void setValue(@Nullable final String newValue) {
content = prepareForAssignment(content, newValue);
}
}
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorTest.java
index 538f691bc..37d8b8696 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AttributeAuthorityDescriptorTest.java
@@ -73,7 +73,7 @@ public class AttributeAuthorityDescriptorTest extends XMLObjectProviderBaseTestC
Assert.assertEquals(descriptor.getEndpoints(qname).size(), 1);
qname = new QName(SAMLConstants.SAML20MD_NS, AssertionIDRequestService.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
Assert.assertEquals(descriptor.getEndpoints(qname).size(), 2);
- Assert.assertNull(descriptor.getEndpoints(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME));
+ Assert.assertTrue(descriptor.getEndpoints(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME).isEmpty());
}
/** {@inheritDoc} */
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java
index 72a104cb4..fe14113ef 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/AuthnAuthorityDescriptorTest.java
@@ -163,7 +163,7 @@ public class AuthnAuthorityDescriptorTest extends XMLObjectProviderBaseTestCase
expectedAuthnQueryServices, "Endpoints(AuthnQueryService) count");
Assert.assertEquals(authnAuthorityObj.getEndpoints(AssertionIDRequestService.DEFAULT_ELEMENT_NAME).size(),
expectedAssertionIdRequestServices, "Endpoints(AssertionIdRequestService) count");
- Assert.assertNull(authnAuthorityObj.getEndpoints(EntityDescriptor.DEFAULT_ELEMENT_NAME));
+ Assert.assertTrue(authnAuthorityObj.getEndpoints(EntityDescriptor.DEFAULT_ELEMENT_NAME).isEmpty());
}
/** {@inheritDoc} */
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java
index 2ba7245b9..b69bf28da 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/metadata/impl/PDPDescriptorTest.java
@@ -109,7 +109,7 @@ public class PDPDescriptorTest extends XMLObjectProviderBaseTestCase {
Assert.assertEquals(descriptor.getEndpoints(AssertionIDRequestService.DEFAULT_ELEMENT_NAME).size(), 2,
"AssertionIDRequestService count");
- Assert.assertNull(descriptor.getEndpoints(PDPDescriptor.DEFAULT_ELEMENT_NAME));
+ Assert.assertTrue(descriptor.getEndpoints(PDPDescriptor.DEFAULT_ELEMENT_NAME).isEmpty());
Assert.assertEquals(descriptor.getEndpoints().size(), 5, "EndPoints");
Assert.assertEquals(descriptor.getNameIDFormats().size(), 1, "NameIDFormat count");
diff --git a/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java b/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java
index 2d9bbe8b9..d31db1efb 100644
--- a/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java
+++ b/opensaml-testing/src/main/java/org/opensaml/core/testing/XMLObjectBaseTestCase.java
@@ -109,14 +109,14 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
* @param xmlObject the XMLObject to be marshalled and compared against the expected DOM
*/
protected void assertXMLEquals(String failMessage, Document expectedDOM, XMLObject xmlObject) {
- Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
+ final Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
if (marshaller == null) {
Assert.fail("Unable to locate marshaller for " + xmlObject.getElementQName()
+ " can not perform equality check assertion");
}
try {
- Element generatedDOM = marshaller.marshall(xmlObject, parserPool.newDocument());
+ final Element generatedDOM = marshaller.marshall(xmlObject, parserPool.newDocument());
if (log.isDebugEnabled()) {
log.debug("Marshalled DOM was " + SerializeSupport.nodeToString(generatedDOM));
}
@@ -125,7 +125,7 @@ public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase {
.checkForIdentical()
.build();
Assert.assertFalse(diff.hasDifferences(), failMessage);
- } catch (Exception e) {
+ } catch (final Exception e) {
Assert.fail("Marshalling failed with the following error: " + e);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list