com.h3c.util.version

## Class AbstractReleaseCandidateData

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

- All Implemented Interfaces:
    ReleaseCandidateData

      public abstract class AbstractReleaseCandidateData
      extends Object
      implements ReleaseCandidateData

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

       public class MyReleaseCandidateData extends AbstractReleaseCandidateData {

           // This array contains tuples of four strings, one per release candidate:
           // candidate number, build number, date of build, official release flag.

           private static final String[] DATA = {
               // candidate  build             date of           official
               // number     number            build             release
               // (int)      ("M.m.p.bbbb")   ("YYYY-MM-DD")    ("true"/"false")
               // -----      --------------    --------------    ----------------
               "1",          "5.0.3.0126",    "2010-06-01",     "false",
               "2",          "5.0.3.0128",    "2010-06-03",     "false",
               "3",          "5.0.3.0385",    "2010-06-04",     "true",
           };

           // Constructs our instance
           private MyReleaseCandidateData() { super(DATA); }

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

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

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractReleaseCandidateData(String[] data)` Protected constructor that takes a string array of data with which to initialize this instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ReleaseCandidate[]` | `getAllReleaseCandidates()` Returns an array of all release candidates to-date.
    `ReleaseCandidate` | `getMostRecentReleaseCandidate()` Returns the most recently defined release candidate.

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

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

- - ### Constructor Detail

    - #### AbstractReleaseCandidateData

          protected AbstractReleaseCandidateData(String[] data)

      Protected constructor that takes a string array of data with which to initialize this instance.
      Parameters:
        `data` - the release candidate data
      Throws:
        `NullPointerException` - if data is null, or if a data element is null
        `IllegalArgumentException` - if any of the data elements are ill-formed

  - ### Method Detail

    - #### getAllReleaseCandidates

          public final ReleaseCandidate[] getAllReleaseCandidates()

      Description copied from interface: `ReleaseCandidateData`
      Returns an array of all release candidates to-date. May be an empty array if no candidates have been identified yet.
      Specified by:
        `getAllReleaseCandidates` in interface `ReleaseCandidateData`
      Returns:
        the release candidates

    - #### getMostRecentReleaseCandidate

          public final ReleaseCandidate getMostRecentReleaseCandidate()

      Description copied from interface: `ReleaseCandidateData`
      Returns the most recently defined release candidate. If no candidates have been identified yet, null should be returned.
      Specified by:
        `getMostRecentReleaseCandidate` in interface `ReleaseCandidateData`
      Returns:
        the most recent release candidate, or null

Copyright © 2014. All Rights Reserved.