Media Authoring
with Java API

tv.amwa.maj.meta
Class TypeDefinitionVariableArray

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

@AAFClass(uuid1=218169601,
          uuid2=521,
          uuid3=0,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="TypeDefinitionVariableArray",
          description="The TypeDefinitionVariableArray class defines a property type that has a varying number of values of the underlying type. The order of the values is meaningful.")
public final class TypeDefinitionVariableArray
extends TypeDefinition
implements TypeDefinitionVariableArray, Serializable, XMLSerializable, MAJCommon

Implements the definition of a property type that has a varying number of values of the underlying type. The order of the values is meaningful.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class TypeDefinitionVariableArray.VariableArrayValue
           
static class TypeDefinitionVariableArray.XMLHandler
           
 
Field Summary
static TypeDefinitionVariableArray AUIDArray
           
static TypeDefinitionVariableArray ChannelStatusModeArray
           
static TypeDefinitionVariableArray ComponentStrongReference
           
static TypeDefinitionVariableArray ControlPointStrongReference
           
static TypeDefinitionVariableArray DataDefinitionWeakReference
           
static TypeDefinitionVariableArray DescriptiveObjectStrongReference
           
static TypeDefinitionVariableArray FileDescriptorStrongReference
           
static TypeDefinitionVariableArray IdentificationStrongReference
           
static TypeDefinitionVariableArray Int32Array
           
static TypeDefinitionVariableArray Int64Array
           
static TypeDefinitionVariableArray KLVDataStrongReference
           
static TypeDefinitionVariableArray LocatorStrongReference
           
static TypeDefinitionVariableArray MobSlotStrongReference
           
static TypeDefinitionVariableArray OperationDefinitionWeakReference
           
static TypeDefinitionVariableArray ParameterStrongReference
           
static TypeDefinitionVariableArray RIFFChunkStrongReference
           
static TypeDefinitionVariableArray SegmentStrongReference
           
static TypeDefinitionVariableArray SourceReferenceStrongReference
           
static TypeDefinitionVariableArray StringArray
           
static TypeDefinitionVariableArray SubDescriptorStrongReference
           
static TypeDefinitionVariableArray TaggedValueStrongReference
           
static TypeDefinitionVariableArray TypeDefinitionWeakReference
           
static TypeDefinitionVariableArray UInt32Array
           
static TypeDefinitionVariableArray UInt8Array
           
static TypeDefinitionVariableArray UserDataModeArray
           
 
Constructor Summary
TypeDefinitionVariableArray(AUID identification, String typeName, TypeDefinition elementType)
          Creates and initializes the varying size array type definition, defines a property type that has a varying number of values of the underlying type.
 
