Package org.opensaml.core.xml

# Class AbstractXSAnyAdapter

java.lang.Object
org.opensaml.core.xml.AbstractXSAnyAdapter

All Implemented Interfaces:
  `XMLObject`, `XSAnyAdapter`

Direct Known Subclasses:
  `BaseIDXSAnyAdapter`, `ConditionXSAnyAdapter`, `RoleDescriptorXSAnyAdapter`, `StatementXSAnyAdapter`

public abstract class AbstractXSAnyAdapter extends Object implements XSAnyAdapter
Abstract base class for implementations that adapt/wrap an instance of `XSAny`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private XSAny`
`adapted`
The adapted XSAny instance.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractXSAnyAdapter(XSAny xsAny)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`detach()`
Detaches the XMLObject from its parent.
`Element`
`ensureDOM()`
Gets the DOM representation of this XMLObject, if one exists, or raises a `ConstraintViolationException`.
`XSAny`
`getAdapted()`
Get the adapted `XSAny` instance.
`Element`
`getDOM()`
Gets the DOM representation of this XMLObject, if one exists.
`QName`
`getElementQName()`
Gets the QName for this element.
`IDIndex`
`getIDIndex()`
Get the IDIndex holding the ID-to-XMLObject index mapping, rooted at this XMLObject's subtree.
`NamespaceManager`
`getNamespaceManager()`
Gets the `NamespaceManager` instance for this object.
`Set<Namespace>`
`getNamespaces()`
Gets the namespaces that are scoped to this element.
`String`
`getNoNamespaceSchemaLocation()`
Gets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.
`LockableClassToInstanceMultiMap<Object>`
`getObjectMetadata()`
Get the mutable multimap which holds additional information (represented by plain Java object instances) associated with this XMLObject.
`List<XMLObject>`
`getOrderedChildren()`
Gets an unmodifiable list of child elements in the order that they will appear in the DOM.
`XMLObject`
`getParent()`
Gets the parent of this element or null if there is no parent.
`String`
`getSchemaLocation()`
Gets the value of the XML Schema schemaLocation attribute for this object.
`QName`
`getSchemaType()`
Gets the XML schema type of this element.
`boolean`
`hasChildren()`
Checks if this XMLObject has children.
`boolean`
`hasParent()`
Checks to see if this object has a parent.
`Boolean`
`isNil()`
Gets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.
`XSBooleanValue`
`isNilXSBoolean()`
Gets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.
`void`
`releaseChildrenDOM(boolean propagateRelease)`
Releases the DOM representation of this XMLObject's children.
`void`
`releaseDOM()`
Releases the DOM representation of this XMLObject, if there is one.
`void`
`releaseParentDOM(boolean propagateRelease)`
Releases the DOM representation of this XMLObject's parent.
`XMLObject`
`resolveID(String id)`
Find the XMLObject identified by the specified ID attribute, within the subtree of XMLObjects which has this XMLObject as its root.
`XMLObject`
`resolveIDFromRoot(String id)`
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`
`setDOM(Element dom)`
Sets the DOM representation of this XMLObject.
`void`
`setNil(Boolean newNil)`
Sets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.
`void`
`setNil(XSBooleanValue newNil)`
Sets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.
`void`
`setNoNamespaceSchemaLocation(String location)`
Sets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.
`void`
`setParent(XMLObject parent)`
Sets the parent of this element.
`void`
`setSchemaLocation(String location)`
Sets the value of the XML Schema schemaLocation attribute for this object.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### adapted

@Nonnull private XSAny adapted
The adapted XSAny instance.

## Constructor Details

### AbstractXSAnyAdapter

protected AbstractXSAnyAdapter(@Nonnull XSAny xsAny)
Constructor.

Parameters:
  `xsAny` - the adapted XSAny instance

## Method Details

### getAdapted

@Nonnull public XSAny getAdapted()
Get the adapted `XSAny` instance.

Specified by:
  `getAdapted` in interface `XSAnyAdapter`
Returns:
  the adapted XSAny

### 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.

Specified by:
  `detach` in interface `XMLObject`

### getDOM

@Nullable public Element getDOM()
Gets the DOM representation of this XMLObject, if one exists.

Specified by:
  `getDOM` in interface `XMLObject`
Returns:
  the DOM representation of this XMLObject, or null

### ensureDOM

@Nonnull public Element ensureDOM()
Gets the DOM representation of this XMLObject, if one exists, or raises a `ConstraintViolationException`.

Specified by:
  `ensureDOM` in interface `XMLObject`
Returns:
  the DOM representation of this XMLObject

### getElementQName

@Nonnull public QName getElementQName()
Gets the QName for this element. This QName MUST contain the namespace URI, namespace prefix, and local element name.

Specified by:
  `getElementQName` in interface `XMLObject`
Returns:
  the QName for this attribute

### getIDIndex

@Nonnull public IDIndex getIDIndex()
Get the IDIndex holding the ID-to-XMLObject index mapping, rooted at this XMLObject's subtree.

Specified by:
  `getIDIndex` in interface `XMLObject`
Returns:
  the IDIndex owned by this XMLObject

### getNamespaceManager

@Nonnull public NamespaceManager getNamespaceManager()
Gets the `NamespaceManager` instance for this object.

Specified by:
  `getNamespaceManager` in interface `XMLObject`
Returns:
  the namespace manager for this object

### getNamespaces

