Class AbstractAttr<T extends java.lang.Comparable>

  • 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 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 Summary

      Fields 
      Modifier and Type Field Description
      private T value
      Captured value.
    • 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()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 class java.lang.Object
        Parameters:
        otherObj - object to compare to
        Returns:
        true if the objects are equal, false otherwise
      • hashCode

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

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

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