Media Authoring
with Java API

tv.amwa.maj.meta
Class TypeDefinitionEnumeration

java.lang.Object
  extended by tv.amwa.maj.meta.MetaDefinition
      extended by tv.amwa.maj.meta.TypeDefinition
          extended by tv.amwa.maj.meta.TypeDefinitionEnumeration
All Implemented Interfaces:
Serializable, DefinitionType, MetaDefinition, TypeDefinition, TypeDefinitionEnumeration, XMLSerializable, MAJCommon

@AAFClass(uuid1=218169601,
          uuid2=519,
          uuid3=0,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="TypeDefinitionEnumeration",
          description="The TypeDefinitionEnumeration class defines a property type that can have one of a set of integer values.")
public final class TypeDefinitionEnumeration
extends TypeDefinition
implements TypeDefinitionEnumeration, Serializable, XMLSerializable

Implements the definition of a property type that can have one of a set of integer values.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class TypeDefinitionEnumeration.EnumerationValue
           
static class TypeDefinitionEnumeration.XMLHandler
           
 
Field Summary
static TypeDefinitionEnumeration AlphaTransparencyType
           
static TypeDefinitionEnumeration AuxBitsModeType
           
static TypeDefinitionEnumeration Boolean
           
static TypeDefinitionEnumeration ChannelStatusModeType
           
static TypeDefinitionEnumeration ColorSitingType
           
static TypeDefinitionEnumeration ContentScanningType
           
static TypeDefinitionEnumeration EdgeType
           
static TypeDefinitionEnumeration EditHintType
           
static TypeDefinitionEnumeration ElectoSpatialFormulation
           
static TypeDefinitionEnumeration EmphasisType
           
static TypeDefinitionEnumeration FadeType
           
static TypeDefinitionEnumeration FieldNumber
           
static TypeDefinitionEnumeration FilmType
           
static TypeDefinitionEnumeration LayoutType
           
static TypeDefinitionEnumeration ProductReleaseType
           
static TypeDefinitionEnumeration PulldownDirectionType
           
static TypeDefinitionEnumeration PulldownKindType
           
static TypeDefinitionEnumeration ReferenceType
           
static TypeDefinitionEnumeration RGBAComponentKind
           
static TypeDefinitionEnumeration ScanningDirectionType
           
static TypeDefinitionEnumeration SignalStandardType
           
static TypeDefinitionEnumeration TapeCaseType
           
static TypeDefinitionEnumeration TapeFormatType
           
static TypeDefinitionEnumeration TCSource
           
static TypeDefinitionEnumeration TimecodeSource
           
static TypeDefinitionEnumeration UserDataModeType
           
static TypeDefinitionEnumeration VideoSignalType
           
 
Constructor Summary
TypeDefinitionEnumeration(AUID identification, String typeName, Class<?> enumeration)
          Creates and initializes an enumeration type definition, which defines a property type that can have one of a set of integer values.
 
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.
 int countElements()
          Returns the number of enumeration elements contained in the list of elements of this enumeration type definition.
 PropertyValue createValue(Object javaValue)
          Create a property value from the given Java object.
 PropertyValue createValueFromName(String name)
          Creates and returns an enumeration property value of this enumeration type using the given enumeration element name.
 boolean deepEquals(Object o)
          Check to see if this definition is equal to the given object by comparing each property.
 String getElementName(int index)
          Returns the name of the enumeration element at the given index into the list of elements of this enumeration type definition.
 String[] getElementNames()
           
 TypeDefinition getElementType()
          Returns the type definition of the integer values that are found in this enumeration.
 long getElementValue(int index)
          Returns the integer value associated with the enumeration element at the given index in the list of elements of this enumeration type definition.
 long[] getElementValues()
           
 Class<Enum<?>> getEnumeration()
          Returns the Enum Java type associated with this enumeration type definition.
 long getIntegerValue(PropertyValue enumerationProperty)
          Returns the integer value associated with the given enumeration property value as defined by this enumeration type definition.
 String getNameFromInteger(long value)
          Returns the name element with the given integer in this enumeration type definition.
 String getNameFromValue(PropertyValue enumerationProperty)
          Returns the name associated with the given enumeration property value as defined by this enumeration type definition.
 TypeCategory getTypeCategory()
          Returns the type category to which this type definition belongs, which corresponds to its sub interface.
 void setPropertiesFromInterface(TypeDefinitionEnumeration castFrom)
           
 
Methods inherited from class tv.amwa.maj.meta.TypeDefinition
setPropertiesFromInterface
 
Methods inherited from class tv.amwa.maj.meta.MetaDefinition
castFromInterface, equals, getAUID, getDescription, getIdentification, getName, hashCode, setDescription, setName, setPropertiesFromInterface, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface tv.amwa.maj.iface.MetaDefinition
getAUID, getDescription, getName, setDescription, setName
 
Methods inherited from interface tv.amwa.maj.meta.MAJCommon
equals, hashCode, toString
 

Field Detail

Boolean

public static final TypeDefinitionEnumeration Boolean

ProductReleaseType

public static final TypeDefinitionEnumeration ProductReleaseType

TapeFormatType

public static final TypeDefinitionEnumeration TapeFormatType

VideoSignalType

public static final TypeDefinitionEnumeration VideoSignalType

TapeCaseType

public static final TypeDefinitionEnumeration TapeCaseType

ColorSitingType

public static final TypeDefinitionEnumeration ColorSitingType

EditHintType

public static final TypeDefinitionEnumeration EditHintType

FadeType

public static final TypeDefinitionEnumeration FadeType

TCSource

public static final TypeDefinitionEnumeration TCSource

TimecodeSource

public static final TypeDefinitionEnumeration TimecodeSource

PulldownDirectionType

public static final TypeDefinitionEnumeration PulldownDirectionType

PulldownKindType

public static final TypeDefinitionEnumeration PulldownKindType

EdgeType

public static final TypeDefinitionEnumeration EdgeType

FilmType

public static final TypeDefinitionEnumeration FilmType

RGBAComponentKind

public static final TypeDefinitionEnumeration RGBAComponentKind

ReferenceType

public static final TypeDefinitionEnumeration ReferenceType

AlphaTransparencyType

public static final TypeDefinitionEnumeration AlphaTransparencyType

FieldNumber

public static final TypeDefinitionEnumeration FieldNumber

ElectoSpatialFormulation

public static final TypeDefinitionEnumeration ElectoSpatialFormulation

SignalStandardType

public static final TypeDefinitionEnumeration SignalStandardType

ScanningDirectionType

public static final TypeDefinitionEnumeration ScanningDirectionType

LayoutType

public static final TypeDefinitionEnumeration LayoutType

EmphasisType

public static final TypeDefinitionEnumeration EmphasisType

AuxBitsModeType

public static final TypeDefinitionEnumeration AuxBitsModeType

ChannelStatusModeType

public static final TypeDefinitionEnumeration ChannelStatusModeType

UserDataModeType

public static final TypeDefinitionEnumeration UserDataModeType

ContentScanningType

public static final TypeDefinitionEnumeration ContentScanningType
Constructor Detail

TypeDefinitionEnumeration

public TypeDefinitionEnumeration(AUID identification,
                                 @AAFString
                                 String typeName,
                                 Class<?> enumeration)
                          throws NullPointerException,
                                 IllegalArgumentException

Creates and initializes an enumeration type definition, which defines a property type that can have one of a set of integer values. The enumeration is initialized with its identity and its enumeration elements defined by a java.lang.Enum class (Class<Enum>).

The interface AAFEnumerationValue must be implemented by the Java class defining the enumeration. For any enumeration value, this interface provides a method value() that is used to find the Int64 value associated with the enumeration token in the AAF object specification and associated registries. Note, however, that Java enumeration values are backed by Java int values that are actually Int32 AAF values.

