@MediaClass(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.", symbol="TypeDefinitionVariableArray") public final class TypeDefinitionVariableArrayImpl extends TypeDefinitionImpl implements TypeDefinitionVariableArray, Serializable, XMLSerializable, Cloneable
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
TypeDefinitionVariableArrayImpl.VariableArrayMethodBag |
static class |
TypeDefinitionVariableArrayImpl.VariableArrayValue |
TypeDefinitionImpl.PropertyValueImplAAF_METADICT_NAMESPACE, AAF_METADICT_PREFIX, AAF_XML_NAMESPACE, AAF_XML_PREFIX, ApplicationPluginObjectID, ApplicationPluginsID, MAX_NUM_RGBA_COMPS, MemberOfID, ObjectClassID, ParentClassID, PropertiesID, XMLClassIDAsAttributeName| Constructor and Description |
|---|
TypeDefinitionVariableArrayImpl(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.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
appendMetadictXML(Node metadict,
String namespace,
String prefix)
Append an XML representation of this meta definition to the given XML node.
|
TypeDefinitionVariableArray |
clone()
Create a cloned copy of this meta definition.
|
PropertyValue |
createEmptyValue()
Creates a property value containing an empty variable size
array, which is an array with no elements in it yet.
|
PropertyValue |
createFromBytes(ByteBuffer buffer)
Create a value of this type by reading the bytes in the given byte buffer.
|
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.
|
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.
|
static TypeDefinition |
initializeVariableArrayElementType() |
void |
insertElement(PropertyValue arrayProperty,
int index,
PropertyValue element)
Inserts the value of the given element into the given array property.
|
long |
lengthAsBytes(PropertyValue value)
Returns the number of bytes that the given value of this type is serialized as a
sequence of bytes.
|
String |
nameToAAFName(String name) |
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.
|
boolean |
resolveReferences(PropertyValue value,
Map<AUID,MetadataObject> referenceMap)
Resolve any unresolved object references using the given reference map.
|
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 |
setElementType(TypeDefinition elementType)
Set the underlying element type for this variable size array type definition.
|
void |
setPropertyValue(MetadataObject metadataObject,
PropertyDefinition property,
PropertyValue value)
On the given metadata object, set the specified property to the given value.
|
List<PropertyValue> |
writeAsBytes(PropertyValue value,
ByteBuffer buffer)
Write the given property value of this type to the given byte stream.
|
getNamespace, getPrefix, getPropertyValue, initalizeTypeNameMap, writeAsStructuredStorageBytesaafNameToName, appendXMLChildren, deepEquals, equals, getAAFNamesInUse, getAliases, getAUID, getComment, getDescription, getIdentification, getName, getSymbol, getWeakTargetReference, hashCode, initializeMetaDefinitionIdentification, initializeMetaDefinitionName, setAAFNamesInUse, setAliases, setDescription, setIdentification, setName, setNamespace, setPrefix, setSymbol, toStringgetPropertyValue, writeAsStructuredStorageBytesdeepEquals, equals, getAAFNamesInUse, getAliases, getAUID, getDescription, getName, getNamespace, getPrefix, getSymbol, hashCode, setAAFNamesInUse, setDescription, setName, setNamespace, setPrefix, setSymbol, toStringgetWeakTargetReferenceappendXMLChildren, getCommentpublic TypeDefinitionVariableArrayImpl(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:
TypeDefinitionIntegerTypeDefinitionRecordTypeDefinitionEnumerationTypeDefinitionExtendibleEnumerationTypeDefinitionFixedArrayTypeDefinitionObjectReferenceTypeDefinitionStringCreating 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
tv.amwa.maj.industry.Warehouse#lookForTypeString) or
Warehouse.lookForType(tv.amwa.maj.record.AUID)
respectively.
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.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.public void appendElement(PropertyValue arrayProperty, PropertyValue element) throws NullPointerException, IllegalPropertyValueException, BadTypeException
TypeDefinitionVariableArrayAppend the given element to the end of the given array, which is of a type defined by this variable array type definition.
appendElement in interface TypeDefinitionVariableArrayarrayProperty - Array to extend with the given element.element - Element to use to extend the given array.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.TypeDefinitionVariableArray.prependElement(PropertyValue, PropertyValue),
TypeDefinitionVariableArray.insertElement(PropertyValue, int, PropertyValue)public PropertyValue createEmptyValue()
TypeDefinitionVariableArrayCreates a property value containing an empty variable size array, which is an array with no elements in it yet.
createEmptyValue in interface TypeDefinitionVariableArrayTypeDefinitionVariableArray.createValueFromArray(Object[]),
TypeDefinitionVariableArray.createValueFromList(List),
TypeDefinitionVariableArray.createValueFromValues(PropertyValue[])public PropertyValue createValueFromArray(Object[] initialData) throws ClassCastException
TypeDefinitionVariableArrayCreate 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.
createValueFromArray in interface TypeDefinitionVariableArrayinitialData - Array of Java objects to use as the initial data for
the variable size array.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.TypeDefinitionVariableArray.createEmptyValue(),
TypeDefinitionVariableArray.createValueFromList(List),
TypeDefinitionVariableArray.createValueFromValues(PropertyValue[]),
TypeDefinitionVariableArray.setArray(PropertyValue, Object[])public PropertyValue createValueFromList(List<Object> initialData)
TypeDefinitionVariableArrayCreates 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.
createValueFromList in interface TypeDefinitionVariableArrayinitialData - List of Java objects to use as the initial data for
the variable size array.TypeDefinitionVariableArray.createValueFromArray(Object[]),
TypeDefinitionVariableArray.setArray(PropertyValue, List)public PropertyValue createValueFromValues(PropertyValue[] elementValues) throws BadTypeException
TypeDefinitionVariableArrayCreates a property value containing a variable size array from the given array of property values.
createValueFromValues in interface TypeDefinitionVariableArrayelementValues - Array of property values to use to create a
variable size array.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.TypeDefinitionVariableArray.createEmptyValue(),
TypeDefinitionVariableArray.createValueFromList(List),
TypeDefinitionVariableArray.createValueFromArray(Object[])public int getCount(PropertyValue arrayProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionVariableArrayReturns 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.
getCount in interface TypeDefinitionVariableArrayarrayProperty - Property value containing the array to find the
size of.NullPointerException - The given array property is null.IllegalPropertyValueException - The given property value type does not match
this variable size array property definition.public PropertyValue getElementValue(PropertyValue arrayProperty, int index) throws NullPointerException, IllegalPropertyValueException, IndexOutOfBoundsException, ClassCastException
TypeDefinitionVariableArrayReturns the property value from the given array at the given index.
getElementValue in interface TypeDefinitionVariableArrayarrayProperty - Property containing an array to return a value
from.index - Index into the given array for the value to return.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.ClassCastExceptionTypeDefinitionVariableArray.getArray(PropertyValue),
PropertyValue.getValue()public List<PropertyValue> getElements(PropertyValue arrayProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionVariableArrayReturns a copy of the internal list of all the elements in the given array.
getElements in interface TypeDefinitionVariableArrayarrayProperty - Property containing the array to create an iterator
for.NullPointerException - The given array property value is null.IllegalPropertyValueException - The given property value type does not match
this variable size array property definition.TypeDefinitionVariableArray.getArray(PropertyValue)public Object[] getArray(PropertyValue arrayProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionVariableArrayReturns an array of Java objects containing the values of the given array.
getArray in interface TypeDefinitionVariableArrayarrayProperty - Property containing the array to convert to
an array of Java objects.NullPointerException - The given array property value is null.IllegalPropertyValueException - The given property value type does not match
this variable size array property definition.TypeDefinitionVariableArray.getElements(PropertyValue),
TypeDefinitionVariableArray.getElementValue(PropertyValue, int)@MediaProperty(uuid1=100729095, uuid2=3328, uuid3=0, uuid4={6,14,43,52,1,1,1,2}, definedName="VariableArrayElementType", aliases="ElementType", typeName="TypeDefinitionWeakReference", optional=false, uniqueIdentifier=false, pid=25, symbol="VariableArrayElementType") public TypeDefinition getType()
TypeDefinitionVariableArrayReturns the type of elements of this variable size array type definition.
getType in interface TypeDefinitionVariableArray@MediaPropertySetter(value="VariableArrayElementType") public void setElementType(TypeDefinition elementType) throws NullPointerException, IllegalArgumentException
Set the underlying element type for this variable size array type definition. All elements of a value of this type must be of the given element type.
elementType - Underlying element type for this variable size array type definition.NullPointerException - Argument is null.IllegalArgumentException - Cannot set the element type of this variable size array type definition to the given
element type.public static final TypeDefinition initializeVariableArrayElementType()
public void insertElement(PropertyValue arrayProperty, int index, PropertyValue element) throws NullPointerException, IllegalPropertyValueException, IndexOutOfBoundsException, BadTypeException
TypeDefinitionVariableArrayInserts 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.
insertElement in interface TypeDefinitionVariableArrayarrayProperty - 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.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.TypeDefinitionVariableArray.appendElement(PropertyValue, PropertyValue),
TypeDefinitionVariableArray.prependElement(PropertyValue, PropertyValue),
TypeDefinitionVariableArray.setElementAt(PropertyValue, int, PropertyValue)public void prependElement(PropertyValue arrayProperty, PropertyValue element) throws NullPointerException, IllegalPropertyValueException, BadTypeException
TypeDefinitionVariableArrayPrepends a given element to the beginning of the given array.
prependElement in interface TypeDefinitionVariableArrayarrayProperty - Property value of the array to be extended.element - Element to add to the beginning of the given array.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.TypeDefinitionVariableArray.appendElement(PropertyValue, PropertyValue),
TypeDefinitionVariableArray.insertElement(PropertyValue, int, PropertyValue)public void removeElement(PropertyValue arrayProperty, int index) throws NullPointerException, IllegalPropertyValueException, IndexOutOfBoundsException
TypeDefinitionVariableArrayRemoves 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.
removeElement in interface TypeDefinitionVariableArrayarrayProperty - Property value of the array to be modified.index - 0-based index of the element to be removed from the given array.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.public void setElementAt(PropertyValue arrayProperty, int index, PropertyValue element) throws NullPointerException, IllegalPropertyValueException, IndexOutOfBoundsException, BadTypeException
TypeDefinitionVariableArraySets an element of the given array at the given index with the given value, replacing the value that is currently stored.
setElementAt in interface TypeDefinitionVariableArrayarrayProperty - 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.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.TypeDefinitionVariableArray.insertElement(PropertyValue, int, PropertyValue)public void setArray(PropertyValue arrayProperty, Object[] data) throws NullPointerException, IllegalPropertyValueException, ClassCastException
TypeDefinitionVariableArraySets 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.
setArray in interface TypeDefinitionVariableArrayarrayProperty - Property containing the array to have its
data set.data - List of Java objects to set as the elements of the
given array.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.TypeDefinition.createValue(Object),
TypeDefinitionVariableArray.setArray(PropertyValue, List)public void setArray(PropertyValue arrayProperty, List<Object> data) throws NullPointerException, IllegalPropertyValueException, ClassCastException
TypeDefinitionVariableArraySets 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.
setArray in interface TypeDefinitionVariableArrayarrayProperty - Property containing the array to have its
data set.data - Array of Java objects to set as the elements of the
given array.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.TypeDefinition.createValue(Object),
TypeDefinitionVariableArray.setArray(PropertyValue, Object[])public PropertyValue createValue(Object javaValue) throws ClassCastException
TypeDefinitionImplCreate 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.
createValue in interface TypeDefinitioncreateValue in class TypeDefinitionImpljavaValue - Java object to use to create a property value of this type.ClassCastException - The given object cannot be cast to a property value with
this type definition.public TypeCategory getTypeCategory()
TypeDefinitionReturns the type category to which this type definition belongs, which
corresponds to its sub interface. For example, TypeCategory.Int
is returned for a TypeDefinitionInteger.
getTypeCategory in interface TypeDefinitiongetTypeCategory in class TypeDefinitionImplTypeCategorypublic void setPropertyValue(MetadataObject metadataObject, PropertyDefinition property, PropertyValue value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
TypeDefinitionOn the given metadata object, set the specified property to the given value. The property must be of this type.
setPropertyValue in interface TypeDefinitionsetPropertyValue in class TypeDefinitionImplmetadataObject - Object to set the value on.property - Property of the object to set.value - Value of this type to set the property value to.IllegalArgumentException - The given property value is not of this type.IllegalAccessException - Insufficient privileges to set properties on the given
metadata object.InvocationTargetException - Problem encountered while calling the set method
associated with the property for the given object.TypeDefinition.getPropertyValue(MetadataObject, PropertyDefinition)public PropertyValue createFromBytes(ByteBuffer buffer) throws EndOfDataException
TypeDefinitionCreate a value of this type by reading the bytes in the given byte buffer. The buffer is assumed to have exactly the number of bytes that represent the value. For example, the length of a string value will be determined by the length (remaining bytes) in the buffer and not by reading a length value from the buffer.
This method is able to read values written by the
TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer) method.
createFromBytes in interface TypeDefinitioncreateFromBytes in class TypeDefinitionImplbuffer - Buffer to create a value from.EndOfDataException - Insufficient bytes remaining in the given buffer to create
a value of this type.TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer),
TypeDefinition.lengthAsBytes(PropertyValue)public long lengthAsBytes(PropertyValue value) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionReturns the number of bytes that the given value of this type is serialized as a sequence of bytes.
The number returned by this method is the same as the number of bytes written
to a byte buffer by the TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer) method.
lengthAsBytes in interface TypeDefinitionlengthAsBytes in class TypeDefinitionImplvalue - Value to find the length of when serialized to bytes.NullPointerException - Cannot compute the serialized length of a null value.IllegalPropertyValueException - The given property value is not of this type.TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer),
TypeDefinition.createFromBytes(ByteBuffer)public List<PropertyValue> writeAsBytes(PropertyValue value, ByteBuffer buffer) throws NullPointerException, IllegalPropertyValueException, InsufficientSpaceException
TypeDefinitionWrite the given property value of this type to the given byte stream. This version is most appropriate for writing KLV streams (MXF files).
The format used to serialize the value with be compatible with the
TypeDefinition.createFromBytes(ByteBuffer) method. The number of bytes written to
the byte buffer will be the same as returned by TypeDefinition.lengthAsBytes(PropertyValue).
writeAsBytes in interface TypeDefinitionwriteAsBytes in class TypeDefinitionImplvalue - Value to write to the given buffer.buffer - Buffer to write the value to.NullPointerException - Cannot write from a null property value and/or
to a null value.IllegalPropertyValueException - The given property value is not of this type.InsufficientSpaceException - Insufficient space to write the given value into the
given buffer.TypeDefinition.writeAsStructuredStorageBytes(PropertyValue, ByteBuffer),
TypeDefinition.createFromBytes(ByteBuffer),
TypeDefinition.lengthAsBytes(PropertyValue)public boolean resolveReferences(PropertyValue value, Map<AUID,MetadataObject> referenceMap) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionResolve any unresolved object references using the given reference map. Unresolved object references occur when a value has been read from a file but not linked to its strong or weak values. This method only effects types that are references or contain references in collections, which are:
TypeDefinitionWeakObjectReference;TypeDefinitionStrongObjectReference;TypeDefinitionVariableArray with elements of one of the object reference types;TypeDefinitionSet with elements of one of the object reference types.resolveReferences in interface TypeDefinitionresolveReferences in class TypeDefinitionImplvalue - Value to resolve references for.referenceMap - Map of local identifications to values to be used for resolution.NullPointerException - The value or reference map is/are null.IllegalPropertyValueException - The given property value is not of this type.public String nameToAAFName(String name)
nameToAAFName in class TypeDefinitionImplpublic void appendMetadictXML(Node metadict, String namespace, String prefix)
MetaDefinitionAppend an XML representation of this meta definition to the given XML node.
appendMetadictXML in interface MetaDefinitionappendMetadictXML in class MetaDefinitionImplmetadict - Meta dictionary node to append a description of this node to.CommonConstants.AAF_METADICT_NAMESPACEpublic TypeDefinitionVariableArray clone()
MetaDefinitionCreate a cloned copy of this meta definition.
clone in interface MetaDefinitionclone in interface TypeDefinitionclone in interface TypeDefinitionVariableArrayclone in class TypeDefinitionImpl(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.