java.lang.Object | |
↳ | com.pnfsoftware.jeb.core.Version |
Version number object. The syntax is as follows:
major.minor.buildid.timestamp.channel
or
major.minor-channelString.buildid.timestamp
.
Details:
- A valid version string must contain the fields major
, minor
and
buildid
- Timestamp format: YYYYMMDDhhmm
- Allowed channels: RELEASE(0,"")
, BETA(1,"beta")
, ALPHA(2,"alpha")
Examples of valid version strings:
1.0.0 1.0.2.201801021400 1.0.2.201801021400.0 1.0.2.201801021400.1 1.0.2.201801021400.2 1.2.123 1.2-beta.123 1.2-alpha.123 1.2-beta.123.201807140000Version objects can be persisted.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ALPHA | ||||||||||
int | BETA | ||||||||||
int | CHANNEL_MOST_UNSTABLE | ||||||||||
int | CHANNEL_STABLE | ||||||||||
int | RELEASE |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Version(Version v)
Copy constructor.
| |||||||||||
Version(int major, int minor)
Create a new version object "major.minor.0.0".
| |||||||||||
Version(int major, int minor, int buildid)
Create a new version object "major.minor.buildid.0".
| |||||||||||
Version(int major, int minor, int buildid, long timestamp)
Create a new version object "major.minor.buildid.timestamp".
| |||||||||||
Version(int major, int minor, int buildid, long timestamp, int channel)
Create a new version object "major.minor.buildid.timestamp".
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | compareTo(Version o) | ||||||||||
int | compareToIgnoreChannel(Version o) | ||||||||||
int | compareToIgnoreTimestamp(Version o) | ||||||||||
int | compareToIgnoreTimestampAndChannel(Version o) | ||||||||||
static Version |
create(int major, int minor, int buildid, long timestamp)
Static builder, equivalent of
Version(int, int, int, long) . | ||||||||||
static Version |
create(int major, int minor, int buildid, long timestamp, int channel)
Static builder, equivalent of
Version(int, int, int, long, int) . | ||||||||||
static Version |
create(int major, int minor, int buildid)
Static builder, equivalent of
Version(int, int, int) . | ||||||||||
static Version |
create(int major, int minor)
Static builder, equivalent of
Version(int, int) . | ||||||||||
boolean | equals(Object obj) | ||||||||||
String | format(boolean useChannelString) | ||||||||||
String | formatCompact() | ||||||||||
static Version |
fromInt(int val)
Create a version object from an integer generated by
toInt() . | ||||||||||
int |
getBuildid()
Get the build id number.
| ||||||||||
int |
getChannel()
Get the channel.
| ||||||||||
static String | getChannelInfo(int channel) | ||||||||||
static String | getChannelName(int channel) | ||||||||||
static String[] | getChannelNames() | ||||||||||
String | getChannelString() | ||||||||||
int |
getMajor()
Get the major number.
| ||||||||||
int |
getMinor()
Get the minor number.
| ||||||||||
long |
getTimestamp()
Get the timestamp.
| ||||||||||
int | hashCode() | ||||||||||
boolean |
like(int major, int minor, int buildid)
Determine if the version is like "major.minor.buildid.?"
| ||||||||||
boolean |
like(int major, int minor)
Determine if the version is like "major.minor.?.?"
| ||||||||||
boolean |
like(int major)
Determine if the version is like "major.?.?.?"
| ||||||||||
static Version |
parseFromFile(File f)
Read a file which should contain a single string containing a version number.
| ||||||||||
static Version |
parseFromString(String s)
Parse a version string into a Version object.
| ||||||||||
void | setBuildid(int buildid) | ||||||||||
void | setChannel(int channel) | ||||||||||
void | setMajor(int major) | ||||||||||
void | setMinor(int minor) | ||||||||||
void | setTimestamp(long timestamp) | ||||||||||
int |
toInt()
Generate a 4-byte integer representing the three most relevant components of this version
object.
| ||||||||||
String |
toString()
Same as
format(true) . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Comparable
|
Create a new version object "major.minor.0.0".
major | zero or positive number |
---|---|
minor | zero or positive number |
Create a new version object "major.minor.buildid.0".
major | zero or positive number |
---|---|
minor | zero or positive number |
buildid | zero or positive number |
Create a new version object "major.minor.buildid.timestamp".
major | zero or positive number |
---|---|
minor | zero or positive number |
buildid | zero or positive number |
timestamp | zero or positive number |
Create a new version object "major.minor.buildid.timestamp".
major | zero or positive number |
---|---|
minor | zero or positive number |
buildid | zero or positive number |
timestamp | zero or positive number |
channel | optional; 0=release, 1=beta, 2=alpha |
Static builder, equivalent of Version(int, int, int, long)
.
Static builder, equivalent of Version(int, int, int, long, int)
.
Static builder, equivalent of Version(int, int, int)
.
Static builder, equivalent of Version(int, int)
.
useChannelString | true to format the channel (if present) as a string appended to the Minor version number; else, the channel value, if non 0, will be appended to the version Timestamp |
---|
Get the build id number.
Get the channel.
Get the major number.
Get the minor number.
Get the timestamp.
Determine if the version is like "major.minor.buildid.?"
Determine if the version is like "major.minor.?.?"
Determine if the version is like "major.?.?.?"
Read a file which should contain a single string containing a version number.
f | a file |
---|
Parse a version string into a Version object.
s | a string |
---|
Generate a 4-byte integer representing the three most relevant components of this version
object. The resulting int is as such: {00AABBCC} where AA=getMajor()
,
BB=getMinor()
, CC=getBuildid()
. If any of AA, BB, CC exceeds 255, it is
truncated to 255.