Class AttrVersion

java.lang.Object
org.igniterealtime.jbosh.AbstractAttr<String>
org.igniterealtime.jbosh.AttrVersion
All Implemented Interfaces:
Comparable

final class AttrVersion extends AbstractAttr<String> implements Comparable
Data type representing the getValue of the ver attribute of the bosh element.
  • Field Details

    • DEFAULT

      private static final AttrVersion DEFAULT
      Default value if none is provided.
    • major

      private final int major
      Major portion of the version.
    • minor

      private final int minor
      Minor portion of the version.
  • Constructor Details

    • AttrVersion

      private AttrVersion(String val) throws BOSHException
      Creates a new attribute object.
      Parameters:
      val - attribute getValue
      Throws:
      BOSHException - on parse or validation failure
  • Method Details

    • getSupportedVersion

      static AttrVersion getSupportedVersion()
      Get the version of specifcation that we support.
      Returns:
      max spec version the code supports
    • createFromString

      static AttrVersion createFromString(String str) throws BOSHException
      Creates a new attribute instance from the provided String.
      Parameters:
      str - string representation of the attribute
      Returns:
      attribute instance or null if provided string is null
      Throws:
      BOSHException - on parse or validation failure
    • getMajor

      int getMajor()
      Returns the 'major' portion of the version number.
      Returns:
      major digits only
    • getMinor

      int getMinor()
      Returns the 'minor' portion of the version number.
      Returns:
      minor digits only
    • compareTo

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