|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttv.amwa.maj.embeddable.VersionType
public final class VersionType
Implements a 2-byte unsigned 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
ProductVersion
,
Header.getFileRevision()
,
PluginDefinition
,
Serialized FormConstructor Summary | |
---|---|
VersionType()
Create a new version number, set to " 0.0 ". |
|
VersionType(byte major,
byte minor)
Create a version number from its major and minor component. |
Method Summary | |
---|---|
void |
appendXMLChildren(Node parent)
Append child elements to the given parent node to serialize the value of an object to an XML fragment. |
static VersionType |
castFromInterface(VersionType alien)
Cast a value the implements the VersionType interface
to concrete value of this implementation. |
VersionType |
clone()
Creates a cloned deep copy of this embeddable value. |
int |
compareTo(VersionType o)
Compare this version number to the given version number. |
boolean |
equals(Object o)
Tests to see if the given object is equal to this embeddable value. |
static String |
format(VersionType version)
Format a version number as a string. |
byte |
getMajor()
Returns the major component of the version number. |
byte |
getMinor()
Returns the minor component of the version number. |
int |
hashCode()
Returns a hash code value for this embeddable object. |
static VersionType |
parseVersion(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. |
void |
setPropertiesFromInterface(VersionType castFrom)
Set the properties of this value from another value that implements that implements the VersionType interface. |
String |
toString()
Formats the version number as a string representation using an XML element. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VersionType(@UInt8 byte major, @UInt8 byte minor)
Create a version number from its major and minor component.
major
- Major component of version number.minor
- Minor component of version number.public VersionType()
Create a new version number, set to "0.0
".
Method Detail |
---|
public static final VersionType castFromInterface(VersionType alien) throws NullPointerException
Cast a value the implements the VersionType
interface
to concrete value of this implementation.
alien
- Value to cast to a concrete instance.
NullPointerException
- The given version number value is null
.public final void setPropertiesFromInterface(VersionType castFrom) throws NullPointerException
Set the properties of this value from another value that implements that
implements the VersionType
interface.
castFrom
- Value to use to set the version number.
NullPointerException
- The given version number is null
.public final byte getMajor()
VersionType
Returns the major component of the version number.
getMajor
in interface VersionType
public final void setMajor(byte major)
VersionType
Sets the major component of the version number.
setMajor
in interface VersionType
major
- Major component of the version number.public final byte getMinor()
VersionType
Returns the minor component of the version number.
getMinor
in interface VersionType
public void setMinor(byte minor)
VersionType
Sets the minor component of the version number.
setMinor
in interface VersionType
minor
- Minor component of the version number.public final String toString()
Formats the version number as a string representation using an XML element. For example:
<Version>1.1</Version>
Note that "2.10
" is a later version than "2.9
".
toString
in interface MAJCommon
toString
in class Object
Object.toString()
public static final VersionType parseVersion(String versionAsString) throws NullPointerException, NumberFormatException
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.
versionAsString
- String representation of a version number.
NullPointerException
- The given version number string is null
.
NumberFormatException
- The given version number string causes parse or number range errors
that prevent it from being converted into a version number value.public final int hashCode()
MAJCommon
Returns a hash code value for this embeddable object.
hashCode
in interface MAJCommon
hashCode
in class Object
Object.hashCode()
public final int compareTo(VersionType o) throws NullPointerException
Compare this version number to the given version number.
compareTo
in interface Comparable<VersionType>
o
- Version number to compare with this one.
-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)
public final boolean equals(Object o)
MAJCommon
Tests to see if the given object is equal to this embeddable value. To be equal, the given value must be not null, share the same interface to its value and each of the properties of the value must each be equal.
equals
in interface MAJCommon
equals
in class Object
o
- Object to test for equality with.
Object.equals(Object)
public final VersionType clone()
MAJCommon
Creates a cloned deep copy of this embeddable value. The clone will be initialized to have the same value as this value but exists independently from then on. Changes to this value will not effect the clone and changes to the clone will not effect this. MAJ API clones are true deep clones with no shared references to areas of memory within the original.
This method does not throw a CloneNotSupportedException
as all
embeddable values must implement the Cloneable
interface.
clone
in interface MAJCommon
clone
in class Object
Object.clone()
public final void appendXMLChildren(Node parent)
XMLSerializable
Append 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 XMLSerializable
parent
- XML parent element to append child nodes to.public static final String format(VersionType version) throws NullPointerException
Format a version number as a string.
version
- Version number value to format as a string.
NullPointerException
- Version value is null
.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |