com.h3c.util.version

## Class AbstractReleaseVersionData

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

- All Implemented Interfaces:
    ReleaseVersionData

      public abstract class AbstractReleaseVersionData
      extends Object
      implements ReleaseVersionData

  A base class for implementing `ReleaseVersionData`. The recommended pattern for subclasses is as follows:

       public class MyReleaseVersionData extends AbstractReleaseVersionData {

           private static final String STR_5_0_1 = "5.00.01";
           private static final String STR_5_0_2 = "5.00.02";
           private static final String STR_5_0_3 = "5.00.03";

           /** Release version 5.00.01 */
           public static final ReleaseVersion V_5_0_1 = makeVersion(STR_5_0_1);
           /** Release version 5.00.02 */
           public static final ReleaseVersion V_5_0_2 = makeVersion(STR_5_0_2);
           /** Release version 5.00.03 */
           public static final ReleaseVersion V_5_0_3 = makeVersion(STR_5_0_3);

           // Constructs our instance
           private MyReleaseVersionData() {
               super(
                   V_5_0_1,
                   V_5_0_2,
                   V_5_0_3
               );
           }

           // our singleton
           private static final MyReleaseVersionData INSTANCE = new MyReleaseVersionData();

           /** Returns a reference to our singleton instance.
            *
            * @return the singleton
            */
           public static MyReleaseVersionData getInstance() { return INSTANCE; }
       }

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractReleaseVersionData(ReleaseVersion... data)` Protected constructor that takes a variable number of release version instances, removes duplicates, sorts them, and stores a copy.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ReleaseVersion[]` | `getAllReleaseVersions()` Returns an array containing the official release versions for the project.
    `ReleaseVersion` | `getMostRecentReleaseVersion()` Returns the most recently defined release version.
    `protected static ReleaseVersion` | `makeVersion(String s)` Returns a release version instance corresponding to the given string (`"M.mm.pp"`).

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractReleaseVersionData

          protected AbstractReleaseVersionData(ReleaseVersion... data)

      Protected constructor that takes a variable number of release version instances, removes duplicates, sorts them, and stores a copy.
      Parameters:
        `data` - the release versions
      Throws:
        `NullPointerException` - if any element is null

  - ### Method Detail

    - #### makeVersion

          protected static ReleaseVersion makeVersion(String s)

      Returns a release version instance corresponding to the given string (`"M.mm.pp"`).
      Parameters:
        `s` - the release version in `"M.mm.pp"` form
      Returns:
        the corresponding release version

    - #### getAllReleaseVersions

          public ReleaseVersion[] getAllReleaseVersions()

      Description copied from interface: `ReleaseVersionData`
      Returns an array containing the official release versions for the project.
      Specified by:
        `getAllReleaseVersions` in interface `ReleaseVersionData`
      Returns:
        the official release versions

    - #### getMostRecentReleaseVersion

          public ReleaseVersion getMostRecentReleaseVersion()

      Description copied from interface: `ReleaseVersionData`
      Returns the most recently defined release version. If no versions have been identified yet, null will be returned.
      Specified by:
        `getMostRecentReleaseVersion` in interface `ReleaseVersionData`
      Returns:
        the most recent release version, or null

Copyright © 2014. All Rights Reserved.