# Class: com.pnfsoftware.jeb.core.Version
- Super class: `java.lang.Object`
- Super interfaces: `java.lang.Comparable<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.201807140000
 
```
   Version objects can be persisted.

## Constructor: Version
- parameter: `v`, type: `com.pnfsoftware.jeb.core.Version`

Description: Copy constructor.
parameter: v: a version object

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`

Description: Create a new version object "major.minor.0.0".
parameter: major: zero or positive number
parameter: minor: zero or positive number

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`

Description: Create a new version object "major.minor.buildid.0".
parameter: major: zero or positive number
parameter: minor: zero or positive number
parameter: buildid: zero or positive number

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`

Description: Create a new version object "major.minor.buildid.timestamp".
parameter: major: zero or positive number
parameter: minor: zero or positive number
parameter: buildid: zero or positive number
parameter: timestamp: zero or positive number

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`
- parameter: `channel`, type: `int`

Description: Create a new version object "major.minor.buildid.timestamp".
parameter: major: zero or positive number
parameter: minor: zero or positive number
parameter: buildid: zero or positive number
parameter: timestamp: zero or positive number
parameter: channel: optional; 0=release, 1=beta, 2=alpha

## Static Final Field: ALPHA
Type: `int`

Constant value: `2`
Description: Alpha channel identifier.

## Static Final Field: BETA
Type: `int`

Constant value: `1`
Description: Beta channel identifier.

## Static Final Field: CHANNEL_MOST_UNSTABLE
Type: `int`

Constant value: `2`
Description: Alias for the least stable built\-in channel.

## Static Final Field: CHANNEL_STABLE
Type: `int`

Constant value: `0`
Description: Alias for the most stable supported channel.

## Static Final Field: RELEASE
Type: `int`

Constant value: `0`
Description: Release channel identifier.

## Method: compareTo
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`


## Method: compareToIgnoreChannel
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`

Description: Compare two versions while ignoring their channels.
parameter: o: other version
return: a negative integer, zero, or a positive integer as this version is less than, equal          to, or greater than the other version under that comparison mode

## Method: compareToIgnoreTimestamp
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`

Description: Compare two versions while ignoring their timestamps.
parameter: o: other version
return: a negative integer, zero, or a positive integer as this version is less than, equal          to, or greater than the other version under that comparison mode

## Method: compareToIgnoreTimestampAndChannel
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`

Description: Compare two versions while ignoring both their timestamps and channels.
parameter: o: other version
return: a negative integer, zero, or a positive integer as this version is less than, equal          to, or greater than the other version under that comparison mode

## Method: equals
- parameter: `obj`, type: `java.lang.Object`
- return type: `boolean`


## Method: format
- parameter: `useChannelString`, type: `boolean`
- return type: `java.lang.String`

Description: 
parameter: 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
return: formatted version string

## Method: formatCompact
- return type: `java.lang.String`

Description: Format the version using the numeric compact representation.
return: compact version string

## Method: getBuildid
- return type: `int`

Description: Get the build id number.
return: build identifier

## Method: getChannel
- return type: `int`

Description: Get the channel.
return: channel identifier

## Method: getChannelString
- return type: `java.lang.String`

Description: Get the textual channel suffix used by formatted versions.
return: channel suffix, or null for release builds

## Method: getMajor
- return type: `int`

Description: Get the major number.
return: major version number

## Method: getMinor
- return type: `int`

Description: Get the minor number.
return: minor version number

## Method: getTimestamp
- return type: `long`

Description: Get the timestamp.
return: build timestamp

## Method: hashCode
- return type: `int`


## Method: like
- parameter: `major`, type: `int`
- return type: `boolean`

Description: Determine if the version is like "major.?.?.?"
parameter: major: expected major version
return: true if the major version matches

## Method: like
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- return type: `boolean`

Description: Determine if the version is like "major.minor.?.?"
parameter: major: expected major version
parameter: minor: expected minor version
return: true if the major and minor versions match

## Method: like
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- return type: `boolean`

Description: Determine if the version is like "major.minor.buildid.?"
parameter: major: expected major version
parameter: minor: expected minor version
parameter: buildid: expected build identifier
return: true if the major, minor, and build identifier match

## Method: setBuildid
- parameter: `buildid`, type: `int`


## Method: setChannel
- parameter: `channel`, type: `int`


## Method: setMajor
- parameter: `major`, type: `int`


## Method: setMinor
- parameter: `minor`, type: `int`


## Method: setTimestamp
- parameter: `timestamp`, type: `long`


## Method: toInt
- return type: `int`

Description: 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()](#getMajor()),  BB=[#getMinor()](#getMinor()), CC=[#getBuildid()](#getBuildid()). If any of AA, BB, CC exceeds 255, it is  truncated to 255.
return: a version\-int

## Method: toString
- return type: `java.lang.String`

Description: Same as [format\(true\)](#format(boolean)).

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int)](#Version(int, int)).
parameter: major: major version number
parameter: minor: minor version number
return: created version object

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int, int)](#Version(int, int, int)).
parameter: major: major version number
parameter: minor: minor version number
parameter: buildid: build identifier
return: created version object

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int, int, long)](#Version(int, int, int, long)).
parameter: major: major version number
parameter: minor: minor version number
parameter: buildid: build identifier
parameter: timestamp: build timestamp
return: created version object

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`
- parameter: `channel`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int, int, long, int)](#Version(int, int, int, long, int)).
parameter: major: major version number
parameter: minor: minor version number
parameter: buildid: build identifier
parameter: timestamp: build timestamp
parameter: channel: channel identifier
return: created version object

## Static Method: fromInt
- parameter: `val`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Create a version object from an integer generated by [#toInt()](#toInt()).
parameter: val: a version\-int, as generated by [#toInt()](#toInt())
return: a version Object

## Static Method: getChannelInfo
- parameter: `channel`, type: `int`
- return type: `java.lang.String`

Description: Get a user\-facing description of a build channel.
parameter: channel: channel identifier
return: localized channel description

## Static Method: getChannelName
- parameter: `channel`, type: `int`
- return type: `java.lang.String`

Description: Get the symbolic name of a build channel.
parameter: channel: channel identifier
return: channel name

## Static Method: getChannelNames
- return type: `java.lang.String[]`

Description: Get the names of the built\-in channels.
return: built\-in channel names

## Static Method: parseFromFile
- parameter: `f`, type: `java.io.File`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Read a file which should contain a single string containing a version number.
parameter: f: a file
return: the version object, null on error

## Static Method: parseFromString
- parameter: `s`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Parse a version string into a Version object.
parameter: s: a string
return: a version object, null on error

