Media Authoring
with Java API

tv.amwa.maj.iface
Interface TypeDefinitionEnumeration

All Superinterfaces:
MetaDefinition, TypeDefinition
All Known Implementing Classes:
TypeDefinitionEnumeration

public interface TypeDefinitionEnumeration
extends TypeDefinition

Specifies the definition of a property type that can have one of a set of integer values. Every element in the set has both an integer value and a string label. The enumeration type is equivalent to the Java Enum type.

Author:
Richard Cartwright
See Also:
makeTypeDefinitionEnumeration(), TypeCategory.Enum, Enum

Method Summary
 int countElements()
          Returns the number of enumeration elements contained in the list of elements of this enumeration type definition.
 PropertyValue createValueFromName(String name)
          Creates and returns an enumeration property value of this enumeration type using the given enumeration element name.
 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.
 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.
 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 value)
          Returns the name associated with the given enumeration property value as defined by this enumeration type definition.
 
Methods inherited from interface tv.amwa.maj.iface.TypeDefinition
createValue, getTypeCategory
 
Methods inherited from interface tv.amwa.maj.iface.MetaDefinition
getAUID, getDescription, getName, setDescription, setName
 

Method Detail

createValueFromName

PropertyValue createValueFromName(@AAFString
                                  String name)
                                  throws NullPointerException,
                                         InvalidParameterException

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

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.

getElementType

TypeDefinition getElementType()

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.

Returns:
Type definition of the integer values that are found in this enumeration.
See Also:
TypeDefinitionInteger

getElementValue

@UInt64
long getElementValue(@UInt32
                            int index)
                     throws IndexOutOfBoundsException

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

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.

getElementName

@AAFString
String getElementName(@UInt32
                                int index)
                      throws IndexOutOfBoundsException

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

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

countElements

@UInt32
int countElements()

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

Returns:
Number of enumeration elements contained in this enumeration type definition.

getNameFromValue

@AAFString
String getNameFromValue(PropertyValue value)
                        throws NullPointerException,
                               IllegalPropertyValueException

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

Parameters:
value - 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.

getNameFromInteger

@AAFString
String getNameFromInteger(@Int64
                                    long value)
                          throws IllegalPropertyValueException

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

Parameters:
value - Integer value associated with an enumeration element.
Returns:
Name of the element with the given integer in this enumeration type definition.
Throws:
IllegalPropertyValueException - The given value is not associated with an enumeration element in this enumeration type definition.

getIntegerValue

@Int64
long getIntegerValue(PropertyValue enumerationProperty)
                     throws NullPointerException,
                            IllegalPropertyValueException

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

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.

getEnumeration

Class<Enum<?>> getEnumeration()

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

Returns:
Java enumeration associated with this type definition.

Media Authoring
with Java API

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