public abstract class AbstractXMLObject extends Object implements XMLObject
Modifier | Constructor and Description |
---|---|
protected |
AbstractXMLObject(String namespaceURI,
String elementLocalName,
String namespacePrefix)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addNamespace(Namespace newNamespace)
Adds a namespace to the ones already scoped to this element.
|
void |
detach()
Detaches the XMLObject from its parent.
|
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.
|
XMLObject |
getParent()
Gets the parent of this element.
|
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 . |
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 QName |
prepareForAssignment(QName oldValue,
QName newValue)
Deprecated.
replacement
prepareAttributeValueForAssignment(String, QName, QName)
or prepareElementContentForAssignment(QName, QName) as appropriate |
protected String |
prepareForAssignment(String oldValue,
String newValue)
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 <T extends XMLObject> |
prepareForAssignment(T oldValue,
T newValue)
A helper function for derived classes, similar to assignString, but for (singleton) SAML objects.
|
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 |
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.
|
void |
releaseThisAndChildrenDOM()
A convience method that is equal to calling
releaseDOM() then releaseChildrenDOM(boolean) with
the release being propogated. |
void |
releaseThisandParentDOM()
A convience method that is equal to calling
releaseDOM() then releaseParentDOM(boolean) with
the release being propogated. |
void |
removeNamespace(Namespace namespace)
Removes a namespace from this element.
|
XMLObject |
resolveID(String id)
Find the XMLObject which is 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 which is identified by the specified ID attribute, from the root of the tree of XMLObjects in
which this XMLObject is a member.
|
void |
setDOM(Element newDom)
Sets the DOM representation of this XMLObject.
|
void |
setElementNamespacePrefix(String prefix)
Sets the prefix for this element's namespace.
|
protected void |
setElementQName(QName elementQName)
Sets the element QName.
|
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 newParent)
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOrderedChildren
protected AbstractXMLObject(String namespaceURI, String elementLocalName, String namespacePrefix)
namespaceURI
- the namespace the element is inelementLocalName
- the local name of the XML element this Object representsnamespacePrefix
- the prefix for the given namespacepublic void addNamespace(Namespace newNamespace)
addNamespace
in interface XMLObject
newNamespace
- the namespace to addpublic void detach()
public Element getDOM()
public QName getElementQName()
getElementQName
in interface XMLObject
public IDIndex getIDIndex()
getIDIndex
in interface XMLObject
public NamespaceManager getNamespaceManager()
NamespaceManager
instance for this object.getNamespaceManager
in interface XMLObject
public Set<Namespace> getNamespaces()
getNamespaces
in interface XMLObject
public String getNoNamespaceSchemaLocation()
getNoNamespaceSchemaLocation
in interface XMLObject
public XMLObject getParent()
public String getSchemaLocation()
getSchemaLocation
in interface XMLObject
public QName getSchemaType()
getSchemaType
in interface XMLObject
public boolean hasChildren()
hasChildren
in interface XMLObject
public boolean hasParent()
protected void manageQualifiedAttributeNamespace(QName attributeName, boolean hasValue)
attributeName
- the attribute namehasValue
- true to indicate that the attribute has a value, false to indicate it has no valueprotected QName prepareForAssignment(QName oldValue, QName newValue)
prepareAttributeValueForAssignment(String, QName, QName)
or prepareElementContentForAssignment(QName, QName)
as appropriateoldValue
- - the current valuenewValue
- - the new valueprotected QName prepareElementContentForAssignment(QName oldValue, QName newValue)
oldValue
- - the current valuenewValue
- - the new valueprotected QName prepareAttributeValueForAssignment(String attributeID, QName oldValue, QName newValue)
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 valueprotected String prepareForAssignment(String oldValue, String newValue)
oldValue
- - the current valuenewValue
- - the new valueprotected <T> T prepareForAssignment(T oldValue, T newValue)
this.foo = prepareForAssignment(this.foo, foo);
This method will do a (null) safe compare of the objects and will also invalidate the DOM if appropriateT
- - type of object being compared and assignedoldValue
- - current valuenewValue
- - proposed new valueprotected <T extends XMLObject> T prepareForAssignment(T oldValue, T newValue)
this.foo = prepareForAssignment(this.foo, foo);
This method will do a (null) safe compare of the objects and will also invalidate the DOM if appropriateT
- type of object being compared and assignedoldValue
- current valuenewValue
- proposed new valueprotected void registerOwnID(String oldID, String newID)
oldID
- the old value of the ID-typed attributenewID
- the new value of the ID-typed attributepublic void releaseChildrenDOM(boolean propagateRelease)
releaseChildrenDOM
in interface XMLObject
propagateRelease
- true if all descendants of this element should release their DOMpublic void releaseDOM()
releaseDOM
in interface XMLObject
public void releaseParentDOM(boolean propagateRelease)
releaseParentDOM
in interface XMLObject
propagateRelease
- true if all ancestors of this element should release their DOMpublic void releaseThisAndChildrenDOM()
releaseDOM()
then releaseChildrenDOM(boolean)
with
the release being propogated.public void releaseThisandParentDOM()
releaseDOM()
then releaseParentDOM(boolean)
with
the release being propogated.public void removeNamespace(Namespace namespace)
removeNamespace
in interface XMLObject
namespace
- the namespace to removepublic XMLObject resolveID(String id)
public XMLObject resolveIDFromRoot(String id)
resolveIDFromRoot
in interface XMLObject
id
- the ID attribute to resolve to an XMLObjectpublic void setDOM(Element newDom)
public void setElementNamespacePrefix(String prefix)
prefix
- the prefix for this element's namespaceprotected void setElementQName(QName elementQName)
elementQName
- the element's QNamepublic void setNoNamespaceSchemaLocation(String location)
setNoNamespaceSchemaLocation
in interface XMLObject
location
- value of the XML Schema noNamespaceSchemaLocation attribute for this objectpublic void setParent(XMLObject newParent)
public void setSchemaLocation(String location)
setSchemaLocation
in interface XMLObject
location
- value of the XML Schema schemaLocation attribute for this objectprotected void setSchemaType(QName type)
type
- the schema typepublic Boolean isNil()
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.
public XSBooleanValue isNilXSBoolean()
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.
isNilXSBoolean
in interface XMLObject
public void setNil(Boolean newNil)
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.
setNil
in interface XMLObject
newNil
- whether the object's content model is expressed as nullpublic void setNil(XSBooleanValue newNil)
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.
Copyright © 2018 JBoss by Red Hat. All rights reserved.