Package com.blueriq.component.api.plugin
Class PluginVersion
- java.lang.Object
-
- com.blueriq.component.api.plugin.PluginVersion
-
- All Implemented Interfaces:
Serializable
public final class PluginVersion extends Object implements Serializable
Plugin version class for releases and snapshots.- Since:
- 8.0
- Author:
- Danny Roest
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PluginVersion
createVersionFromString(String artifactVersion, String buildNumber)
boolean
equals(Object obj)
String
getBranch()
This method returns the branch.long
getBuildNumber()
This method returns the build number set by Hudson.int
getMajor()
This method returns the major number.int
getMinor()
This method returns the minor number.String
getPatch()
This method returns the patch (only for release version).String
getString()
This method returns the string representation of this version.int
hashCode()
boolean
isSnapshot()
This method returns true if this version is a snapshot.String
toString()
static PluginVersion
valueOfProperties(Properties properties)
This method constructs a PluginVersion based on the specified properties.static PluginVersion
valueOfRelease(int major, int minor)
This method creates a new Release Plugin version without a patch.static PluginVersion
valueOfRelease(int major, int minor, String patch)
This method creates a new Release Plugin version with a patch.static PluginVersion
valueOfSnapshot(int major, int minor, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.static PluginVersion
valueOfSnapshot(int major, int minor, String branch, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.static PluginVersion
valueOfSnapshot(int major, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.static PluginVersion
valueOfSnapshot(int major, String branch, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.
-
-
-
Method Detail
-
valueOfRelease
public static PluginVersion valueOfRelease(int major, int minor, String patch)
This method creates a new Release Plugin version with a patch.- Parameters:
major
- the major numberminor
- the minor numberpatch
- the patch of this version- Returns:
- a Plugin version
-
valueOfRelease
public static PluginVersion valueOfRelease(int major, int minor)
This method creates a new Release Plugin version without a patch.- Parameters:
major
- the major numberminor
- the minor number- Returns:
- a Plugin version
-
valueOfSnapshot
public static PluginVersion valueOfSnapshot(int major, String branch, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.- Parameters:
major
- the major numberbranch
- the branch namebuildNumber
- the buildNumber- Returns:
- a Plugin version
-
valueOfSnapshot
public static PluginVersion valueOfSnapshot(int major, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.- Parameters:
major
- the major numberbuildNumber
- the buildNumber- Returns:
- a Plugin version
-
valueOfSnapshot
public static PluginVersion valueOfSnapshot(int major, int minor, String branch, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.- Parameters:
major
- the major numberminor
- the minor numberbranch
- the branch namebuildNumber
- the buildNumber- Returns:
- a Plugin version
-
valueOfSnapshot
public static PluginVersion valueOfSnapshot(int major, int minor, long buildNumber)
This method creates a new Snapshot Plugin version with a build number.- Parameters:
major
- the major numberminor
- the minor numberbuildNumber
- the buildNumber- Returns:
- a Plugin version
-
valueOfProperties
public static PluginVersion valueOfProperties(Properties properties)
This method constructs a PluginVersion based on the specified properties.Examples of possible content of 'plugin-version.properties':
Example 1: artifact-version=8.1 build-number=300 Example 2: artifact-version=8-SNAPSHOT build-number=123
Note: Build number is only used for snapshots.
- Parameters:
properties
- the properties containing the version information- Returns:
- the plugin version constructed from the properties files.
-
createVersionFromString
public static PluginVersion createVersionFromString(String artifactVersion, String buildNumber)
-
isSnapshot
public boolean isSnapshot()
This method returns true if this version is a snapshot. If the version is not a snapshot, it is considered a release.- Returns:
- true is this version is a snapshot
-
getMajor
public int getMajor()
This method returns the major number.- Returns:
- the major number
-
getMinor
public int getMinor()
This method returns the minor number.- Returns:
- the minor number (-1 if this version has no minor number)
-
getBuildNumber
public long getBuildNumber()
This method returns the build number set by Hudson.- Returns:
- the buildnumber (-1 if this version has no build number)
-
getBranch
public String getBranch()
This method returns the branch.- Returns:
- the branch name (can be null)
-
getPatch
public String getPatch()
This method returns the patch (only for release version).- Returns:
- the patch (can be null)
-
getString
public String getString()
This method returns the string representation of this version.- Returns:
- the string representation of this version.
-
-