@Nonnull public Set<Namespace> getNamespaces()
Gets the namespaces that are scoped to this element.

Specified by:
  `getNamespaces` in interface `XMLObject`
Returns:
  the namespaces that are scoped to this element

### getNoNamespaceSchemaLocation

@Nullable public String getNoNamespaceSchemaLocation()
Gets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.

Specified by:
  `getNoNamespaceSchemaLocation` in interface `XMLObject`
Returns:
  value of the XML Schema noNamespaceSchemaLocation attribute for this object

### getOrderedChildren

@Nullable public List<XMLObject> getOrderedChildren()
Gets an unmodifiable list of child elements in the order that they will appear in the DOM.

Specified by:
  `getOrderedChildren` in interface `XMLObject`
Returns:
  ordered list of child elements

### getParent

@Nullable public XMLObject getParent()
Gets the parent of this element or null if there is no parent.

Specified by:
  `getParent` in interface `XMLObject`
Returns:
  the parent of this element or null

### getSchemaLocation

@Nullable public String getSchemaLocation()
Gets the value of the XML Schema schemaLocation attribute for this object.

Specified by:
  `getSchemaLocation` in interface `XMLObject`
Returns:
  schema location defined for this object

### getSchemaType

@Nullable public QName getSchemaType()
Gets the XML schema type of this element. This translates to the contents of the xsi:type attribute.

Specified by:
  `getSchemaType` in interface `XMLObject`
Returns:
  XML schema type of this element, or null

### hasChildren

public boolean hasChildren()
Checks if this XMLObject has children.

Specified by:
  `hasChildren` in interface `XMLObject`
Returns:
  true if this XMLObject has children, false if not

### hasParent

public boolean hasParent()
Checks to see if this object has a parent.

Specified by:
  `hasParent` in interface `XMLObject`
Returns:
  true if the object has a parent, false if not

### releaseChildrenDOM

public void releaseChildrenDOM(boolean propagateRelease)
Releases the DOM representation of this XMLObject's children.

Specified by:
  `releaseChildrenDOM` in interface `XMLObject`
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 interface `XMLObject`

### releaseParentDOM

public void releaseParentDOM(boolean propagateRelease)
Releases the DOM representation of this XMLObject's parent.

Specified by:
  `releaseParentDOM` in interface `XMLObject`
Parameters:
  `propagateRelease` - true if all ancestors of this element should release their DOM

### resolveID

@Nullable public XMLObject resolveID(@Nonnull String id)
Find the XMLObject identified by the specified ID attribute, within the subtree of XMLObjects which has this XMLObject as its root.

Specified by:
  `resolveID` in interface `XMLObject`
Parameters:
  `id` - the ID attribute to resolve to an XMLObject
Returns:
  the XMLObject identified by the specified ID attribute value, or null

### resolveIDFromRoot

@Nullable public XMLObject resolveIDFromRoot(@Nonnull String id)
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 interface `XMLObject`
Parameters:
  `id` - the ID attribute to resolve to an XMLObject
Returns:
  the XMLObject identified by the specified ID attribute value, or null

### setDOM

public void setDOM(@Nullable Element dom)
Sets the DOM representation of this XMLObject.

Specified by:
  `setDOM` in interface `XMLObject`
Parameters:
  `dom` - DOM representation of this XMLObject

### setNoNamespaceSchemaLocation

public void setNoNamespaceSchemaLocation(@Nullable String location)
Sets the value of the XML Schema noNamespaceSchemaLocation attribute for this object.

Specified by:
  `setNoNamespaceSchemaLocation` in interface `XMLObject`
Parameters:
  `location` - value of the XML Schema noNamespaceSchemaLocation attribute for this object

### setParent

public void setParent(@Nullable XMLObject parent)
Sets the parent of this element.

Specified by:
  `setParent` in interface `XMLObject`
Parameters:
  `parent` - the parent of this element

### setSchemaLocation

public void setSchemaLocation(@Nullable String location)
Sets the value of the XML Schema schemaLocation attribute for this object.

Specified by:
  `setSchemaLocation` in interface `XMLObject`
Parameters:
  `location` - value of the XML Schema schemaLocation attribute for this object

### isNil

@Nullable public Boolean isNil()
Gets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.

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:
  `isNil` in interface `XMLObject`
Returns:
  whether the object's content model is null
See Also:
  - XML Schema: Nil Values

### isNilXSBoolean

@Nullable public XSBooleanValue isNilXSBoolean()
Gets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.

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 interface `XMLObject`
Returns:
  whether the object's content model is null
See Also:
  - XML Schema: Nil Values

### setNil

public void setNil(@Nullable Boolean newNil)
Sets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.

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:
  `setNil` in interface `XMLObject`
Parameters:
  `newNil` - whether the object's content model is expressed as null
See Also:
  - XML Schema: Nil Values

### setNil

public void setNil(@Nullable XSBooleanValue newNil)
Sets whether the object declares that its element content is null, which corresponds to an `xsi:nil` attribute of `true`.

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:
  `setNil` in interface `XMLObject`
Parameters:
  `newNil` - whether the object's content model is expressed as null
See Also:
  - XML Schema: Nil Values

### getObjectMetadata

@Nonnull public LockableClassToInstanceMultiMap<Object> 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 the `Class` types representing all superclasses (excluding `java.lang.Object`) and all implemented interfaces.

Specified by:
  `getObjectMetadata` in interface `XMLObject`
Returns:
  the class-to-instance multimap