Class EntityRef
- All Implemented Interfaces:
Serializable
,Cloneable
,NamespaceAware
- Direct Known Subclasses:
LocatedEntityRef
- Author:
- Brett McLaughlin, Jason Hunter, Philip Nelson, Rolf Lear
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jdom2.Content
Content.CType
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Default, no-args constructor for implementations to use if needed.This will create a newEntityRef
with the supplied name.This will create a newEntityRef
with the supplied name and system id.This will create a newEntityRef
with the supplied name, public id, and system id. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Return a deep clone of this instance.detach()
Detaches this child from its parent or does nothing if the child has no parent.getName()
This returns the name of theEntityRef
.Return this child's parent, or null if this child is currently not attached.This will return the publid ID of thisEntityRef
.This will return the system ID of thisEntityRef
.getValue()
Returns the empty string since entity references don't have an XPath 1.0 string value.This will set the name of thisEntityRef
.protected EntityRef
Sets the parent of this Content.setPublicID
(String publicID) This will set the public ID of thisEntityRef
.setSystemID
(String systemID) This will set the system ID of thisEntityRef
.toString()
This returns aString
representation of theEntityRef
, suitable for debugging.Methods inherited from class org.jdom2.Content
equals, getCType, getDocument, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getParentElement, hashCode
-
Field Details
-
name
The name of theEntityRef
-
publicID
The PublicID of theEntityRef
-
systemID
The SystemID of theEntityRef
-
-
Constructor Details
-
EntityRef
protected EntityRef()Default, no-args constructor for implementations to use if needed. -
EntityRef
This will create a newEntityRef
with the supplied name.- Parameters:
name
-String
name of element.- Throws:
IllegalNameException
- if the given name is not a legal XML name.
-
EntityRef
This will create a newEntityRef
with the supplied name and system id.- Parameters:
name
-String
name of element.systemID
- system id of the entity reference being constructed- Throws:
IllegalNameException
- if the given name is not a legal XML name.IllegalDataException
- if the given system ID is not a legal system literal.
-
EntityRef
This will create a newEntityRef
with the supplied name, public id, and system id.- Parameters:
name
-String
name of element.publicID
- public id of the entity reference being constructedsystemID
- system id of the entity reference being constructed- Throws:
IllegalDataException
- if the given system ID is not a legal system literal or the the given public ID is not a legal public IDIllegalNameException
- if the given name is not a legal XML name.
-
-
Method Details
-
getName
This returns the name of theEntityRef
.- Returns:
String
- entity name.
-
getValue
Returns the empty string since entity references don't have an XPath 1.0 string value. -
getPublicID
This will return the publid ID of thisEntityRef
. If there is no public ID, then this returnsnull
.- Returns:
- public ID of this
EntityRef
-
getSystemID
This will return the system ID of thisEntityRef
. If there is no system ID, then this returnsnull
.- Returns:
- system ID of this
EntityRef
-
setName
This will set the name of thisEntityRef
.- Parameters:
name
- new name of the entity- Returns:
- this
EntityRef
modified. - Throws:
IllegalNameException
- if the given name is not a legal XML name.
-
setPublicID
This will set the public ID of thisEntityRef
.- Parameters:
publicID
- new public id- Returns:
- this
EntityRef
modified. - Throws:
IllegalDataException
- if the given public ID is not a legal public ID.
-
setSystemID
This will set the system ID of thisEntityRef
.- Parameters:
systemID
- new system id- Returns:
- this
EntityRef
modified. - Throws:
IllegalDataException
- if the given system ID is not a legal system literal.
-
toString
This returns aString
representation of theEntityRef
, suitable for debugging. -
detach
Description copied from class:Content
Detaches this child from its parent or does nothing if the child has no parent.This method can be overridden by particular Content subclasses to return a specific type of Content (co-variant return type). All overriding subclasses must call
super.detach()
; -
setParent
Description copied from class:Content
Sets the parent of this Content. The caller is responsible for removing any pre-existing parentage.This method can be overridden by particular Content subclasses to return a specific type of Content (co-variant return type). All overriding subclasses must call
super.setParent(Parent)
; -
getParent
Description copied from class:Content
Return this child's parent, or null if this child is currently not attached. The parent can be either anElement
or aDocument
.This method can be overridden by particular Content subclasses to return a specific type of Parent (co-variant return type). All overriding subclasses must call
super.getParent()
; -
clone
Return a deep clone of this instance. Even if this instance has a parent, the returned clone will not.All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return value).
Subclasses of this should still call super.clone() in their clone method.
-