Creating new and unregistered type definitions is not recommended as this may cause interoperability issues with other systems. The official registry of type definitions is available from SMPTE at SMPTE Metadata Registries And Related Items. The full range of data types documented in the AAF 1.1 object specification can be accessed by name and identification using either AAFFactory.typeDefinitionForName(String) or AAFFactory.typeDefinitionForIdentification(tv.amwa.maj.record.AUID) respectively.

Parameters:
identification - Unique indentifier to be used to identify this type.
typeName - Display name for the enumeration type definition.
enumeration - Java enumeration represented by this type definition.
Throws:
NullPointerException - One or more of the arguments is null, or one or more of the elements of the names array is null.
IllegalArgumentException - The class provided to describe this enumeration is not a Java enumeration or does not implement the AAFEnumerationValue interface.
Method Detail

setPropertiesFromInterface

public final void setPropertiesFromInterface(TypeDefinitionEnumeration castFrom)
See Also:
MetaDefinition.setPropertiesFromInterface(tv.amwa.maj.iface.MetaDefinition)

countElements

public int countElements()
Description copied from interface: TypeDefinitionEnumeration

Returns the number of enumeration elements contained in the list of elements of this enumeration type definition.

Specified by:
countElements in interface TypeDefinitionEnumeration
Returns:
Number of enumeration elements contained in this enumeration type definition.

createValueFromName

public PropertyValue createValueFromName(String name)
                                  throws NullPointerException,
                                         InvalidParameterException
Description copied from interface: TypeDefinitionEnumeration

Creates and returns an enumeration property value of this enumeration type using the given enumeration element name.

Specified by:
createValueFromName in interface TypeDefinitionEnumeration
Parameters:
name - Name of an enumeration element to create a property value for.
Returns:
Newly created property value element set to the given element name.
Throws:
NullPointerException - The given element name is null.
InvalidParameterException - The given name is not in the list of element names for this enumeration type.

getElementName

public String getElementName(int index)
                      throws IndexOutOfBoundsException
Description copied from interface: TypeDefinitionEnumeration

Returns the name of the enumeration element at the given index into the list of elements of this enumeration type definition.

Specified by:
getElementName in interface TypeDefinitionEnumeration
Parameters:
index - 0-based index of the name to retrieve from the list of elements of this enumeration type definition.
Returns:
Name of the enumeration element at the given index in the list of elements of this enumeration type definition.
Throws:
IndexOutOfBoundsException

getElementType

@AAFProperty(uuid1=100729095,
             uuid2=2816,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="ElementType",
             typeName="WeakReference to TypeDefinition",
             optional=false,
             uniqueIdentifier=false,
             pid=20)
public TypeDefinition getElementType()
Description copied from interface: TypeDefinitionEnumeration

Returns the type definition of the integer values that are found in this enumeration. For data types created using the MAJ API, this is always an Int32.

Specified by:
getElementType in interface TypeDefinitionEnumeration
Returns:
Type definition of the integer values that are found in this enumeration.
See Also:
TypeDefinitionInteger

getElementNames

@AAFProperty(uuid1=50397699,
             uuid2=1024,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="ElementNames",
             typeName="StringArray",
             optional=false,
             uniqueIdentifier=false,
             pid=21)
public String[] getElementNames()

getElementValues

@AAFProperty(uuid1=50397699,
             uuid2=1280,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="ElementValues",
             typeName="Int64Array",
             optional=false,
             uniqueIdentifier=false,
             pid=22)
public long[] getElementValues()

getElementValue

public long getElementValue(int index)
                     throws IndexOutOfBoundsException
Description copied from interface: TypeDefinitionEnumeration

Returns the integer value associated with the enumeration element at the given index in the list of elements of this enumeration type definition.

Specified by:
getElementValue in interface TypeDefinitionEnumeration
Parameters:
index - 0-based index of the integer value to retrieve from the list of elements of this enumeration type definition.
Returns:
Integer value of the element at this given index into the enumeration type definition.
Throws:
IndexOutOfBoundsException - The given index is outside the acceptable range for the enumeration type definition.

