|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tv.amwa.maj.meta.MetaDefinition tv.amwa.maj.meta.TypeDefinition tv.amwa.maj.meta.TypeDefinitionVariableArray
@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
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.
Nested Class Summary | |
---|---|
static class |
TypeDefinitionVariableArray.VariableArrayValue
|
static class |
TypeDefinitionVariableArray.XMLHandler
|
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 |
---|
public static final TypeDefinitionVariableArray UInt8Array
public static final TypeDefinitionVariableArray UInt32Array
public static final TypeDefinitionVariableArray Int32Array
public static final TypeDefinitionVariableArray Int64Array
public static final TypeDefinitionVariableArray StringArray
public static final TypeDefinitionVariableArray AUIDArray
public static final TypeDefinitionVariableArray ComponentStrongReference
public static final TypeDefinitionVariableArray ControlPointStrongReference
public static final TypeDefinitionVariableArray IdentificationStrongReference
public static final TypeDefinitionVariableArray LocatorStrongReference
public static final TypeDefinitionVariableArray MobSlotStrongReference
public static final TypeDefinitionVariableArray SegmentStrongReference
public static final TypeDefinitionVariableArray SourceReferenceStrongReference
public static final TypeDefinitionVariableArray TaggedValueStrongReference
public static final TypeDefinitionVariableArray KLVDataStrongReference
public static final TypeDefinitionVariableArray ParameterStrongReference
public static final TypeDefinitionVariableArray OperationDefinitionWeakReference
public static final TypeDefinitionVariableArray TypeDefinitionWeakReference
public static final TypeDefinitionVariableArray DataDefinitionWeakReference
public static final TypeDefinitionVariableArray SubDescriptorStrongReference
public static final TypeDefinitionVariableArray FileDescriptorStrongReference
public static final TypeDefinitionVariableArray ChannelStatusModeArray
public static final TypeDefinitionVariableArray UserDataModeArray
public static final TypeDefinitionVariableArray RIFFChunkStrongReference
public static final TypeDefinitionVariableArray DescriptiveObjectStrongReference
Constructor Detail |
---|
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:
TypeDefinitionInteger
TypeDefinitionRecord
TypeDefinitionEnumeration
TypeDefinitionExtendibleEnumeration
TypeDefinitionFixedArray
TypeDefinitionObjectReference
TypeDefinitionString
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.
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.Method Detail |
---|
public final void setPropertiesFromInterface(TypeDefinitionVariableArray castFrom)
MetaDefinition.setPropertiesFromInterface(tv.amwa.maj.iface.MetaDefinition)
public void appendElement(PropertyValue arrayProperty, PropertyValue element) throws NullPointerException, IllegalPropertyValueException, BadTypeException
TypeDefinitionVariableArray
Append 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 TypeDefinitionVariableArray
arrayProperty
- 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()
TypeDefinitionVariableArray
Creates a property value containing an empty variable size array, which is an array with no elements in it yet.
createEmptyValue
in interface TypeDefinitionVariableArray
TypeDefinitionVariableArray.createValueFromArray(Object[])
,
TypeDefinitionVariableArray.createValueFromList(List)
,
TypeDefinitionVariableArray.createValueFromValues(PropertyValue[])
public PropertyValue createValueFromArray(Object[] initialData) throws ClassCastException
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.
createValueFromArray
in interface TypeDefinitionVariableArray
initialData
- 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)
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.
createValueFromList
in interface TypeDefinitionVariableArray
initialData
- 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
TypeDefinitionVariableArray
Creates a property value containing a variable size array from the given array of property values.
createValueFromValues
in interface TypeDefinitionVariableArray
elementValues
- 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
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.
getCount
in interface TypeDefinitionVariableArray
arrayProperty
- 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
TypeDefinitionVariableArray
Returns the property value from the given array at the given index.
getElementValue
in interface TypeDefinitionVariableArray
arrayProperty
- 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.TypeDefinitionVariableArray.getArray(PropertyValue)
,
PropertyValue.getValue()
public List<PropertyValue> getElements(PropertyValue arrayProperty) throws NullPointerException, IllegalPropertyValueException
TypeDefinitionVariableArray
Returns a copy of the internal list of all the elements in the given array.
getElements
in interface TypeDefinitionVariableArray
arrayProperty
- 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
TypeDefinitionVariableArray
Returns an array of Java objects containing the values of the given array.
getArray
in interface TypeDefinitionVariableArray
arrayProperty
- 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)
@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()
TypeDefinitionVariableArray
Returns the type of elements of this variable size array type definition.
getType
in interface TypeDefinitionVariableArray
public void insertElement(PropertyValue arrayProperty, int index, PropertyValue element) throws NullPointerException, IllegalPropertyValueException, IndexOutOfBoundsException, BadTypeException
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.
insertElement
in interface TypeDefinitionVariableArray
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.
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
TypeDefinitionVariableArray
Prepends a given element to the beginning of the given array.
prependElement
in interface TypeDefinitionVariableArray
arrayProperty
- 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
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.
removeElement
in interface TypeDefinitionVariableArray
arrayProperty
- 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
TypeDefinitionVariableArray
Sets an element of the given array at the given index with the given value, replacing the value that is currently stored.
setElementAt
in interface TypeDefinitionVariableArray
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.
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
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.
setArray
in interface TypeDefinitionVariableArray
arrayProperty
- 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
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.
setArray
in interface TypeDefinitionVariableArray
arrayProperty
- 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
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.
createValue
in interface TypeDefinition
createValue
in class TypeDefinition
javaValue
- 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()
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
.
getTypeCategory
in interface TypeDefinition
getTypeCategory
in class TypeDefinition
TypeCategory
public final boolean deepEquals(Object o)
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.
deepEquals
in class MetaDefinition
o
- Object to compare to this definition.
public void appendXMLChildren(Node parent)
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.
appendXMLChildren
in interface XMLSerializable
appendXMLChildren
in class MetaDefinition
parent
- XML parent element to append child nodes to.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |