|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.uadetector.VersionNumber
public final class VersionNumber
The VersionNumber
class represents the version number of an operating system or User-Agent.
A VersionNumber
object is immutable, their values cannot be changed after creation.
Field Summary | |
---|---|
static java.lang.String |
EMPTY_EXTENSION
Empty extension or addition of a version number |
static java.lang.String |
EMPTY_GROUP
Empty group or category of a version number |
static VersionNumber |
UNKNOWN
Defines an empty or not set version number |
Constructor Summary | |
---|---|
VersionNumber(java.util.List<java.lang.String> groups)
Constructs a VersionNumber with the given numeric groups, such as major, minor and bugfix number. |
|
VersionNumber(java.util.List<java.lang.String> groups,
java.lang.String extension)
Constructs a VersionNumber with the given numeric groups, such as major, minor and bugfix number and
extension. |
|
VersionNumber(java.lang.String major)
Constructs a VersionNumber with the given major number and without a minor and bugfix number. |
|
VersionNumber(java.lang.String major,
java.lang.String minor)
Constructs a VersionNumber with the given major, minor number and without a bugfix number. |
|
VersionNumber(java.lang.String major,
java.lang.String minor,
java.lang.String bugfix)
Constructs a VersionNumber with the given major, minor and bugfix number. |
|
VersionNumber(java.lang.String major,
java.lang.String minor,
java.lang.String bugfix,
java.lang.String extension)
Constructs a VersionNumber with the given major, minor and bugfix number and extension. |
Method Summary | |
---|---|
int |
compareTo(ReadableVersionNumber other)
Compares this version number with the specified version number for order. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this version number. |
java.lang.String |
getBugfix()
Gets the bugfix category of the version number. |
java.lang.String |
getExtension()
Gets the addition or extension of the version number. |
java.util.List<java.lang.String> |
getGroups()
Get all groups (or categories) of this version number. |
java.lang.String |
getMajor()
Gets the major category of the version number. |
java.lang.String |
getMinor()
Gets the major category of the version number. |
int |
hashCode()
|
static VersionNumber |
parseLastVersionNumber(java.lang.String text)
Interprets a string with version information. |
static VersionNumber |
parseOperatingSystemVersion(OperatingSystemFamily family,
java.lang.String userAgent)
Try to determine the version number of the operating system by parsing the user agent string. |
static VersionNumber |
parseVersion(java.lang.String version)
Interprets a string with version information. |
static java.util.List<java.lang.String> |
replaceNullValueWithEmptyGroup(java.util.List<java.lang.String> groups)
Replaces all null values in the given list of groups with VersionNumber#EMPTY_GROUP . |
java.lang.String |
toString()
Returns a string representation of the version number. |
java.lang.String |
toVersionString()
Gets this version number as string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EMPTY_EXTENSION
public static final java.lang.String EMPTY_GROUP
public static final VersionNumber UNKNOWN
Constructor Detail |
---|
public VersionNumber(@Nonnull java.util.List<java.lang.String> groups)
VersionNumber
with the given numeric groups, such as major, minor and bugfix number.
groups
- list of numbers of a version number
net.sf.qualitycheck.exception.IllegalNullArgumentException
- if the given argument is null
net.sf.qualitycheck.exception.IllegalStateOfArgumentException
- if one of the segments of the version number is smaller than 0 and not emptypublic VersionNumber(@Nonnull java.util.List<java.lang.String> groups, @Nonnull java.lang.String extension)
VersionNumber
with the given numeric groups, such as major, minor and bugfix number and
extension.
groups
- list of numbers of a version numberextension
- extension of a version number
net.sf.qualitycheck.exception.IllegalNullArgumentException
- if one of the given arguments is null
net.sf.qualitycheck.exception.IllegalStateOfArgumentException
- if one of the groups of the version number is not empty or a positive numberpublic VersionNumber(@Nonnull java.lang.String major)
VersionNumber
with the given major number and without a minor and bugfix number.
major
- major group of the version number
net.sf.qualitycheck.exception.IllegalNullArgumentException
- if the given argument is null
net.sf.qualitycheck.exception.IllegalStateOfArgumentException
- if the major segment is smaller than 0 and not emptypublic VersionNumber(@Nonnull java.lang.String major, @Nonnull java.lang.String minor)
VersionNumber
with the given major, minor number and without a bugfix number.
major
- major group of the version numberminor
- minor group of the version number
net.sf.qualitycheck.exception.IllegalNullArgumentException
- if one of the given arguments is null
net.sf.qualitycheck.exception.IllegalStateOfArgumentException
- if the major or minor segment is smaller than 0 and not emptypublic VersionNumber(@Nonnull java.lang.String major, @Nonnull java.lang.String minor, @Nonnull java.lang.String bugfix)
VersionNumber
with the given major, minor and bugfix number.
major
- major group of the version numberminor
- minor group of the version numberbugfix
- bugfix group of the version number
net.sf.qualitycheck.exception.IllegalNullArgumentException
- if one of the given arguments is null
net.sf.qualitycheck.exception.IllegalStateOfArgumentException
- if the major, minor or bugfix segment is smaller than 0 and not emptypublic VersionNumber(@Nonnull java.lang.String major, @Nonnull java.lang.String minor, @Nonnull java.lang.String bugfix, @Nonnull java.lang.String extension)
VersionNumber
with the given major, minor and bugfix number and extension.
major
- major group of the version numberminor
- minor group of the version numberbugfix
- bugfix group of the version numberextension
- extension of a version number
net.sf.qualitycheck.exception.IllegalNullArgumentException
- if one of the given arguments is null
net.sf.qualitycheck.exception.IllegalStateOfArgumentException
- if the major, minor or bugfix segment is smaller than 0 and not emptyMethod Detail |
---|
public static VersionNumber parseLastVersionNumber(@Nonnull java.lang.String text)
text
- string with version information
VersionNumber
, never null
public static VersionNumber parseOperatingSystemVersion(@Nonnull OperatingSystemFamily family, @Nonnull java.lang.String userAgent)
family
- family of the operating systemuserAgent
- user agent string
public static VersionNumber parseVersion(@Nonnull java.lang.String version)
version
- version as string
VersionNumber
, never null
public static java.util.List<java.lang.String> replaceNullValueWithEmptyGroup(@Nonnull java.util.List<java.lang.String> groups)
null
values in the given list of groups with VersionNumber#EMPTY_GROUP
.
groups
- list of numbers of a version number
null
valuespublic int compareTo(@Nullable ReadableVersionNumber other)
compareTo
in interface java.lang.Comparable<ReadableVersionNumber>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
true
if the given version number is equal to this onepublic java.lang.String getBugfix()
getBugfix
in interface ReadableVersionNumber
public java.lang.String getExtension()
getExtension
in interface ReadableVersionNumber
public java.util.List<java.lang.String> getGroups()
getGroups
in interface ReadableVersionNumber
public java.lang.String getMajor()
getMajor
in interface ReadableVersionNumber
public java.lang.String getMinor()
getMinor
in interface ReadableVersionNumber
public int hashCode()
hashCode
in class java.lang.Object
@Nonnull public java.lang.String toString()
toString
in class java.lang.Object
@Nonnull public java.lang.String toVersionString()
toVersionString
in interface ReadableVersionNumber
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |