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:
  • Method Details

    • 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 number
      minor - the minor number
      patch - 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 number
      minor - 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 number
      branch - the branch name
      buildNumber - 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 number
      buildNumber - 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 number
      minor - the minor number
      branch - the branch name
      buildNumber - 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 number
      minor - the minor number
      buildNumber - 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
       
       
      If the artifact version contains 'SNAPSHOT' a snapshot version is created. If there is no build number, '0' is used as build number.

      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.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object