Package org.igniterealtime.jbosh
Class AbstractAttr<T extends java.lang.Comparable>
- java.lang.Object
-
- org.igniterealtime.jbosh.AbstractAttr<T>
-
- Type Parameters:
T- type of the extension object
- All Implemented Interfaces:
java.lang.Comparable
- Direct Known Subclasses:
AbstractIntegerAttr,AttrAccept,AttrAck,AttrCharsets,AttrSessionID,AttrVersion
abstract class AbstractAttr<T extends java.lang.Comparable> extends java.lang.Object implements java.lang.ComparableAbstract base class for creating BOSH attribute classes. Concrete implementations of this class will naturally inherit the underlying type's behavior forequals(),hashCode(),toString(), andcompareTo(), allowing for the easy creation of objects which extend existing trivial types. This was done to comply with the prefactoring rule declaring, "when you are being abstract, be abstract all the way".
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAttr(T aValue)Creates a new encapsulated object instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object otherObj)booleanequals(java.lang.Object otherObj)TgetValue()Gets the encapsulated data value.inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
value
private final T extends java.lang.Comparable value
Captured value.
-
-
Constructor Detail
-
AbstractAttr
protected AbstractAttr(T aValue)
Creates a new encapsulated object instance.- Parameters:
aValue- encapsulated getValue
-
-
Method Detail
-
getValue
public final T getValue()
Gets the encapsulated data value.- Returns:
- data value
-
equals
public boolean equals(java.lang.Object otherObj)
- Overrides:
equalsin classjava.lang.Object- Parameters:
otherObj- object to compare to- Returns:
- true if the objects are equal, false otherwise
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode of the encapsulated object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation of the encapsulated object
-
compareTo
public int compareTo(java.lang.Object otherObj)
- Specified by:
compareToin interfacejava.lang.Comparable<T extends java.lang.Comparable>- Parameters:
otherObj- object to compare to- Returns:
- -1, 0, or 1
-
-