VersionTypeImpl (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.record.impl

## Class VersionTypeImpl

- java.lang.Object
- - tv.amwa.maj.record.impl.VersionTypeImpl

- All Implemented Interfaces:
    Serializable, Cloneable, Comparable<VersionType>, CommonConstants, VersionType

      public final class VersionTypeImpl
      extends Object
      implements VersionType, Serializable, Comparable<VersionType>, Cloneable, CommonConstants

  Implements a 2-byte version number, consisting of a major and minor component.

  A persistent representation of a product version may be represented by the following columns in a database:

           'VersionType_major' tinyint(4) NOT NULL,
           'VersionType_minor' tinyint(4) NOT NULL

  See Also:
    `ProductVersionImpl`, `Preface.getFormatVersion()`, `PluginDefinition`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `MYSQL_COLUMN_DEFINITION`

    - ### Fields inherited from interface tv.amwa.maj.constant.CommonConstants

      `AAF_METADICT_NAMESPACE, AAF_METADICT_PREFIX, AAF_XML_NAMESPACE, AAF_XML_PREFIX, ApplicationPluginObjectID, ApplicationPluginsID, MAX_NUM_RGBA_COMPS, MemberOfID, ObjectClassID, ParentClassID, PropertiesID, XMLClassIDAsAttributeName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VersionTypeImpl()` Create a new version number, set to "`0.0`".
    `VersionTypeImpl(byte major, byte minor)` Create a version number from its major and minor component.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `VersionType` | `clone()` Create a cloned copy of this version value.
    `int` | `compareTo(VersionType o)` Compare this version number to the given version number.
    `boolean` | `equals(Object o)`
    `static String` | `format(VersionTypeImpl version)` Format a version number as a string.
    `static VersionType` | `fromPersistentForm(String version)`
    `String` | `getEventComment()`
    `byte` | `getMajor()` Returns the major component of the version number.
    `byte` | `getMinor()` Returns the minor component of the version number.
    `int` | `hashCode()`
    `static VersionTypeImpl` | `parseFactory(String versionAsString)` Parse a string representation of a version number and create a value of this class.
    `void` | `setMajor(byte major)` Sets the major component of the version number.
    `void` | `setMinor(byte minor)` Sets the minor component of the version number.
    `static String` | `toPersistentForm(VersionType version)`
    `String` | `toString()` Formats the version number as a string representation.

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### MYSQL_COLUMN_DEFINITION

          public static final String MYSQL_COLUMN_DEFINITION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### VersionTypeImpl

          public VersionTypeImpl(@Int8
                                 byte major,
                                 @Int8
                                 byte minor)

      Create a version number from its major and minor component.

      Parameters:
        `major` - Major component of version number.
        `minor` - Minor component of version number.

    - #### VersionTypeImpl

          public VersionTypeImpl()

      Create a new version number, set to "`0.0`".

  - ### Method Detail

    - #### getMajor

          public final byte getMajor()

      Description copied from interface: `VersionType`

      Returns the major component of the version number.

      Specified by:
        `getMajor` in interface `VersionType`
      Returns:
        Major component of the version number.

    - #### setMajor

          public final void setMajor(byte major)

      Description copied from interface: `VersionType`

      Sets the major component of the version number.

      Specified by:
        `setMajor` in interface `VersionType`
      Parameters:
        `major` - Major component of the version number.

    - #### getMinor

          public final byte getMinor()

      Description copied from interface: `VersionType`

      Returns the minor component of the version number.

      Specified by:
        `getMinor` in interface `VersionType`
      Returns:
        Minor component of the version number.

    - #### setMinor

          public void setMinor(byte minor)

      Description copied from interface: `VersionType`

      Sets the minor component of the version number.

      Specified by:
        `setMinor` in interface `VersionType`
      Parameters:
        `minor` - Minor component of the version number.

    - #### toString

          public final String toString()

      Formats the version number as a string representation. This format is:

      <major>`.`<minor>

      Note that "`2.10`" is a later version than "`2.9`".

      Specified by:
        `toString` in interface `VersionType`
      Overrides:
        `toString` in class `Object`
      See Also:
        `Object.toString()`

    - #### parseFactory

          public static final VersionTypeImpl parseFactory(String versionAsString)
                                                    throws NullPointerException,
                                                           ParseException

      Parse a string representation of a version number and create a value of this class. The value must contain a '`.`' to be valid. The major and minor parts of the version numbers, before and after the dot respectively, must range between 0 and 255.

      Parameters:
        `versionAsString` - String representation of a version number.
      Returns:
        Version number value.
      Throws:
        `NullPointerException` - The given version number string is `null`.
        `ParseException` - The given version number string causes parse or number range errors that prevent it from being converted into a version number value.

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### compareTo

          public final int compareTo(VersionType o)
                              throws NullPointerException

      Compare this version number to the given version number.

      Specified by:
        `compareTo` in interface `Comparable<VersionType>`
      Specified by:
        `compareTo` in interface `VersionType`
      Parameters:
        `o` - Version number to compare with this one.
      Returns:
        A value of `-1`if this version number is less than the given one, `1` if this version is greater and `0` if the two version numbers and equal.``
      Throws:
        `NullPointerException` - The given value is `null`.
      See Also:
        `Comparable.compareTo(Object)`

    - #### equals

          public final boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### clone

          public final VersionType clone()

      Description copied from interface: `VersionType`

      Create a cloned copy of this version value.

      Specified by:
        `clone` in interface `VersionType`
      Overrides:
        `clone` in class `Object`
      Returns:
        Cloned copy of this version value.

    - #### format

          public static final String format(VersionTypeImpl version)
                                     throws NullPointerException

      Format a version number as a string.

      Parameters:
        `version` - Version number value to format as a string.
      Returns:
        Version number formatted as a string.
      Throws:
        `NullPointerException` - Version value is `null`.

    - #### getEventComment

          public String getEventComment()

    - #### toPersistentForm

          public static final String toPersistentForm(VersionType version)

    - #### fromPersistentForm

          public static final VersionType fromPersistentForm(String version)

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.