All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.jdom.Comment

java.lang.Object
   |
   +----org.jdom.Comment

public class Comment
extends 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.

Version:
$Revision: 1.22 $, $Date: 2002/03/20 15:16:32 $
Author:
Brett McLaughlin, Jason Hunter

Variable Index

 o parent
Parent element, document, or null if none
 o text
Text of the Comment

Constructor Index

 o Comment()

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

 o Comment(String)

This creates the comment with the supplied text.

Method Index

 o clone()

This will return a clone of this Comment.

 o detach()

This detaches the Comment from its parent, or does nothing if the Comment has no parent.

 o equals(Object)

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

 o getDocument()

This retrieves the owning {

 o getParent()

This will return the parent of this Comment.

 o getText()

This returns the textual data within the Comment.

 o hashCode()

This returns the hash code for this Comment.

 o setDocument(Document)

This sets the {

 o setParent(Element)

This will set the parent of this Comment.

 o setText(String)

This will set the value of the Comment.

 o toString()

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

Variables

 o text
 protected String text
Text of the Comment

 o parent
 protected Object parent
Parent element, document, or null if none

Constructors

 o Comment
 protected Comment()

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

 o Comment
 public Comment(String text)

This creates the comment with the supplied text.

Parameters:
text - String content of comment.

Methods

 o 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
 o setParent
 protected Comment setParent(Element parent)

This will set the parent of this Comment.

Parameters:
parent - Element to be new parent.
Returns:
this Comment modified.
 o detach
 public Comment detach()

This detaches the Comment from its parent, or does nothing if the Comment has no parent.

Returns:
Comment - this Comment modified.
 o getDocument
 public Document getDocument()

This retrieves the owning {@link Document} for this Comment, or null if not a currently a member of a {@link Document}.

Returns:
Document owning this Element, or null.
 o setDocument
 protected Comment setDocument(Document document)

This sets the {@link Document} parent of this comment.

Parameters:
document - Document parent
Returns:
this Comment modified
 o getText
 public String getText()

This returns the textual data within the Comment.

Returns:
String - text of comment.
 o 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.
Throws: IllegalDataException
if the given text is illegal for a Comment.
 o toString
 public String toString()

This returns a String representation of the Comment, suitable for debugging. If the XML representation of the Comment is desired, {@link org.jdom.output.XMLOutputter#outputString(Comment)} should be used.

Returns:
String - information about the Attribute
Overrides:
toString in class Object
 o 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.
Overrides:
equals in class Object
 o hashCode
 public final int hashCode()

This returns the hash code for this Comment.

Returns:
int - hash code.
Overrides:
hashCode in class Object
 o clone
 public Object clone()

This will return a clone of this Comment.

Returns:
Object - clone of this Comment.
Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index