com.h3c.util.version

## Class BuildVersion

- java.lang.Object
- - com.h3c.util.version.BuildVersion

- All Implemented Interfaces:
    Serializable, Comparable<BuildVersion>

      public class BuildVersion
      extends Object
      implements Comparable<BuildVersion>, Serializable

  Instances of this class represent a build version of the form " `[Major].[Minor].[Patch].[Build]`". Instances of this class are used to facilitate some neat automated build functionality. They are also used as a basis for `ReleaseVersion` instances.

  Instances are immutable, which makes them thread-safe. The `equals()` and `hashCode()` methods have been overridden so that this class will play nicely with the Collection framework (e.g. using instances as keys in maps). This class implements the `Comparable` interface so instances sort correctly.

  See Also:
    Serialized Form

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(BuildVersion bv)`
    `boolean` | `equals(Object o)`
    `String` | `getBuild()` Returns the build component of the build version.
    `int` | `getMajor()` Returns the major component of the build version.
    `int` | `getMinor()` Returns the minor component of the build version.
    `int` | `getPatch()` Returns the patch component of the build version.
    `ReleaseVersion` | `getReleaseVersion()` Returns this build version wrapped in a release version.
    `int` | `hashCode()`
    `String` | `toShortString()`
    `String` | `toString()`
    `static BuildVersion` | `valueOf(int major, int minor, int patch, String build)` Returns the build version instance that the specified integer parameters represent.
    `static BuildVersion` | `valueOf(String buildVersionStr)` Returns the build version instance that the specified string represents.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getMajor

          public int getMajor()

      Returns the major component of the build version.
      Returns:
        the major component

    - #### getMinor

          public int getMinor()

      Returns the minor component of the build version.
      Returns:
        the minor component

    - #### getPatch

          public int getPatch()

      Returns the patch component of the build version.
      Returns:
        the patch component

    - #### getBuild

          public String getBuild()

      Returns the build component of the build version.
      Returns:
        the build component

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toShortString

          public String toShortString()

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### compareTo

          public int compareTo(BuildVersion bv)

      Specified by:
        `compareTo` in interface `Comparable<BuildVersion>`

    - #### getReleaseVersion

          public ReleaseVersion getReleaseVersion()

      Returns this build version wrapped in a release version.
      Returns:
        the release version with this build version embedded

    - #### valueOf

          public static BuildVersion valueOf(String buildVersionStr)

      Returns the build version instance that the specified string represents. The parameter is expected to be of the form `"M.mm.pp.bbb"` where
      - M is the major number
      - m is the minor number
      - p is the patch number
      - bbbb is the build number (alphanumeric)
      For example:

           BuildVersion bv = BuildVersion.valueOf("5.50.2.79c");

      Parameters:
        `buildVersionStr` - the version string in `"M.mm.pp.bbb"` form
      Returns:
        the build version instance
      Throws:
        `NullPointerException` - if the parameter is null
        `IllegalArgumentException` - if the parameter is ill-formed

    - #### valueOf

          public static BuildVersion valueOf(int major,
                             int minor,
                             int patch,
                             String build)

      Returns the build version instance that the specified integer parameters represent.
      Parameters:
        `major` - the major number
        `minor` - the minor number
        `patch` - the patch number
        `build` - the build number
      Returns:
        the build version instance
      Throws:
        `IllegalArgumentException` - if bad parameters are passed in

Copyright © 2014. All Rights Reserved.