Package org.jdom
Class Content
- java.lang.Object
-
- org.jdom.Content
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public abstract class Content extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableSuperclass for JDOM objects which can be legal child content ofParentnodes.- Version:
- $Revision: 1.6 $, $Date: 2007/11/10 05:28:58 $
- Author:
- Bradley S. Huffman, Jason Hunter
- See Also:
Comment,DocType,Element,EntityRef,Parent,ProcessingInstruction,Text, Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedContent()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Returns a deep, unattached copy of this child and its descendants detached from any parent or document.Contentdetach()Detaches this child from its parent or does nothing if the child has no parent.booleanequals(java.lang.Object ob)This tests for equality of this Content object to the supplied object.DocumentgetDocument()Return this child's owning document or null if the branch containing this child is currently not attached to a document.ParentgetParent()Return this child's parent, or null if this child is currently not attached.ElementgetParentElement()A convenience method that returns any parent element for this element, or null if the element is unattached or is a root element.abstract java.lang.StringgetValue()Returns the XPath 1.0 string value of this child.inthashCode()This returns the hash code for thisContentitem.protected ContentsetParent(Parent parent)Sets the parent of this Content.
-
-
-
Field Detail
-
parent
protected Parent parent
-
-
Method Detail
-
detach
public Content detach()
Detaches this child from its parent or does nothing if the child has no parent.- Returns:
- this child detached
-
getParent
public Parent getParent()
Return this child's parent, or null if this child is currently not attached. The parent can be either anElementor aDocument.- Returns:
- this child's parent or null if none
-
getParentElement
public Element getParentElement()
A convenience method that returns any parent element for this element, or null if the element is unattached or is a root element. This was the original behavior of getParent() in JDOM Beta 9 which began returning Parent in Beta 10. This method provides a convenient upgrade path for JDOM Beta 10 and 1.0 users.- Returns:
- the containing Element or null if unattached or a root element
-
setParent
protected Content setParent(Parent parent)
Sets the parent of this Content. The caller is responsible for removing any pre-existing parentage.- Parameters:
parent- new parent element- Returns:
- the target element
-
getDocument
public Document getDocument()
Return this child's owning document or null if the branch containing this child is currently not attached to a document.- Returns:
- this child's owning document or null if none
-
getValue
public abstract java.lang.String getValue()
Returns the XPath 1.0 string value of this child.- Returns:
- xpath string value of this child.
-
clone
public java.lang.Object clone()
Returns a deep, unattached copy of this child and its descendants detached from any parent or document.- Overrides:
clonein classjava.lang.Object- Returns:
- a detached deep copy of this child and descendants
-
equals
public final boolean equals(java.lang.Object ob)
This tests for equality of this Content object to the supplied object. Content items are considered equal only if they are referentially equal (i.e. the same object). User code may choose to compare objects based on their properties instead.- Overrides:
equalsin classjava.lang.Object- Parameters:
ob-Objectto compare to.- Returns:
boolean- whether theContentis equal to the suppliedObject.
-
hashCode
public final int hashCode()
This returns the hash code for thisContentitem.- Overrides:
hashCodein classjava.lang.Object- Returns:
int- hash code.
-
-