org.jdom
Class Comment
- Cloneable, Serializable
public class Comment
extends java.lang.Object
implements Serializable, Cloneable
Comment
defines behavior for an XML
comment, modeled in Java. Methods
allow the user to obtain the text of the comment.
$Revision: 1.22 $, $Date: 2002/03/20 15:16:32 $- Brett McLaughlin
- Jason Hunter
protected Object | parent - Parent element, document, or null if none
|
protected String | text - Text of the
Comment
|
Comment() -
Default, no-args constructor for implementations
to use if needed.
|
Comment(String text) -
This creates the comment with the supplied
text.
|
Object | clone() -
This will return a clone of this
Comment .
|
Comment | detach() -
This detaches the
Comment from its parent, or does
nothing if the Comment has no parent.
|
boolean | equals(Object ob) -
This tests for equality of this
Comment to the supplied
Object .
|
Document | getDocument() -
This retrieves the owning
Document for
this Comment, or null if not a currently a member of a
Document .
|
Element | getParent() -
This will return the parent of this
Comment .
|
String | getText() -
This returns the textual data within the
Comment .
|
int | hashCode() -
This returns the hash code for this
Comment .
|
protected Comment | setDocument(Document document) -
This sets the
Document parent of this comment.
|
protected Comment | setParent(Element parent) -
This will set the parent of this
Comment .
|
Comment | setText(String text) -
This will set the value of the
Comment .
|
String | toString() -
This returns a
String representation of the
Comment , suitable for debugging.
|
parent
protected Object parent
Parent element, document, or null if none
text
protected String text
Text of the Comment
Comment
protected Comment()
Default, no-args constructor for implementations
to use if needed.
Comment
public Comment(String text)
This creates the comment with the supplied
text.
text
- String
content of comment.
clone
public Object clone()
This will return a clone of this Comment
.
Object
- clone of this Comment
.
detach
public Comment detach()
This detaches the Comment
from its parent, or does
nothing if the Comment
has no parent.
Comment
- this
Comment
modified.
equals
public final boolean equals(Object ob)
This tests for equality of this Comment
to the supplied
Object
.
ob
- Object
to compare to.
boolean
- whether the Comment
is
equal to the supplied Object
.
getDocument
public Document getDocument()
This retrieves the owning
Document
for
this Comment, or null if not a currently a member of a
Document
.
Document
owning this Element, or null.
getParent
public Element getParent()
This will return the parent of this Comment
.
If there is no parent, then this returns null
.
getText
public String getText()
This returns the textual data within the
Comment
.
String
- text of comment.
hashCode
public final int hashCode()
This returns the hash code for this Comment
.
setDocument
protected Comment setDocument(Document document)
This sets the
Document
parent of this comment.
document
- Document
parent
setParent
protected Comment setParent(Element parent)
This will set the parent of this Comment
.
parent
- Element
to be new parent.
setText
public Comment setText(String text)
This will set the value of the Comment
.
text
- String
text for comment.
Comment
- this Comment modified.
toString
public String toString()
This returns a
String
representation of the
Comment
, suitable for debugging. If the XML
representation of the
Comment
is desired,
XMLOutputter.outputString(Comment)
should be used.
String
- information about the
Attribute
Copyright B) 2002 Jason Hunter, Brett McLaughlin. All Rights Reserved.