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.Comparable
Abstract 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 protected
AbstractAttr(T aValue)
Creates a new encapsulated object instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(java.lang.Object otherObj)
boolean
equals(java.lang.Object otherObj)
T
getValue()
Gets the encapsulated data value.int
hashCode()
java.lang.String
toString()
-
-
-
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:
equals
in classjava.lang.Object
- Parameters:
otherObj
- object to compare to- Returns:
- true if the objects are equal, false otherwise
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode of the encapsulated object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- string representation of the encapsulated object
-
compareTo
public int compareTo(java.lang.Object otherObj)
- Specified by:
compareTo
in interfacejava.lang.Comparable<T extends java.lang.Comparable>
- Parameters:
otherObj
- object to compare to- Returns:
- -1, 0, or 1
-
-