|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensaml.xml.AbstractXMLObject
public abstract class AbstractXMLObject
An abstract implementation of XMLObject.
Field Summary | |
---|---|
private Element |
dom
DOM Element representation of this object. |
private QName |
elementQname
The name of this element with namespace and prefix information. |
private IDIndex |
idIndex
Mapping of ID attributes to XMLObjects in the subtree rooted at this object. |
private Logger |
log
Class logger. |
private XSBooleanValue |
nil
The value of the xsi:nil attribute. |
private String |
noNamespaceSchemaLocation
No-namespace schema locations for this XML object. |
private NamespaceManager |
nsManager
The namespace manager for this XML object. |
private XMLObject |
parent
Parent of this element. |
private String |
schemaLocation
Schema locations for this XML object. |
private QName |
typeQname
The schema type of this element with namespace and prefix information. |
Constructor Summary | |
---|---|
protected |
AbstractXMLObject(String namespaceURI,
String elementLocalName,
String namespacePrefix)
Constructor. |
Method Summary | ||
---|---|---|
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
|
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
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.opensaml.xml.XMLObject |
---|
getOrderedChildren |
Field Detail |
---|
private final Logger log
private XMLObject parent
private QName elementQname
private String schemaLocation
private String noNamespaceSchemaLocation
private QName typeQname
private Element dom
private XSBooleanValue nil
xsi:nil
attribute.
private NamespaceManager nsManager
private final IDIndex idIndex
Constructor Detail |
---|
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 namespaceMethod Detail |
---|
public void addNamespace(Namespace newNamespace)
addNamespace
in interface XMLObject
newNamespace
- the namespace to addpublic void detach()
detach
in interface XMLObject
public Element getDOM()
getDOM
in interface XMLObject
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()
getParent
in interface XMLObject
public String getSchemaLocation()
getSchemaLocation
in interface XMLObject
public QName getSchemaType()
getSchemaType
in interface XMLObject
public boolean hasChildren()
hasChildren
in interface XMLObject
public boolean hasParent()
hasParent
in interface XMLObject
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 appropriate
oldValue
- - the current valuenewValue
- - the new value
protected QName prepareElementContentForAssignment(QName oldValue, QName newValue)
oldValue
- - the current valuenewValue
- - the new value
protected 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 value
protected String prepareForAssignment(String oldValue, String newValue)
oldValue
- - the current valuenewValue
- - the new value
protected <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 appropriate
T
- - type of object being compared and assignedoldValue
- - current valuenewValue
- - proposed new value
protected <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 appropriate
T
- type of object being compared and assignedoldValue
- current valuenewValue
- proposed new value
protected 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)
resolveID
in interface XMLObject
id
- the ID attribute to resolve to an XMLObject
public XMLObject resolveIDFromRoot(String id)
resolveIDFromRoot
in interface XMLObject
id
- the ID attribute to resolve to an XMLObject
public void setDOM(Element newDom)
setDOM
in interface XMLObject
newDom
- DOM representation of this XMLObjectpublic 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)
setParent
in interface XMLObject
newParent
- the parent of this elementpublic 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.
isNil
in interface XMLObject
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.
setNil
in interface XMLObject