Media Authoring
with Java API

tv.amwa.maj.meta
Class TypeDefinitionIndirect

java.lang.Object
  extended by tv.amwa.maj.meta.MetaDefinition
      extended by tv.amwa.maj.meta.TypeDefinition
          extended by tv.amwa.maj.meta.TypeDefinitionIndirect
All Implemented Interfaces:
Serializable, DefinitionType, MetaDefinition, TypeDefinition, TypeDefinitionIndirect, XMLSerializable, MAJCommon
Direct Known Subclasses:
TypeDefinitionOpaque

@AAFClass(uuid1=218169601,
          uuid2=545,
          uuid3=0,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="TypeDefinitionIndirect",
          description="The TypeDefinitionIndirect class defines a property type that has a value whose type is specified in each instance.")
public class TypeDefinitionIndirect
extends TypeDefinition
implements TypeDefinitionIndirect, Serializable, XMLSerializable

TODO comments

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class TypeDefinitionIndirect.IndirectValue
           
static class TypeDefinitionIndirect.XMLHandler
           
 
Field Summary
static TypeDefinitionIndirect Indirect
           
 
Constructor Summary
TypeDefinitionIndirect(AUID identification, String typeName)
          Creates and initializes a new indirect type definition, which defines a property type that has a value whose type is specified in each instance.
 
Method Summary
 void appendXMLChildren(Node parent)
          
 PropertyValue createValue(Object javaValue)
          Create a property value from the given Java object.
 PropertyValue createValueFromActualData(TypeDefinition actualType, byte[] initData)
          Creates and returns an indirect property value from the given type definition and serialized data.
 PropertyValue createValueFromActualValue(PropertyValue indirectProperty)
          Creates and returns an indirect property value that contains the given actual property value.
 byte[] getActualData(PropertyValue indirectProperty)
          Returns a copy of the actual data contained in the indirect property value.
 int getActualSize(PropertyValue indirectProperty)
          Returns the size of the data held by the actual property value embedded within the given indirect property value.
 TypeDefinition getActualType(PropertyValue indirectProperty)
          Returns the type definition of the property value embedded within the given property value.
 PropertyValue getActualValue(PropertyValue indirectProperty)
          Returns the actual property value embedded within the given indirect property value.
 TypeCategory getTypeCategory()
          Returns the type category to which this type definition belongs, which corresponds to its sub interface.
 void setPropertiesFromInterface(TypeDefinitionIndirect castFrom)
           
 
Methods inherited from class tv.amwa.maj.meta.TypeDefinition
setPropertiesFromInterface
 
Methods inherited from class tv.amwa.maj.meta.MetaDefinition
castFromInterface, deepEquals, 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

Indirect

public static final TypeDefinitionIndirect Indirect
Constructor Detail

TypeDefinitionIndirect

public TypeDefinitionIndirect(AUID identification,
                              @AAFString
                              String typeName)
                       throws NullPointerException

Creates and initializes a new indirect type definition, which defines a property type that has a value whose type is specified in each instance.

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 new indirect type definition.
Throws:
NullPointerException - The identification argument is null.
Method Detail

setPropertiesFromInterface

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

createValueFromActualData

public PropertyValue createValueFromActualData(TypeDefinition actualType,
                                               byte[] initData)
                                        throws NullPointerException,
                                               BadParameterException,
                                               ClassCastException
Description copied from interface: TypeDefinitionIndirect

Creates and returns an indirect property value from the given type definition and serialized data.

Specified by:
createValueFromActualData in interface TypeDefinitionIndirect
Parameters:
actualType - Type of the actual data to embed within the new indirect property value.
initData - Data to use to create the new indirect property value of the given type.
Returns:
New indirect property value created from the given type and data.
Throws:
NullPointerException - One or more of the arguments is null.
BadParameterException - An error occurred when reading the given byte array.
ClassCastException - The type of the data does not match the given type definition.
See Also:
TypeDefinitionIndirect.createValueFromActualData(tv.amwa.maj.iface.TypeDefinition, byte[])

