Class AbstractAttr<T extends Comparable>

java.lang.Object
org.igniterealtime.jbosh.AbstractAttr<T>
Type Parameters:
T - type of the extension object
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
AbstractIntegerAttr, AttrAccept, AttrAck, AttrCharsets, AttrSessionID, AttrVersion

abstract class AbstractAttr<T extends Comparable> extends Object implements Comparable
Abstract base class for creating BOSH attribute classes. Concrete implementations of this class will naturally inherit the underlying type's behavior for equals(), hashCode(), toString(), and compareTo(), 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".
  • Field Details

    • value

      private final T extends Comparable value
      Captured value.
  • Constructor Details

    • AbstractAttr

      protected AbstractAttr(T aValue)
      Creates a new encapsulated object instance.
      Parameters:
      aValue - encapsulated getValue
  • Method Details

    • getValue

      public final T getValue()
      Gets the encapsulated data value.
      Returns:
      data value
    • equals

      public boolean equals(Object otherObj)
      Overrides:
      equals in class Object
      Parameters:
      otherObj - object to compare to
      Returns:
      true if the objects are equal, false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      hashCode of the encapsulated object
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      string representation of the encapsulated object
    • compareTo

      public int compareTo(Object otherObj)
      Specified by:
      compareTo in interface Comparable<T extends Comparable>
      Parameters:
      otherObj - object to compare to
      Returns:
      -1, 0, or 1