getEnumeration

public Class<Enum<?>> getEnumeration()
Description copied from interface: TypeDefinitionEnumeration

Returns the Enum Java type associated with this enumeration type definition.

Specified by:
getEnumeration in interface TypeDefinitionEnumeration
Returns:
Java enumeration associated with this type definition.

getIntegerValue

public long getIntegerValue(PropertyValue enumerationProperty)
                     throws NullPointerException,
                            IllegalPropertyValueException
Description copied from interface: TypeDefinitionEnumeration

Returns the integer value associated with the given enumeration property value as defined by this enumeration type definition.

Specified by:
getIntegerValue in interface TypeDefinitionEnumeration
Parameters:
enumerationProperty - Enumeration property value to find the associated integer for.
Returns:
Integer value associated with the given property value as defined by this enumeration type definition.
Throws:
NullPointerException - The given enumeration property is null.
IllegalPropertyValueException - The given property value is not defined by the enumeration type definition.

getNameFromInteger

public String getNameFromInteger(long value)
                          throws IllegalArgumentException
Description copied from interface: TypeDefinitionEnumeration

Returns the name element with the given integer in this enumeration type definition.

Specified by:
getNameFromInteger in interface TypeDefinitionEnumeration
Parameters:
value - Integer value associated with an enumeration element.
Returns:
Name of the element with the given integer in this enumeration type definition.
Throws:
IllegalArgumentException

getNameFromValue

public String getNameFromValue(PropertyValue enumerationProperty)
                        throws NullPointerException,
                               IllegalPropertyValueException
Description copied from interface: TypeDefinitionEnumeration

Returns the name associated with the given enumeration property value as defined by this enumeration type definition.

Specified by:
getNameFromValue in interface TypeDefinitionEnumeration
Parameters:
enumerationProperty - Enumeration property value to find the name of.
Returns:
Name associated with the given enumeration property definition according to this enumeration type definition.
Throws:
NullPointerException - The given property value is null.
IllegalPropertyValueException - The given property value is not a value of this enumeration property type.

createValue

public PropertyValue createValue(Object javaValue)
                          throws ClassCastException
Description copied from class: TypeDefinition

Create a property value from the given Java object. If the type of the object is not compatible with this type definition, a ClassCastException is thrown.

Specified by:
createValue in interface TypeDefinition
Specified by:
createValue in class TypeDefinition
Parameters:
javaValue - Java object to use to create a property value of this type.
Returns:
Property value representing the given value.
Throws:
ClassCastException - The given object cannot be cast to a property value with this type definition.

getTypeCategory

public TypeCategory getTypeCategory()
Description copied from interface: TypeDefinition

Returns the type category to which this type definition belongs, which corresponds to its sub interface. For example, TypeCategory.Int is returned for a TypeDefinitionInteger.

Specified by:
getTypeCategory in interface TypeDefinition
Specified by:
getTypeCategory in class TypeDefinition
Returns:
Type category to which the type definition belongs.
See Also:
TypeCategory

deepEquals

public final boolean deepEquals(Object o)
Description copied from class: MetaDefinition

Check to see if this definition is equal to the given object by comparing each property. The MetaDefinition.equals(Object) method only checks that the identies of two definitions are equal, relying on the unqiueness ensured by identity registration. This method is provided for debugging and validation purposes.

Overrides:
deepEquals in class MetaDefinition
Parameters:
o - Object to compare to this definition.
Returns:
Is the given object a meta definiition with all of its properties equal to this meta definition?

appendXMLChildren

public void appendXMLChildren(Node parent)
Description copied from interface: 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.

Specified by:
appendXMLChildren in interface XMLSerializable
Overrides:
appendXMLChildren in class MetaDefinition
Parameters:
parent - XML parent element to append child nodes to.

Media Authoring
with Java API

(c) 2007-2008 Richard Cartwright, all rights reserved. Subject to the terms of the AAF SDK Public Source License.