Class AttrVersion

  • All Implemented Interfaces:
    java.lang.Comparable

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

      Fields 
      Modifier and Type Field Description
      private static AttrVersion DEFAULT
      Default value if none is provided.
      private int major
      Major portion of the version.
      private int minor
      Minor portion of the version.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private AttrVersion​(java.lang.String val)
      Creates a new attribute object.
    • Field Detail

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

      • AttrVersion

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

      • getSupportedVersion

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

        static AttrVersion createFromString​(java.lang.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​(java.lang.Object otherObj)
        Specified by:
        compareTo in interface java.lang.Comparable
        Overrides:
        compareTo in class AbstractAttr<java.lang.String>
        Parameters:
        otherObj - object to compare to
        Returns:
        -1, 0, or 1