createValueFromActualValue

public PropertyValue createValueFromActualValue(PropertyValue indirectProperty)
                                         throws NullPointerException,
                                                NotSerializableException
Description copied from interface: TypeDefinitionIndirect

Creates and returns an indirect property value that contains the given actual property value.

Specified by:
createValueFromActualValue in interface TypeDefinitionIndirect
Parameters:
indirectProperty - Actual value to embed into the new indirect property value.
Returns:
Newly created indirect property value embedding the given actual property value.
Throws:
NullPointerException - The given original property value is null.
NotSerializableException - For creating opaque type values, the given property value cannot be serialized to a stream of opaque bytes.
See Also:
TypeDefinitionIndirect.createValueFromActualValue(tv.amwa.maj.iface.PropertyValue)

getActualData

public byte[] getActualData(PropertyValue indirectProperty)
                     throws NullPointerException,
                            IllegalPropertyValueException,
                            IOException
Description copied from interface: TypeDefinitionIndirect

Returns a copy of the actual data contained in the indirect property value.

Specified by:
getActualData in interface TypeDefinitionIndirect
Parameters:
indirectProperty - Property value containing an actual value.
Returns:
Serialized contents of the actual property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
IOException - An error occurred white trying to write the property's value to a byte array.
See Also:
TypeDefinitionIndirect.getActualData(tv.amwa.maj.iface.PropertyValue)

getActualSize

public int getActualSize(PropertyValue indirectProperty)
                  throws NullPointerException,
                         IllegalPropertyValueException,
                         IOException
Description copied from interface: TypeDefinitionIndirect

Returns the size of the data held by the actual property value embedded within the given indirect property value.

Specified by:
getActualSize in interface TypeDefinitionIndirect
Parameters:
indirectProperty - Property value containing an actual value.
Returns:
Size of the data represented by the actual property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
IOException - An error occurred white trying to write the property's value to a byte array.
See Also:
TypeDefinitionIndirect.getActualSize(tv.amwa.maj.iface.PropertyValue)

getActualType

public TypeDefinition getActualType(PropertyValue indirectProperty)
                             throws NullPointerException,
                                    IllegalPropertyValueException
Description copied from interface: TypeDefinitionIndirect

Returns the type definition of the property value embedded within the given property value. This is effectively TypeDefinitionIndirect.getActualValue(PropertyValue) followed by PropertyValue.getType().

Specified by:
getActualType in interface TypeDefinitionIndirect
Parameters:
indirectProperty - Property value containing an actual property value to determine the type of.
Returns:
Type definition of the actual property value in the given indirect property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
See Also:
TypeDefinitionIndirect.getActualType(tv.amwa.maj.iface.PropertyValue)

getActualValue

public PropertyValue getActualValue(PropertyValue indirectProperty)
                             throws NullPointerException,
                                    IllegalPropertyValueException
Description copied from interface: TypeDefinitionIndirect

Returns the actual property value embedded within the given indirect property value.

Specified by:
getActualValue in interface TypeDefinitionIndirect
Parameters:
indirectProperty - Property value containing the embedded actual value to return.
Returns:
Actual value from within the given indirect property value.
Throws:
NullPointerException - The given indirect property value is null.
IllegalPropertyValueException - The given property value is not defined by an indirect type definition.
See Also:
TypeDefinitionIndirect.getActualValue(tv.amwa.maj.iface.PropertyValue)

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.
See Also:
TypeDefinition.createValue(java.lang.Object)

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:
TypeDefinition.getTypeCategory()

appendXMLChildren

public void appendXMLChildren(Node parent)

Specified by:
appendXMLChildren in interface XMLSerializable
Overrides:
appendXMLChildren in class MetaDefinition
Parameters:
parent -

Media Authoring
with Java API

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