public class SimpleComment extends AbstractChangeable implements Comment
Modifier | Constructor and Description |
---|---|
protected |
SimpleComment() |
|
SimpleComment(java.lang.String comment,
int rank)
Constructs a new, immutable comment, given some text and a rank.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o)
Comments are ordered first by their rank, then by a string
comparison of their text values.
|
boolean |
equals(java.lang.Object obj)
Two comments are defined as equal if their text values and
rankings are identical.
|
java.lang.String |
getComment()
Returns the comment part of this comment.
|
java.lang.Integer |
getId()
Gets the Hibernate ID.
|
int |
getRank()
Returns the rank of this comment.
|
int |
hashCode() |
protected void |
setComment(java.lang.String comment) |
void |
setId(java.lang.Integer id)
Sets the Hibernate ID.
|
void |
setRank(int rank)
Sets the rank of this comment.
|
java.lang.String |
toString()
Form: "(#rank) comment"
|
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
public SimpleComment(java.lang.String comment, int rank)
comment
- the text of the comment. Cannot be null.rank
- the rank of the comment.protected SimpleComment()
protected void setComment(java.lang.String comment)
public java.lang.String getComment()
getComment
in interface Comment
public void setRank(int rank) throws ChangeVetoException
setRank
in interface Comment
rank
- the rank to use.ChangeVetoException
- if the new rank is unacceptable.public int getRank()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Integer getId()
public void setId(java.lang.Integer id)
id
- the Hibernate ID, if using Hibernate.