Top Description Fields Constructors Methods
org.jdom2

public Class EntityRef

extends Content
Class Inheritance
Known Direct Subclasses
org.jdom2.located.LocatedEntityRef

An XML entity reference. Methods allow the user to manage its name, public id, and system id.
Authors
Brett McLaughlin, Jason Hunter, Philip Nelson, Rolf Lear

Field Summary

Modifier and TypeField and Description
protected String
name

The name of the EntityRef

protected String
publicID

The PublicID of the EntityRef

private static final long
protected String
systemID

The SystemID of the EntityRef

Inherited from org.jdom2.Content:
ctypeparent

Constructor Summary

AccessConstructor and Description
protected
EntityRef()

Default, no-args constructor for implementations to use if needed.

public
EntityRef(String
String name of element.
name
)

This will create a new EntityRef with the supplied name.

public
EntityRef(String
String name of element.
name
,
String
system id of the entity reference being constructed
systemID
)

This will create a new EntityRef with the supplied name and system id.

public
EntityRef(String
String name of element.
name
,
String
public id of the entity reference being constructed
publicID
,
String
system id of the entity reference being constructed
systemID
)

This will create a new EntityRef with the supplied name, public id, and system id.

Method Summary

Modifier and TypeMethod and Description
public EntityRef
clone()

Overrides org.jdom2.Content.clone.

Return a deep clone of this instance.
public EntityRef
detach()

Overrides org.jdom2.Content.detach.

Detaches this child from its parent or does nothing if the child has no parent.
public String

Returns:

String - entity name.
getName
()

This returns the name of the EntityRef.

public Element
getParent()

Overrides org.jdom2.Content.getParent.

Return this child's parent, or null if this child is currently not attached.
public String

Returns:

public ID of this EntityRef
getPublicID
()

This will return the publid ID of this EntityRef.

public String

Returns:

system ID of this EntityRef
getSystemID
()

This will return the system ID of this EntityRef.

public String

Returns:

the empty string
getValue
()

Implements abstract org.jdom2.Content.getValue.

Returns the empty string since entity references don't have an XPath 1.0 string value.
public EntityRef

Returns:

this EntityRef modified.
setName
(String
new name of the entity
name
)

This will set the name of this EntityRef.

protected EntityRef
setParent(Parent
new parent element
parent
)

Overrides org.jdom2.Content.setParent.

Sets the parent of this Content.
public EntityRef

Returns:

this EntityRef modified.
setPublicID
(String
new public id
publicID
)

This will set the public ID of this EntityRef.

public EntityRef

Returns:

this EntityRef modified.
setSystemID
(String
new system id
systemID
)

This will set the system ID of this EntityRef.

public String

Returns:

String - information about the EntityRef
toString
()

Overrides java.lang.Object.toString.

This returns a String representation of the EntityRef, suitable for debugging.
Inherited from org.jdom2.Content:
equalsgetCTypegetDocumentgetNamespacesInheritedgetNamespacesInScopegetNamespacesIntroducedgetParentElementhashCode

Field Detail

nameback to summary
protected String name

The name of the EntityRef

publicIDback to summary
protected String publicID

The PublicID of the EntityRef

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.jdom2.Content.serialVersionUID.

JDOM2 Serialization. In this case, EntityRef is simple.

systemIDback to summary
protected String systemID

The SystemID of the EntityRef

Constructor Detail

EntityRefback to summary
protected EntityRef()

Default, no-args constructor for implementations to use if needed.

EntityRefback to summary
public EntityRef(String name)

This will create a new EntityRef with the supplied name.

Parameters
name:String

String name of element.

Exceptions
IllegalNameException:
if the given name is not a legal XML name.
EntityRefback to summary
public EntityRef(String name, String systemID)

This will create a new EntityRef with the supplied name and system id.

Parameters
name:String

String name of element.

systemID:String

system id of the entity reference being constructed

Exceptions
IllegalNameException:
if the given name is not a legal XML name.
IllegalDataException:
if the given system ID is not a legal system literal.
EntityRefback to summary
public EntityRef(String name, String publicID, String systemID)

This will create a new EntityRef with the supplied name, public id, and system id.

Parameters
name:String

String name of element.

publicID:String

public id of the entity reference being constructed

systemID:String

system id of the entity reference being constructed

Exceptions
IllegalDataException:
if the given system ID is not a legal system literal or the the given public ID is not a legal public ID
IllegalNameException:
if the given name is not a legal XML name.

Method Detail

cloneback to summary
public EntityRef clone()

Overrides org.jdom2.Content.clone.

Doc from org.jdom2.CloneBase.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.

Returns:EntityRef

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
detachback to summary
public EntityRef detach()

Overrides org.jdom2.Content.detach.

Doc from org.jdom2.Content.detach.

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();

Returns:EntityRef

this child detached

Annotations
@Override
getNameback to summary
public String getName()

This returns the name of the EntityRef.

Returns:String

String - entity name.

getParentback to summary
public Element getParent()

Overrides org.jdom2.Content.getParent.

Doc from org.jdom2.Content.getParent.

Return this child's parent, or null if this child is currently not attached. The parent can be either an Element or a Document.

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();

Returns:Element

this child's parent or null if none

Annotations
@Override
getPublicIDback to summary
public String getPublicID()

This will return the publid ID of this EntityRef. If there is no public ID, then this returns null.

Returns:String

public ID of this EntityRef

getSystemIDback to summary
public String getSystemID()

This will return the system ID of this EntityRef. If there is no system ID, then this returns null.

Returns:String

system ID of this EntityRef

getValueback to summary
public String getValue()

Implements abstract org.jdom2.Content.getValue.

Returns the empty string since entity references don't have an XPath 1.0 string value.

Returns:String

the empty string

Annotations
@Override
setNameback to summary
public EntityRef setName(String name)

This will set the name of this EntityRef.

Parameters
name:String

new name of the entity

Returns:EntityRef

this EntityRef modified.

Exceptions
IllegalNameException:
if the given name is not a legal XML name.
setParentback to summary
protected EntityRef setParent(Parent parent)

Overrides org.jdom2.Content.setParent.

Doc from org.jdom2.Content.setParent.

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);

Parameters
parent:Parent

new parent element

Returns:EntityRef

the target element

Annotations
@Override
setPublicIDback to summary
public EntityRef setPublicID(String publicID)

This will set the public ID of this EntityRef.

Parameters
publicID:String

new public id

Returns:EntityRef

this EntityRef modified.

Exceptions
IllegalDataException:
if the given public ID is not a legal public ID.
setSystemIDback to summary
public EntityRef setSystemID(String systemID)

This will set the system ID of this EntityRef.

Parameters
systemID:String

new system id

Returns:EntityRef

this EntityRef modified.

Exceptions
IllegalDataException:
if the given system ID is not a legal system literal.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

This returns a String representation of the EntityRef, suitable for debugging.

Returns:String

String - information about the EntityRef

Annotations
@Override