Package org.apache.sshd.common.util
Class VersionInfo
- java.lang.Object
-
- org.apache.sshd.common.util.VersionInfo
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<VersionInfo>
public class VersionInfo extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<VersionInfo>
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
buildNumber
private int
majorVersion
private int
minorVersion
private int
release
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description VersionInfo(int major, int minor)
VersionInfo(int major, int minor, int release, int build)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(VersionInfo o)
boolean
equals(java.lang.Object obj)
int
getBuildNumber()
int
getMajorVersion()
int
getMinorVersion()
int
getRelease()
int
hashCode()
static VersionInfo
parse(java.lang.String version)
Parses a version string - assumed to contain at most 4 non-negative components separated by a '.'.java.lang.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
majorVersion
private final int majorVersion
-
minorVersion
private final int minorVersion
-
release
private final int release
-
buildNumber
private final int buildNumber
-
-
Method Detail
-
getMajorVersion
public final int getMajorVersion()
-
getMinorVersion
public final int getMinorVersion()
-
getRelease
public final int getRelease()
-
getBuildNumber
public final int getBuildNumber()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(VersionInfo o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<VersionInfo>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
parse
public static VersionInfo parse(java.lang.String version) throws java.lang.NumberFormatException
Parses a version string - assumed to contain at most 4 non-negative components separated by a '.'. If less than 4 components are found, then the rest are assumed to be zero. If more than 4 components found, then only the 1st ones are parsed.- Parameters:
version
- The version string - ignored ifnull
/empty- Returns:
- The parsed
VersionInfo
- ornull
if empty input - Throws:
java.lang.NumberFormatException
- If failed to parse any of the componentsjava.lang.IllegalArgumentException
- If any of the parsed components is negative
-
-