Method Summary
 void appendElement(PropertyValue arrayProperty, PropertyValue element)
          Append the given element to the end of the given array, which is of a type defined by this variable array 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.
 PropertyValue createEmptyValue()
          Creates a property value containing an empty variable size array, which is an array with no elements in it yet.
 PropertyValue createValue(Object javaValue)
          Create a property value from the given Java object.
 PropertyValue createValueFromArray(Object[] initialData)
          Create a property value containing a variable size array from the given array of Java objects.
 PropertyValue createValueFromList(List<Object> initialData)
          Creates a property value containing a variable size array from the given list of Java objects.
 PropertyValue createValueFromValues(PropertyValue[] elementValues)
          Creates a property value containing a variable size array from the given array of property values.
 boolean deepEquals(Object o)
          Check to see if this definition is equal to the given object by comparing each property.
 Object[] getArray(PropertyValue arrayProperty)
          Returns an array of Java objects containing the values of the given array.
 int getCount(PropertyValue arrayProperty)
          Returns the number of elements in the given array, which is of a type defined by this variable size type definition.
 List<PropertyValue> getElements(PropertyValue arrayProperty)
          Returns a copy of the internal list of all the elements in the given array.
 PropertyValue getElementValue(PropertyValue arrayProperty, int index)
          Returns the property value from the given array at the given index.
 TypeDefinition getType()
          Returns the type of elements of this variable size array type definition.
 TypeCategory getTypeCategory()
          Returns the type category to which this type definition belongs, which corresponds to its sub interface.
 void insertElement(PropertyValue arrayProperty, int index, PropertyValue element)
          Inserts the value of the given element into the given array property.
 void prependElement(PropertyValue arrayProperty, PropertyValue element)
          Prepends a given element to the beginning of the given array.
 void removeElement(PropertyValue arrayProperty, int index)
          Removes an element from the given array at the given zero-based index.
 void setArray(PropertyValue arrayProperty, List<Object> data)
          Sets the elements of a given array from the given list of Java objects.
 void setArray(PropertyValue arrayProperty, Object[] data)
          Sets the elements of a given array from the given array of Java objects.
 void setElementAt(PropertyValue arrayProperty, int index, PropertyValue element)
          Sets an element of the given array at the given index with the given value, replacing the value that is currently stored.
 void setPropertiesFromInterface(TypeDefinitionVariableArray 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

UInt8Array

public static final TypeDefinitionVariableArray UInt8Array

UInt32Array

public static final TypeDefinitionVariableArray UInt32Array

Int32Array

public static final TypeDefinitionVariableArray Int32Array

Int64Array

public static final TypeDefinitionVariableArray Int64Array

StringArray

public static final TypeDefinitionVariableArray StringArray

AUIDArray

public static final TypeDefinitionVariableArray AUIDArray

ComponentStrongReference

public static final TypeDefinitionVariableArray ComponentStrongReference

ControlPointStrongReference

public static final TypeDefinitionVariableArray ControlPointStrongReference

IdentificationStrongReference

public static final TypeDefinitionVariableArray IdentificationStrongReference

LocatorStrongReference

public static final TypeDefinitionVariableArray LocatorStrongReference

MobSlotStrongReference

public static final TypeDefinitionVariableArray MobSlotStrongReference

SegmentStrongReference

public static final TypeDefinitionVariableArray SegmentStrongReference

SourceReferenceStrongReference

public static final TypeDefinitionVariableArray SourceReferenceStrongReference

TaggedValueStrongReference

public static final TypeDefinitionVariableArray TaggedValueStrongReference

KLVDataStrongReference

public static final TypeDefinitionVariableArray KLVDataStrongReference

ParameterStrongReference

public static final TypeDefinitionVariableArray ParameterStrongReference

OperationDefinitionWeakReference

public static final TypeDefinitionVariableArray OperationDefinitionWeakReference

TypeDefinitionWeakReference

public static final TypeDefinitionVariableArray TypeDefinitionWeakReference

DataDefinitionWeakReference

public static final TypeDefinitionVariableArray DataDefinitionWeakReference

SubDescriptorStrongReference

public static final TypeDefinitionVariableArray SubDescriptorStrongReference

FileDescriptorStrongReference

public static final TypeDefinitionVariableArray FileDescriptorStrongReference

ChannelStatusModeArray

public static final TypeDefinitionVariableArray ChannelStatusModeArray

UserDataModeArray

public static final TypeDefinitionVariableArray UserDataModeArray

RIFFChunkStrongReference

public static final TypeDefinitionVariableArray RIFFChunkStrongReference

DescriptiveObjectStrongReference

public static final TypeDefinitionVariableArray DescriptiveObjectStrongReference
Constructor Detail

TypeDefinitionVariableArray

public TypeDefinitionVariableArray(AUID identification,
                                   @AAFString
                                   String typeName,
                                   TypeDefinition elementType)
                            throws NullPointerException,
                                   IllegalArgumentException

Creates and initializes the varying size array type definition, defines a property type that has a varying number of values of the underlying type. The order of the values is meaningful.

Note that it is only possible to use certain types as the element type and an IllegalArgumentException is thrown if the given type is not permitted. The permissible types are:

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.
elementType - Type of each element to be contained in the array.
Throws:
NullPointerException - The identification and/or element type arguments is/are null.
IllegalArgumentException - The given element type is not permitted for elements of a varying size array.
Method Detail

setPropertiesFromInterface

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

appendElement

public void appendElement(PropertyValue arrayProperty,
                          PropertyValue element)
                   throws NullPointerException,
                          IllegalPropertyValueException,
                          BadTypeException
Description copied from interface: TypeDefinitionVariableArray

Append the given element to the end of the given array, which is of a type defined by this variable array type definition.

Specified by:
appendElement in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Array to extend with the given element.
element - Element to use to extend the given array.
Throws:
NullPointerException - One or both of the arguments is/are null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
BadTypeException - The given element is not of a type that is compatible with this type of array.
See Also:
TypeDefinitionVariableArray.prependElement(PropertyValue, PropertyValue), TypeDefinitionVariableArray.insertElement(PropertyValue, int, PropertyValue)

createEmptyValue

public PropertyValue createEmptyValue()
Description copied from interface: TypeDefinitionVariableArray

Creates a property value containing an empty variable size array, which is an array with no elements in it yet.

Specified by:
createEmptyValue in interface TypeDefinitionVariableArray
Returns:
Property value containing an empty variable size array.
See Also:
TypeDefinitionVariableArray.createValueFromArray(Object[]), TypeDefinitionVariableArray.createValueFromList(List), TypeDefinitionVariableArray.createValueFromValues(PropertyValue[])

createValueFromArray

public PropertyValue createValueFromArray(Object[] initialData)
                                   throws ClassCastException
Description copied from interface: TypeDefinitionVariableArray

Create a property value containing a variable size array from the given array of Java objects. Passing a null value to this method will create a variable size array property of this type containing a null value, which may be used to indicate that a property is not present.

Specified by:
createValueFromArray in interface TypeDefinitionVariableArray
Parameters:
initialData - Array of Java objects to use as the initial data for the variable size array.
Returns:
Property value containing a variable size array created from the given array of Java objects.
Throws:
ClassCastException - It is not possible to cast one or more of the given elements of the Java array to the underlying element type of this type definition.
See Also:
TypeDefinitionVariableArray.createEmptyValue(), TypeDefinitionVariableArray.createValueFromList(List), TypeDefinitionVariableArray.createValueFromValues(PropertyValue[]), TypeDefinitionVariableArray.setArray(PropertyValue, Object[])

createValueFromList

public PropertyValue createValueFromList(List<Object> initialData)
Description copied from interface: TypeDefinitionVariableArray

Creates a property value containing a variable size array from the given list of Java objects. Passing a null value to this method will create a variable size array property of this type containing a null value, which may be used to indicate that a property is not present.

Specified by:
createValueFromList in interface TypeDefinitionVariableArray
Parameters:
initialData - List of Java objects to use as the initial data for the variable size array.
Returns:
Property value containing a variable size array created from the given array of Java objects.
See Also:
TypeDefinitionVariableArray.createValueFromArray(Object[]), TypeDefinitionVariableArray.setArray(PropertyValue, List)

createValueFromValues

public PropertyValue createValueFromValues(PropertyValue[] elementValues)
                                    throws BadTypeException
Description copied from interface: TypeDefinitionVariableArray

Creates a property value containing a variable size array from the given array of property values.

Specified by:
createValueFromValues in interface TypeDefinitionVariableArray
Parameters:
elementValues - Array of property values to use to create a variable size array.
Returns:
Property value containing the newly created variable size array.
Throws:
BadTypeException - One of more of the elements of the given array of property values has a type that is not compatible with this array type.
See Also:
TypeDefinitionVariableArray.createEmptyValue(), TypeDefinitionVariableArray.createValueFromList(List), TypeDefinitionVariableArray.createValueFromArray(Object[])

getCount

public int getCount(PropertyValue arrayProperty)
             throws NullPointerException,
                    IllegalPropertyValueException
Description copied from interface: TypeDefinitionVariableArray

Returns the number of elements in the given array, which is of a type defined by this variable size type definition. This method will return 0 if the array is null or empty.

Specified by:
getCount in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property value containing the array to find the size of.
Returns:
Number of elements in the given array.
Throws:
NullPointerException - The given array property is null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.

getElementValue

public PropertyValue getElementValue(PropertyValue arrayProperty,
                                     int index)
                              throws NullPointerException,
                                     IllegalPropertyValueException,
                                     IndexOutOfBoundsException
Description copied from interface: TypeDefinitionVariableArray

Returns the property value from the given array at the given index.

Specified by:
getElementValue in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property containing an array to return a value from.
index - Index into the given array for the value to return.
Returns:
Property value from the given array at the given index.
Throws:
NullPointerException - The given array property value is null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
IndexOutOfBoundsException - The given index is outside the acceptable range for the current size of the given array.
See Also:
TypeDefinitionVariableArray.getArray(PropertyValue), PropertyValue.getValue()

getElements

public List<PropertyValue> getElements(PropertyValue arrayProperty)
                                throws NullPointerException,
                                       IllegalPropertyValueException
Description copied from interface: TypeDefinitionVariableArray

Returns a copy of the internal list of all the elements in the given array.

Specified by:
getElements in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property containing the array to create an iterator for.
Returns:
List containing the elements of the given variable size array.
Throws:
NullPointerException - The given array property value is null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
See Also:
TypeDefinitionVariableArray.getArray(PropertyValue)

getArray

public Object[] getArray(PropertyValue arrayProperty)
                  throws NullPointerException,
                         IllegalPropertyValueException
Description copied from interface: TypeDefinitionVariableArray

Returns an array of Java objects containing the values of the given array.

Specified by:
getArray in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property containing the array to convert to an array of Java objects.
Returns:
Array of Java objects created from the values of the given array.
Throws:
NullPointerException - The given array property value is null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
See Also:
TypeDefinitionVariableArray.getElements(PropertyValue), TypeDefinitionVariableArray.getElementValue(PropertyValue, int)

getType

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

Returns the type of elements of this variable size array type definition.

Specified by:
getType in interface TypeDefinitionVariableArray
Returns:
Type of elements of this variable size array type definition.

insertElement

public void insertElement(PropertyValue arrayProperty,
                          int index,
                          PropertyValue element)
                   throws NullPointerException,
                          IllegalPropertyValueException,
                          IndexOutOfBoundsException,
                          BadTypeException
Description copied from interface: TypeDefinitionVariableArray

Inserts the value of the given element into the given array property. The index is zero-based and must be less than the value returned by TypeDefinitionVariableArray.getCount(PropertyValue). The property value must be of the same type as returned by TypeDefinitionVariableArray.getType(). Elements at the given index and above will have their indices increased by one to accommodate the new element.

Specified by:
insertElement in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property value corresponding to an array.
index - 0-based index at which to insert the given element into the given array.
element - Element to insert into the given array at the given index.
Throws:
NullPointerException - The given array property value and/or the given element is/are null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
IndexOutOfBoundsException - The given index is outside the acceptable range for the current size of the given array.
BadTypeException - The given element is of the wrong type to be inserted into the array.
See Also:
TypeDefinitionVariableArray.appendElement(PropertyValue, PropertyValue), TypeDefinitionVariableArray.prependElement(PropertyValue, PropertyValue), TypeDefinitionVariableArray.setElementAt(PropertyValue, int, PropertyValue)

prependElement

public void prependElement(PropertyValue arrayProperty,
                           PropertyValue element)
                    throws NullPointerException,
                           IllegalPropertyValueException,
                           BadTypeException
Description copied from interface: TypeDefinitionVariableArray

Prepends a given element to the beginning of the given array.

Specified by:
prependElement in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property value of the array to be extended.
element - Element to add to the beginning of the given array.
Throws:
NullPointerException - The given array property value and/or the given element value is/are null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
BadTypeException - The given element is not of the correct type to be inserted into this array.
See Also:
TypeDefinitionVariableArray.appendElement(PropertyValue, PropertyValue), TypeDefinitionVariableArray.insertElement(PropertyValue, int, PropertyValue)

removeElement

public void removeElement(PropertyValue arrayProperty,
                          int index)
                   throws NullPointerException,
                          IllegalPropertyValueException,
                          IndexOutOfBoundsException
Description copied from interface: TypeDefinitionVariableArray

Removes an element from the given array at the given zero-based index. On successful element removal, the indices elements beyond the given index will reduced by one.

Specified by:
removeElement in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property value of the array to be modified.
index - 0-based index of the element to be removed from the given array.
Throws:
NullPointerException - The given array property value is null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
IndexOutOfBoundsException - The given index is outside the acceptable range for the current size of the given array.

setElementAt

public void setElementAt(PropertyValue arrayProperty,
                         int index,
                         PropertyValue element)
                  throws NullPointerException,
                         IllegalPropertyValueException,
                         IndexOutOfBoundsException,
                         BadTypeException
Description copied from interface: TypeDefinitionVariableArray

Sets an element of the given array at the given index with the given value, replacing the value that is currently stored.

Specified by:
setElementAt in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property value containing the array to be modified.
index - Index into the given array of the element to be replaced by the given value.
element - Value to set at the given index in the given array.
Throws:
NullPointerException - The given array property value and/or the given element is/are null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
IndexOutOfBoundsException - The given index is outside the acceptable range for the current size of the given array.
BadTypeException - The given element type is not compatible with the element type of this array.
See Also:
TypeDefinitionVariableArray.insertElement(PropertyValue, int, PropertyValue)

setArray

public void setArray(PropertyValue arrayProperty,
                     Object[] data)
              throws NullPointerException,
                     IllegalPropertyValueException,
                     ClassCastException
Description copied from interface: TypeDefinitionVariableArray

Sets the elements of a given array from the given array of Java objects. The type definition returned by TypeDefinitionVariableArray.getType() must be able to transform each of the objects in the given Java array into the appropriate type, otherwise a IllegalPropertyValueException will be thrown.

Specified by:
setArray in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property containing the array to have its data set.
data - List of Java objects to set as the elements of the given array.
Throws:
NullPointerException - The given array property argument is null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
ClassCastException - It is not possible to cast one or more of the given Java objects to a type compatible with this type definition.
See Also:
TypeDefinition.createValue(Object), TypeDefinitionVariableArray.setArray(PropertyValue, List)

setArray

public void setArray(PropertyValue arrayProperty,
                     List<Object> data)
              throws NullPointerException,
                     IllegalPropertyValueException,
                     ClassCastException
Description copied from interface: TypeDefinitionVariableArray

Sets the elements of a given array from the given list of Java objects. The type definition returned by TypeDefinitionVariableArray.getType() must be able to transform each of the objects in the given Java array into the appropriate type, otherwise a IllegalPropertyValueException will be thrown.

Specified by:
setArray in interface TypeDefinitionVariableArray
Parameters:
arrayProperty - Property containing the array to have its data set.
data - Array of Java objects to set as the elements of the given array.
Throws:
NullPointerException - The given array property value is null.
IllegalPropertyValueException - The given property value type does not match this variable size array property definition.
ClassCastException - It is not possible to cast one or more of the given Java objects to a type compatible with this type definition.
See Also:
TypeDefinition.createValue(Object), TypeDefinitionVariableArray.setArray(PropertyValue, Object[])

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.