public class NodeJSVersion extends Object implements Comparable<NodeJSVersion>
NodeJSVersion identifiers have tree components.
NodeJSVersion objects are immutable.
| Modifier and Type | Field and Description |
|---|---|
static NodeJSVersion |
emptyVersion
The empty version "0.0.0".
|
| Constructor and Description |
|---|
NodeJSVersion(int major,
int minor,
int micro)
Creates a version identifier from the specified numerical components.
|
NodeJSVersion(String version)
Creates a version identifier from the specified string.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(NodeJSVersion other)
Compares this
NodeJSVersion object to another
NodeJSVersion. |
boolean |
equals(Object object)
Compares this
NodeJSVersion object to another object. |
int |
getMajor()
Returns the major component of this version identifier.
|
int |
getMicro()
Returns the micro component of this version identifier.
|
int |
getMinor()
Returns the minor component of this version identifier.
|
int |
hashCode()
Returns a hash code value for the object.
|
static NodeJSVersion |
parseVersion(String version)
Parses a version identifier from the specified string.
|
String |
toString()
Returns the string representation of this version identifier.
|
public static final NodeJSVersion emptyVersion
public NodeJSVersion(int major,
int minor,
int micro)
major - Major component of the version identifier.minor - Minor component of the version identifier.micro - Micro component of the version identifier.IllegalArgumentException - If the numerical components are negative.public NodeJSVersion(String version)
NodeJSVersion string grammar:
version ::= major('.'minor('.'micro)?)?
major ::= digit+
minor ::= digit+
micro ::= digit+
digit ::= [0..9]
version - String representation of the version identifier. There must be
no whitespace in the argument.IllegalArgumentException - If version is improperly formatted.public static NodeJSVersion parseVersion(String version)
See NodeJSVersion(String) for the format of the version string.
version - String representation of the version identifier. Leading and
trailing whitespace will be ignored.NodeJSVersion object representing the version
identifier. If version is null or the empty
string then emptyVersion will be returned.IllegalArgumentException - If version is improperly formatted.public int getMajor()
public int getMinor()
public int getMicro()
public String toString()
The format of the version string will be major.minor.micro.
public int hashCode()
public boolean equals(Object object)
NodeJSVersion object to another object.
A version is considered to be equal to another version if the major, minor and micro components are equal.
public int compareTo(NodeJSVersion other)
NodeJSVersion object to another
NodeJSVersion.
A version is considered to be less than another version if its major component is less than the other version's major component, or the major components are equal and its minor component is less than the other version's minor component, or the major and minor components are equal and its micro component is less than the other version's micro component, or the major, minor and micro components are equal.
A version is considered to be equal to another version if the major, minor and micro components are equal.
compareTo in interface Comparable<NodeJSVersion>other - The NodeJSVersion object to be compared.NodeJSVersion object.ClassCastException - If the specified object is not a NodeJSVersion
object.Copyright © 2016–2017. All rights reserved.