public final class ProductVersionImpl extends Object implements ProductVersion, Serializable, XMLSerializable, Cloneable, CommonConstants
Implementation of a version number for an application, represented with four release levels and its product release type. The four release levels specify the major, minor, tertiary and patch level of a product.
A persistent representation of a product version may be represented by the following columns in a database:
'ProductVersion_BuildType' int(11) DEFAULT NULL,
'ProductVersion_Major' smallint(6) NOT NULL,
'ProductVersion_Minor' smallint(6) NOT NULL,
'ProductVersion_Tertiary' smallint(6) NOT NULL,
'ProductVersion_PatchLevel' smallint(6) NOT NULL
| Modifier and Type | Class and Description |
|---|---|
static class |
ProductVersionImpl.XMLHandler
XML parser event handler for converting product version elements into product version
values.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
PRODUCTVERSION_TAG |
AAF_METADICT_NAMESPACE, AAF_METADICT_PREFIX, AAF_XML_NAMESPACE, AAF_XML_PREFIX, ApplicationPluginObjectID, ApplicationPluginsID, MAX_NUM_RGBA_COMPS, MemberOfID, ObjectClassID, ParentClassID, PropertiesID, XMLClassIDAsAttributeName| Constructor and Description |
|---|
ProductVersionImpl(short major,
short minor,
short tertiary,
short patchLevel,
ProductReleaseType type)
Create a product version value that represents the version of an application.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendXMLChildren(Node parent)
Append extra child elements to the given parent node to serialize the value of an object
to an XML fragment.
|
void |
appendXMLChildren(Node parent,
String alternativeTag)
Additional version of
appendXMLChildren(Node) that allows the tag name for the
version number tag to be altered. |
ProductVersion |
clone()
Create a cloned copy of this product version.
|
static ProductVersion |
createFromBuffer(ByteBuffer buffer) |
boolean |
equals(Object o) |
static ProductVersion |
fromPersistentForm(String productVersion) |
ProductReleaseType |
getBuildType()
Returns the associated application's product release type, for example final, debug, beta etc..
|
String |
getComment()
Include a comment when serializing a value to XML.
|
short |
getMajor()
Returns the major component of the version number.
|
short |
getMinor()
Returns the minor component of the version number.
|
short |
getPatchLevel()
Returns the patch level component of the version number.
|
short |
getTertiary()
Returns the tertiary component of the version number.
|
int |
hashCode() |
static long |
lengthAsBuffer(ProductVersion value) |
static ProductVersionImpl |
parseFactory(String versionString)
Creates an instance of this product version class by parsing the given pseudo-XML version.
|
void |
setBuildType(ProductReleaseType buildType)
Sets the associated application's product release type, for example final, debug, beta etc..
|
void |
setMajor(short major)
Sets the major component of this version number.
|
void |
setMinor(short minor)
Sets the minor component of the version number.
|
void |
setPatchLevel(short patchLevel)
Sets the patch level component of the version number.
|
void |
setTertiary(short tertiary)
Sets the tertiary component of the version number.
|
static String |
toPersistentForm(ProductVersion productVersion) |
String |
toString()
Creates a pseudo-XML representation of the current value of this product version.
|
static void |
writeToBuffer(ProductVersion version,
ByteBuffer buffer) |
public static final String PRODUCTVERSION_TAG
public ProductVersionImpl(@UInt16 short major, @UInt16 short minor, @UInt16 short tertiary, @UInt16 short patchLevel, ProductReleaseType type) throws NullPointerException, IllegalArgumentException
Create a product version value that represents the version of an application.
major - Application's major version number.minor - Application's minor version number.tertiary - Application's tertiary version number.patchLevel - Application's patch level.type - Application's product release type.NullPointerException - The product release type argument is null.IllegalArgumentException - One of more of the major, minor, tertiary or patch level
values is negative.@UInt16 public final short getMajor()
ProductVersionReturns the major component of the version number.
getMajor in interface ProductVersionpublic final void setMajor(@UInt16 short major) throws IllegalArgumentException
ProductVersionSets the major component of this version number.
setMajor in interface ProductVersionmajor - Major component of the version number.IllegalArgumentException - Cannot set the major component of this product version
to a negative value.@UInt16 public final short getMinor()
ProductVersionReturns the minor component of the version number.
getMinor in interface ProductVersionpublic final void setMinor(@UInt16 short minor) throws IllegalArgumentException
ProductVersionSets the minor component of the version number.
setMinor in interface ProductVersionminor - Minor component of the version number.IllegalArgumentException - Cannot set the minor component of this product version
to a negative value.@UInt16 public final short getPatchLevel()
ProductVersionReturns the patch level component of the version number.
getPatchLevel in interface ProductVersionpublic final void setPatchLevel(@UInt16 short patchLevel) throws IllegalArgumentException
ProductVersionSets the patch level component of the version number.
setPatchLevel in interface ProductVersionpatchLevel - Patch level component of the version number.IllegalArgumentException - Cannot set the patch level component of this product version
to a negative value.@UInt16 public final short getTertiary()
ProductVersionReturns the tertiary component of the version number.
getTertiary in interface ProductVersionpublic final void setTertiary(@UInt16 short tertiary) throws IllegalArgumentException
ProductVersionSets the tertiary component of the version number.
setTertiary in interface ProductVersiontertiary - Tertiary component of the version number.IllegalArgumentException - Cannot set the tertiary component of this product version
to a negative value.public final ProductReleaseType getBuildType()
ProductVersionReturns the associated application's product release type, for example final, debug, beta etc..
getBuildType in interface ProductVersionpublic final void setBuildType(ProductReleaseType buildType) throws NullPointerException
ProductVersionSets the associated application's product release type, for example final, debug, beta etc..
setBuildType in interface ProductVersionbuildType - Associated application's release type.NullPointerException - The given product release type is null.public final String toString()
Creates a pseudo-XML representation of the current value of this product version. The value will be formatted in a similar way to the following example:
<ProductVersion>
<Major>0</Major>
<Minor>3</Minor>
<Tertiary>1</Tertiary>
<PatchLevel>2</PatchLevel>
<BuildType>VersionDebug</BuildType>
</ProductVersion>
toString in interface ProductVersiontoString in class Objectpublic static final ProductVersionImpl parseFactory(String versionString) throws NullPointerException, ParseException
Creates an instance of this product version class by parsing the given pseudo-XML version. This method will
create an instance from the result of calling the toString() method. The
pseudo-XML format is illustrated below:
<ProductVersion>
<Major>0</Major>
<Minor>3</Minor>
<Tertiary>1</Tertiary>
<PatchLevel>2</PatchLevel>
<BuildType>VersionDebug</BuildType>
</ProductVersion>
If any tags are missing, default values are used and the method returns successfully. This method ignores any namespace prefix found in an element name.
versionString - Pseudo-XML string to convert into a product version instance.NullPointerException - The given version string is null.NumberFormatException - Parse error creating a numerical value (major, minor, tertiary, patch level)
or the given build type does not match the tokens of the product
release type enumeration.ParseExceptionpublic final ProductVersion clone()
ProductVersionCreate a cloned copy of this product version.
clone in interface ProductVersionclone in class Objectpublic final void appendXMLChildren(Node parent)
XMLSerializableAppend extra child elements to the given parent node to serialize the value of an object
to an XML fragment. Methods of the XMLBuilder class are provided to help with this
process.
appendXMLChildren in interface XMLSerializableparent - XML parent element to append child nodes to.public final void appendXMLChildren(Node parent, String alternativeTag)
Additional version of appendXMLChildren(Node) that allows the tag name for the
version number tag to be altered.
parent - Parent node to append this product version to as an XML child.alternativeTag - Name of the tag to use to represent the product version.public String getComment()
XMLSerializableInclude a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.
getComment in interface XMLSerializablepublic static final ProductVersion createFromBuffer(ByteBuffer buffer) throws NullPointerException, EndOfDataException
public static final long lengthAsBuffer(ProductVersion value)
public static final void writeToBuffer(ProductVersion version, ByteBuffer buffer) throws NullPointerException, InsufficientSpaceException
public static final String toPersistentForm(ProductVersion productVersion)
public static final ProductVersion fromPersistentForm(String productVersion)
(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.