Package org.igniterealtime.jbosh
Class AttrVersion
- java.lang.Object
-
- org.igniterealtime.jbosh.AbstractAttr<java.lang.String>
-
- org.igniterealtime.jbosh.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 thever
attribute of thebosh
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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(java.lang.Object otherObj)
(package private) static AttrVersion
createFromString(java.lang.String str)
Creates a new attribute instance from the provided String.(package private) int
getMajor()
Returns the 'major' portion of the version number.(package private) int
getMinor()
Returns the 'minor' portion of the version number.(package private) static AttrVersion
getSupportedVersion()
Get the version of specifcation that we support.-
Methods inherited from class org.igniterealtime.jbosh.AbstractAttr
equals, getValue, hashCode, toString
-
-
-
-
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 isnull
- 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 interfacejava.lang.Comparable
- Overrides:
compareTo
in classAbstractAttr<java.lang.String>
- Parameters:
otherObj
- object to compare to- Returns:
- -1, 0, or 1
-
-