org.jdom
Class Comment


public class Comment
implements Cloneable, Serializable

Comment defines behavior for an XML comment, modeled in Java. Methods allow the user to obtain the text of the comment.

Author:
Brett McLaughlin, Jason Hunter
Version: 1.0

Constructor Summary
Comment(String text)
           This creates the comment with the supplied text.

Method Summary
 Objectclone()
           This will return a clone of this Comment.
 final booleanequals(Object ob)
           This tests for equality of this Comment to the supplied Object.
 DocumentgetDocument()
           This retrieves the owning Document for this Comment, or null if not a currently a member of a Document.
 ElementgetParent()
           This will return the parent of this Comment.
 final StringgetSerializedForm()
           This will return the Comment in XML format, usable in an XML document.
 StringgetText()
           This returns the textual data within the Comment.
 final inthashCode()
           This returns the hash code for this Comment.
 CommentsetText(String text)
           This will set the value of the Comment.
 StringtoString()
           This returns a String representation of the Comment, suitable for debugging.

Constructor Detail

Comment

public Comment(String text)

This creates the comment with the supplied text.

Parameters:
text - String content of comment.
Method Detail

clone

public Object clone()

This will return a clone of this Comment.

Returns: Object - clone of this Comment.

equals

public final boolean equals(Object ob)

This tests for equality of this Comment to the supplied Object.

Parameters:
ob - Object to compare to.
Returns: 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.

Returns: 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.

Returns: parent of this Comment

getSerializedForm

public final String getSerializedForm()

This will return the Comment in XML format, usable in an XML document.

Returns: String - the serialized form of the Comment.

getText

public String getText()

This returns the textual data within the Comment.

Returns: String - text of comment.

hashCode

public final int hashCode()

This returns the hash code for this Comment.

Returns: int - hash code.

setText

public Comment setText(String text)

This will set the value of the Comment.

Parameters:
text - String text for comment.
Returns: 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, getSerializedForm() should be used.

Returns: String - information about the Attribute

Association Links

to Class java.lang.String

Text of the Comment

to Class org.jdom.Element

Parent node, or null if none

to Class org.jdom.Document

Document node if comment is outside the root element, or null if none