Media Authoring
with Java API

tv.amwa.maj.meta
Class TypeDefinitionExtendibleEnumeration

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

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

Implements the definition of a property type that can have one of an extendible set of AUID values.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class TypeDefinitionExtendibleEnumeration.ElementXMLHandler
           
static class TypeDefinitionExtendibleEnumeration.ExtendibleEnumerationValue
           
static class TypeDefinitionExtendibleEnumeration.XMLHandler
           
 
Field Summary
static TypeDefinitionExtendibleEnumeration CodingEquationsType
           
static TypeDefinitionExtendibleEnumeration ColorPrimariesType
           
static TypeDefinitionExtendibleEnumeration OperationCategoryType
           
static TypeDefinitionExtendibleEnumeration PluginCategoryType
           
static TypeDefinitionExtendibleEnumeration TransferCharacteristicType
           
static TypeDefinitionExtendibleEnumeration UsageType
           
 
Constructor Summary
TypeDefinitionExtendibleEnumeration(AUID identification, String typeName, SortedMap<String,AUID> elements)
          Creates and initializes the new extensible enumeration type definition, which defines a property type that can have one of an extendible set of AUID values.
 
Method Summary
 void appendElement(AUID value, String name)
          Appends the given element, a name and AUID pair, to this extendible enumeration type definition.
 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 of this extendible enumeration type definition.
 PropertyValue createValue(Object javaValue)
          Create a property value from the given Java object.
 PropertyValue createValueFromName(String name)
          Creates a property value defined by this extendible enumeration type definition using the given name.
 boolean deepEquals(Object o)
          Check to see if this definition is equal to the given object by comparing each property.
 AUID getAUIDFromName(String name)
          Returns the identifier of the enumeration element associated with the given name, as defined by this extendible enumeration type definition.
 AUID getAUIDValue(PropertyValue enumerationProperty)
          Returns the AUID value associated with the given extendible enumeration property value according to this extendible enumeration type definition.
 String getElementName(int index)
          Returns the name of the enumeration element at the given index in the list of elements of this extendible enumeration type definition.
 String[] getElementNames()
           
 AUID getElementValue(int index)
          Returns the AUID value for the enumeration element at the given index of in the list of elements of this extendible enumeration type definition.
 AUID[] getElementValues()
           
 String getNameFromAUID(AUID value)
          Returns the name of the enumeration element associated with the given AUID value, as defined by this extendible enumeration type definition.
 String getNameFromValue(PropertyValue enumerationProperty)
          Returns the name associated with the given property value, as defined by this extendible enumeration type definition.
 TypeCategory getTypeCategory()
          Returns the type category to which this type definition belongs, which corresponds to its sub interface.
 void setAUIDValue(PropertyValue enumerationProperty, AUID value)
          Sets the value of the given extendible enumeration property value to the given AUID that identifies an element of this extendible enumeration type definition.
 void setPropertiesFromInterface(TypeDefinitionExtendibleEnumeration 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

OperationCategoryType

public static final TypeDefinitionExtendibleEnumeration OperationCategoryType

TransferCharacteristicType

public static final TypeDefinitionExtendibleEnumeration TransferCharacteristicType

PluginCategoryType

public static final TypeDefinitionExtendibleEnumeration PluginCategoryType

UsageType

public static final TypeDefinitionExtendibleEnumeration UsageType

ColorPrimariesType

public static final TypeDefinitionExtendibleEnumeration ColorPrimariesType

CodingEquationsType

public static final TypeDefinitionExtendibleEnumeration CodingEquationsType
Constructor Detail

TypeDefinitionExtendibleEnumeration

public TypeDefinitionExtendibleEnumeration(AUID identification,
                                           @AAFString
                                           String typeName,
                                           SortedMap<String,AUID> elements)
                                    throws NullPointerException,
                                           DuplicateException

Creates and initializes the new extensible enumeration type definition, which defines a property type that can have one of an extendible set of AUID values. The initial set of (possibly empty) elements must be provided as a map from element name to AUID. Further enumeration elements can then be specified using the appendElement(AUID, String) method.

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 - AUID to be used to identify this type.
typeName - Friendly name of the type definition.
elements - Map containing element names and the AUIDs they map to.
Throws:
NullPointerException - One or more of the arguments is null.
DuplicateException - The given representation of an extendible enumeration contains duplicate AUID values.
See Also:
ExtendibleEnumerationWarehouse, ExtendibleEnumerationItem
Method Detail

setPropertiesFromInterface

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

getElementNames

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

getElementValues

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

appendElement

public void appendElement(AUID value,
                          String name)
                   throws NullPointerException,
                          DuplicateException
Description copied from interface: TypeDefinitionExtendibleEnumeration

Appends the given element, a name and AUID pair, to this extendible enumeration type definition.

Specified by:
appendElement in interface TypeDefinitionExtendibleEnumeration
Parameters:
value - AUID for the new enumeration element to append.
name - Name for the new enumeration element to append.
Throws:
NullPointerException - One or both of the arguments is/are null.
DuplicateException - Appending the given enumeration element would introduce a duplicate value and/or duplicate name.

countElements

public int countElements()
Description copied from interface: TypeDefinitionExtendibleEnumeration

Returns the number of enumeration elements of this extendible enumeration type definition.

Specified by:
countElements in interface TypeDefinitionExtendibleEnumeration
Returns:
Number of enumeration elements of this extendible enumeration type definition.

createValueFromName

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

Creates a property value defined by this extendible enumeration type definition using the given name. The name is checked to see that it is in the list of names defining elements of this enumeration.

Specified by:
createValueFromName in interface TypeDefinitionExtendibleEnumeration
Parameters:
name - Name to use to create a new extendible enumeration property value.
Returns:
New extendible enumeration property value corresponding to the given name.
Throws:
NullPointerException - The given name is null.
InvalidParameterException - The given name does not match an element of this extendible enumeration type definition.
See Also:
TypeDefinitionExtendibleEnumeration.setAUIDValue(PropertyValue, AUID)

getAUIDValue

public AUID getAUIDValue(PropertyValue enumerationProperty)
                  throws NullPointerException,
                         IllegalPropertyValueException
Description copied from interface: TypeDefinitionExtendibleEnumeration

Returns the AUID value associated with the given extendible enumeration property value according to this extendible enumeration type definition.

Specified by:
getAUIDValue in interface TypeDefinitionExtendibleEnumeration
Parameters:
enumerationProperty - Extensible enumeration property value to find the associated AUID value for.
Returns:
AUID associated with the given property value by this extendible enumeration type definition.
Throws:
NullPointerException - The given extendible enumeration property value is null.
IllegalPropertyValueException - The given property value is not defined by this extendible enumeration type definition.
See Also:
TypeDefinitionExtendibleEnumeration.getNameFromAUID(AUID), TypeDefinitionExtendibleEnumeration.getAUIDFromName(String)

getElementName

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

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

Specified by:
getElementName in interface TypeDefinitionExtendibleEnumeration
Parameters:
index - Index of the required name.
Returns:
Name for the enumeration element at the given index in the list of elements of this extendible enumeration type definition.
Throws:
IndexOutOfBoundsException - The given index is outside the acceptable range for this extendible enumeration type definition.

getElementValue

public AUID getElementValue(int index)
                     throws IndexOutOfBoundsException
Description copied from interface: TypeDefinitionExtendibleEnumeration

Returns the AUID value for the enumeration element at the given index of in the list of elements of this extendible enumeration type definition.

Specified by:
getElementValue in interface TypeDefinitionExtendibleEnumeration
Parameters:
index - Index of the required AUID value.
Returns:
AUID value for the enumeration element at the given index of the list of elements of this extendible enumeration type definition.
Throws:
IndexOutOfBoundsException - The given index is outside the acceptable range for the list of elements of this extendible enumeration type definition.

getAUIDFromName

public AUID getAUIDFromName(String name)
                     throws NullPointerException,
                            BadParameterException
Description copied from interface: TypeDefinitionExtendibleEnumeration

Returns the identifier of the enumeration element associated with the given name, as defined by this extendible enumeration type definition.

Specified by:
getAUIDFromName in interface TypeDefinitionExtendibleEnumeration
Parameters:
name - Name to use to lookup the element identifier.
Returns:
Identifier associated with the given name in this extendible enumeration type definition.
Throws:
NullPointerException - The given element name is null.
BadParameterException - The given element name is not known for in the list of values of this extendible enumeration type definition.
See Also:
TypeDefinitionExtendibleEnumeration.getNameFromAUID(AUID)

getNameFromAUID

public String getNameFromAUID(AUID value)
                       throws NullPointerException,
                              BadParameterException
Description copied from interface: TypeDefinitionExtendibleEnumeration

Returns the name of the enumeration element associated with the given AUID value, as defined by this extendible enumeration type definition.

Specified by:
getNameFromAUID in interface TypeDefinitionExtendibleEnumeration
Parameters:
value - Value to use to lookup the element name.
Returns:
Name associated with the given value in this extendible enumeration type definition.
Throws:
NullPointerException - The given identifier is null.
BadParameterException - The given value is not found in the list of values of this extendible enumeration type definition.
See Also:
TypeDefinitionExtendibleEnumeration.getAUIDFromName(String)

getNameFromValue

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

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

Specified by:
getNameFromValue in interface TypeDefinitionExtendibleEnumeration
Parameters:
enumerationProperty - Property value to lookup the name of.
Returns:
Name of the enumeration element of the given extendible enumeration property value.
Throws:
NullPointerException - The given extendible enumeration property value is null.
IllegalPropertyValueException - The given property value is not defined by this extendible enumeration type definition.

setAUIDValue

public void setAUIDValue(PropertyValue enumerationProperty,
                         AUID value)
                  throws NullPointerException,
                         IllegalPropertyValueException,
                         BadParameterException
Description copied from interface: TypeDefinitionExtendibleEnumeration

Sets the value of the given extendible enumeration property value to the given AUID that identifies an element of this extendible enumeration type definition.

Specified by:
setAUIDValue in interface TypeDefinitionExtendibleEnumeration
Parameters:
enumerationProperty - Extensible enumeration property value to change.
value - New value to set the given property value to.
Throws:
NullPointerException - One or both of the arguments is/are null.
IllegalPropertyValueException - The given property value is not defined by this extendible enumeration type definition.
BadParameterException - The given enumeration value identifier does not identifiy an element of this extendible enumeration type.
See Also:
TypeDefinitionExtendibleEnumeration.getNameFromAUID(AUID), TypeDefinitionExtendibleEnumeration.getAUIDFromName(String), TypeDefinitionExtendibleEnumeration.createValueFromName(String)

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.