Class AbstractXMLObject
- All Implemented Interfaces:
XMLObject
- Direct Known Subclasses:
AbstractElementExtensibleXMLObject
,AbstractExtensibleSOAPObject
,AbstractSignableXMLObject
,AbstractWSAddressingObject
,AbstractWSPolicyObject
,AbstractWSSecurityObject
,AbstractWSTrustObject
,AbstractXACMLObject
,AddressImpl
,AdviceImpl
,AdviceImpl
,AgreementMethodImpl
,AlgorithmIdentifierTypeImpl
,AppliesToImpl
,AsynchronousImpl
,AttributeConsumingServiceImpl
,AttributeDesignatorImpl
,AttributeImpl
,AttributeStatementImpl
,AudienceRestrictionConditionImpl
,AudienceRestrictionImpl
,AuthnContextImpl
,AuthnStatementImpl
,AuthorityBindingImpl
,AuthzDecisionStatementImpl
,BaseIDImpl
,CipherDataImpl
,CipherReferenceImpl
,ConcatKDFParamsImpl
,ConditionsImpl
,ConditionsImpl
,ContactPersonImpl
,DelegateImpl
,DelegationRestrictionTypeImpl
,DerivedKeyImpl
,DHKeyValueImpl
,DigestMethodImpl
,DigestMethodImpl
,DiscoHintsImpl
,DoNotCacheConditionImpl
,DSAKeyValueImpl
,ECKeyValueImpl
,EncryptedElementTypeImpl
,EncryptedTypeImpl
,EncryptionMethodImpl
,EncryptionPropertiesImpl
,EncryptionPropertyImpl
,EndpointImpl
,EndPointReferenceImpl
,EntityAttributesImpl
,EvidenceImpl
,EvidenceImpl
,ExtensionsImpl
,ExtensionsImpl
,FaultImpl
,IDPEntryImpl
,IDPListImpl
,KeyDerivationMethodImpl
,KeyDescriptorImpl
,KeyInfoImpl
,KeyInfoReferenceImpl
,KeyValueImpl
,KeywordsImpl
,NamedCurveImpl
,NameIDPolicyImpl
,OneTimeUseImpl
,OrganizationImpl
,PBKDF2ParamsImpl
,PGPDataImpl
,ProxyRestrictionImpl
,PublicationImpl
,PublicationInfoImpl
,PublicationPathImpl
,ReferencedPoliciesTypeImpl
,ReferenceListImpl
,ReferenceTypeImpl
,RegistrationInfoImpl
,RequestAuthenticatedImpl
,RequestedAttributesImpl
,RequestedAuthnContextImpl
,RequestedSecurityTokenImpl
,RequestImpl
,RequestSecurityTokenResponseImpl
,RespondWithImpl
,ResponseImpl
,RetrievalMethodImpl
,RSAKeyValueImpl
,SaltImpl
,ScopingImpl
,SessionKeyImpl
,SignatureImpl
,SigningMethodImpl
,SPKIDataImpl
,StatusCodeImpl
,StatusCodeImpl
,StatusDetailImpl
,StatusDetailImpl
,StatusImpl
,StatusImpl
,SubjectConfirmationDataImpl
,SubjectConfirmationImpl
,SubjectConfirmationImpl
,SubjectConfirmationImpl
,SubjectImpl
,SubjectImpl
,SubjectLocalityImpl
,SubjectLocalityImpl
,SubjectQueryImpl
,SubjectStatementImpl
,TerminateImpl
,TransformImpl
,TransformsImpl
,TransformsImpl
,UIInfoImpl
,X509CertificateImpl
,X509CRLImpl
,X509DataImpl
,X509IssuerSerialImpl
,X509SerialNumberImpl
,XACMLAuthzDecisionStatementTypeImpl
,XACMLPolicyStatementTypeImpl
,XSAnyImpl
,XSBase64BinaryImpl
,XSBooleanImpl
,XSDateTimeImpl
,XSIntegerImpl
,XSQNameImpl
,XSStringImpl
,XSURIImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Element
DOM Element representation of this object.private QName
The name of this element with namespace and prefix information.private final IDIndex
Mapping of ID attributes to XMLObjects in the subtree rooted at this object.private final org.slf4j.Logger
Class logger.private XSBooleanValue
The value of thexsi:nil
attribute.private String
No-namespace schema locations for this XML object.private NamespaceManager
The namespace manager for this XML object.private final LockableClassToInstanceMultiMap<Object>
The multimap holding class-indexed instances of additional info associated with this XML object.private XMLObject
Parent of this element.private String
Schema locations for this XML object.private QName
The schema type of this element with namespace and prefix information. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractXMLObject
(String namespaceURI, String elementLocalName, String namespacePrefix) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
detach()
Detaches the XMLObject from its parent.getDOM()
Gets the DOM representation of this XMLObject, if one exists.Gets the QName for this element.Get the IDIndex holding the ID-to-XMLObject index mapping, rooted at this XMLObject's subtree.Gets theNamespaceManager
instance for this object.Gets the namespaces that are scoped to this element.Gets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.Get the mutable multimap which holds additional information (represented by plain Java object instances) associated with this XMLObject.Gets the parent of this element or null if there is no parent.Gets the value of the XML Schema schemaLocation attribute for this object.Gets the XML schema type of this element.boolean
Checks if this XMLObject has children.boolean
Checks to see if this object has a parent.isNil()
Gets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.Gets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.protected void
manageQualifiedAttributeNamespace
(QName attributeName, boolean hasValue) A helper function for derived classes.protected QName
prepareAttributeValueForAssignment
(String attributeID, QName oldValue, QName newValue) A helper function for derived classes.protected QName
prepareElementContentForAssignment
(QName oldValue, QName newValue) A helper function for derived classes.protected String
prepareForAssignment
(String oldValue, String newValue) A helper function for derived classes.protected String
prepareForAssignment
(String oldValue, String newValue, boolean normalize) A helper function for derived classes.protected <T> T
prepareForAssignment
(T oldValue, T newValue) A helper function for derived classes that checks to see if the old and new value are equal and if so releases the cached dom.protected void
registerOwnID
(String oldID, String newID) A helper function for derived classes.void
releaseChildrenDOM
(boolean propagateRelease) Releases the DOM representation of this XMLObject's children.void
Releases the DOM representation of this XMLObject, if there is one.void
releaseParentDOM
(boolean propagateRelease) Releases the DOM representation of this XMLObject's parent.void
A convenience method that is equal to callingreleaseDOM()
thenreleaseChildrenDOM(boolean)
with the release being propagated.void
A convenience method that is equal to callingreleaseDOM()
thenreleaseParentDOM(boolean)
with the release being propagated.Find the XMLObject identified by the specified ID attribute, within the subtree of XMLObjects which has this XMLObject as its root.Find the XMLObject identified by the specified ID attribute, from the root of the tree of XMLObjects in which this XMLObject is a member.void
Sets the DOM representation of this XMLObject.void
setElementNamespacePrefix
(String prefix) Sets the prefix for this element's namespace.protected void
setElementQName
(QName name) Sets the element QName.void
Sets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.void
setNil
(XSBooleanValue newNil) Sets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.void
setNoNamespaceSchemaLocation
(String location) Sets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.void
Sets the parent of this element.void
setSchemaLocation
(String location) Sets the value of the XML Schema schemaLocation attribute for this object.protected void
setSchemaType
(QName type) Sets a given QName as the schema type for the Element represented by this XMLObject.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensaml.core.xml.XMLObject
getOrderedChildren
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
parent
Parent of this element. -
elementQname
The name of this element with namespace and prefix information. -
schemaLocation
Schema locations for this XML object. -
noNamespaceSchemaLocation
No-namespace schema locations for this XML object. -
typeQname
The schema type of this element with namespace and prefix information. -
dom
DOM Element representation of this object. -
nil
The value of thexsi:nil
attribute. -
nsManager
The namespace manager for this XML object. -
objectMetadata
The multimap holding class-indexed instances of additional info associated with this XML object. -
idIndex
Mapping of ID attributes to XMLObjects in the subtree rooted at this object. This allows constant-time dereferencing of ID-typed attributes within the subtree.
-
-
Constructor Details
-
AbstractXMLObject
protected AbstractXMLObject(@Nullable String namespaceURI, @Nonnull @NotEmpty String elementLocalName, @Nullable String namespacePrefix) Constructor.- Parameters:
namespaceURI
- the namespace the element is inelementLocalName
- the local name of the XML element this Object representsnamespacePrefix
- the prefix for the given namespace
-
-
Method Details
-
detach
public void detach()Detaches the XMLObject from its parent. This will release the parent's cached DOM (if it has one) and set this object's parent to null. It does not remove this object from its parent, that's the responsibility of the invoker of this method, nor does it re-root the cached DOM node (if there is one) in a new document. This is handled at marshalling time. -
getDOM
Gets the DOM representation of this XMLObject, if one exists. -
getElementQName
Gets the QName for this element. This QName MUST contain the namespace URI, namespace prefix, and local element name.- Specified by:
getElementQName
in interfaceXMLObject
- Returns:
- the QName for this attribute
-
getIDIndex
Get the IDIndex holding the ID-to-XMLObject index mapping, rooted at this XMLObject's subtree.- Specified by:
getIDIndex
in interfaceXMLObject
- Returns:
- the IDIndex owned by this XMLObject
-
getNamespaceManager
Gets theNamespaceManager
instance for this object.- Specified by:
getNamespaceManager
in interfaceXMLObject
- Returns:
- the namespace manager for this object
-
getNamespaces
Gets the namespaces that are scoped to this element.- Specified by:
getNamespaces
in interfaceXMLObject
- Returns:
- the namespaces that are scoped to this element
-
getNoNamespaceSchemaLocation
Gets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.- Specified by:
getNoNamespaceSchemaLocation
in interfaceXMLObject
- Returns:
- value of the XML Schema noNamespaceSchemaLocation attribute for this object
-
getParent
Gets the parent of this element or null if there is no parent. -
getSchemaLocation
Gets the value of the XML Schema schemaLocation attribute for this object.- Specified by:
getSchemaLocation
in interfaceXMLObject
- Returns:
- schema location defined for this object
-
getSchemaType
Gets the XML schema type of this element. This translates to the contents of the xsi:type attribute.- Specified by:
getSchemaType
in interfaceXMLObject
- Returns:
- XML schema type of this element, or null
-
hasChildren
public boolean hasChildren()Checks if this XMLObject has children.- Specified by:
hasChildren
in interfaceXMLObject
- Returns:
- true if this XMLObject has children, false if not
-
hasParent
public boolean hasParent()Checks to see if this object has a parent. -
manageQualifiedAttributeNamespace
A helper function for derived classes. This method should be called when the value of a namespace-qualified attribute changes.- Parameters:
attributeName
- the attribute namehasValue
- true to indicate that the attribute has a value, false to indicate it has no value
-
prepareElementContentForAssignment
@Nullable protected QName prepareElementContentForAssignment(@Nullable QName oldValue, @Nullable QName newValue) A helper function for derived classes. This checks for semantic equality between two QNames, and if they are different invalidates the DOM. It returns the normalized value so subclasses just have to use: this.foo = prepareElementContentForAssignment(this.foo, foo);- Parameters:
oldValue
- - the current valuenewValue
- - the new value- Returns:
- the value that should be assigned
-
prepareAttributeValueForAssignment
@Nullable protected QName prepareAttributeValueForAssignment(@Nonnull String attributeID, @Nullable QName oldValue, @Nullable QName newValue) A helper function for derived classes. This checks for semantic equality between two QNames and if they are different invalidates the DOM. It returns the normalized value so subclasses just have to use: this.foo = prepareAttributeValueForAssignment(this.foo, foo);- Parameters:
attributeID
- - unique identifier of the attribute in the content model within this XMLObject, used to identify the attribute within the XMLObject's NamespaceManageroldValue
- - the current valuenewValue
- - the new value- Returns:
- the value that should be assigned
-
prepareForAssignment
@Nullable protected String prepareForAssignment(@Nullable String oldValue, @Nullable String newValue) A helper function for derived classes. This 'normalizes' newString and then if it is different from oldString invalidates the DOM. It returns the normalized value so subclasses just have to use: this.foo = prepareForAssignment(this.foo, foo);- Parameters:
oldValue
- - the current valuenewValue
- - the new value- Returns:
- the value that should be assigned
-
prepareForAssignment
@Nullable protected String prepareForAssignment(@Nullable String oldValue, @Nullable String newValue, boolean normalize) A helper function for derived classes. This 'normalizes' newString ifnormalize=true
, and then if it is different from oldString invalidates the DOM. It returns the new effective value so subclasses just have to go. this.foo = prepareForAssignment(this.foo, foo);- Parameters:
oldValue
- - the current valuenewValue
- - the new valuenormalize
- - whether the newValue should be normalized- Returns:
- the value that should be assigned
-
prepareForAssignment
@Nullable protected <T> T prepareForAssignment(@Nullable T oldValue, @Nullable T newValue) A helper function for derived classes that checks to see if the old and new value are equal and if so releases the cached dom. Derived classes are expected to use this thus:this.foo = prepareForAssignment(this.foo, foo);
This method will do a (null) safe compare of the objects and will also invalidate the DOM if appropriate- Type Parameters:
T
- - type of object being compared and assigned- Parameters:
oldValue
- - current valuenewValue
- - proposed new value- Returns:
- The value to assign to the saved Object.
-
prepareForAssignment
@Nullable protected <T extends XMLObject> T prepareForAssignment(@Nullable T oldValue, @Nullable T newValue) A helper function for derived classes, similar to assignString, but for (singleton) XML objects. It is indifferent to whether either the old or the new version of the value is null. Derived classes are expected to use this thus:this.foo = prepareForAssignment(this.foo, foo);
This method will do a (null) safe compare of the objects and will also invalidate the DOM if appropriate- Type Parameters:
T
- type of object being compared and assigned- Parameters:
oldValue
- current valuenewValue
- proposed new value- Returns:
- The value to assign to the saved Object.
-
registerOwnID
A helper function for derived classes. The mutator/setter method for any ID-typed attributes should call this method in order to handle getting the old value removed from the ID-to-XMLObject mapping, and the new value added to the mapping.- Parameters:
oldID
- the old value of the ID-typed attributenewID
- the new value of the ID-typed attribute
-
releaseChildrenDOM
public void releaseChildrenDOM(boolean propagateRelease) Releases the DOM representation of this XMLObject's children.- Specified by:
releaseChildrenDOM
in interfaceXMLObject
- Parameters:
propagateRelease
- true if all descendants of this element should release their DOM
-
releaseDOM
public void releaseDOM()Releases the DOM representation of this XMLObject, if there is one.- Specified by:
releaseDOM
in interfaceXMLObject
-
releaseParentDOM
public void releaseParentDOM(boolean propagateRelease) Releases the DOM representation of this XMLObject's parent.- Specified by:
releaseParentDOM
in interfaceXMLObject
- Parameters:
propagateRelease
- true if all ancestors of this element should release their DOM
-
releaseThisAndChildrenDOM
public void releaseThisAndChildrenDOM()A convenience method that is equal to callingreleaseDOM()
thenreleaseChildrenDOM(boolean)
with the release being propagated. -
releaseThisandParentDOM
public void releaseThisandParentDOM()A convenience method that is equal to callingreleaseDOM()
thenreleaseParentDOM(boolean)
with the release being propagated. -
resolveID
Find the XMLObject identified by the specified ID attribute, within the subtree of XMLObjects which has this XMLObject as its root. -
resolveIDFromRoot
Find the XMLObject identified by the specified ID attribute, from the root of the tree of XMLObjects in which this XMLObject is a member.- Specified by:
resolveIDFromRoot
in interfaceXMLObject
- Parameters:
id
- the ID attribute to resolve to an XMLObject- Returns:
- the XMLObject identified by the specified ID attribute value, or null
-
setDOM
Sets the DOM representation of this XMLObject. -
setElementNamespacePrefix
Sets the prefix for this element's namespace.- Parameters:
prefix
- the prefix for this element's namespace
-
setElementQName
Sets the element QName.- Parameters:
name
- the element's QName
-
setNoNamespaceSchemaLocation
Sets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.- Specified by:
setNoNamespaceSchemaLocation
in interfaceXMLObject
- Parameters:
location
- value of the XML Schema noNamespaceSchemaLocation attribute for this object
-
setParent
Sets the parent of this element. -
setSchemaLocation
Sets the value of the XML Schema schemaLocation attribute for this object.- Specified by:
setSchemaLocation
in interfaceXMLObject
- Parameters:
location
- value of the XML Schema schemaLocation attribute for this object
-
setSchemaType
Sets a given QName as the schema type for the Element represented by this XMLObject. This will register the namespace for the type as well as for the xsi:type qualified attribute name with the namespace manager for this XMLObject. If null is passed, the type name and xsi:type name will be deregistered.- Parameters:
type
- the schema type
-
isNil
Gets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
-
isNilXSBoolean
Gets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
- Specified by:
isNilXSBoolean
in interfaceXMLObject
- Returns:
- whether the object's content model is null
- See Also:
-
setNil
Sets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
-
setNil
Sets whether the object declares that its element content is null, which corresponds to anxsi:nil
attribute oftrue
.Note that it is up to the developer to ensure that the value of this attribute is consistent with the actual element content on the object instance.
Per the XML Schema specification, a value of true disallows element content, but not element attributes.
-
getObjectMetadata
Get the mutable multimap which holds additional information (represented by plain Java object instances) associated with this XMLObject.Objects added to this multimap will be indexed and retrievable by their concrete
Class
as well as by theClass
types representing all superclasses (excludingjava.lang.Object
) and all implemented interfaces.- Specified by:
getObjectMetadata
in interfaceXMLObject
- Returns:
- the class-to-instance multimap
-