Media Authoring
with Java API

tv.amwa.maj.meta
Class TypeDefinitionSet

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

@AAFClass(uuid1=218169601,
          uuid2=522,
          uuid3=0,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="TypeDefinitionSet",
          description="The TypeDefinitionSet class defines a property type that has a collection of object references to uniquely identified objects. The order of the objects has no meaning.")
public final class TypeDefinitionSet
extends TypeDefinition
implements TypeDefinitionSet, Serializable, XMLSerializable, MAJCommon

Implements the definition of a property type that has a collection of object references to uniquely identified objects. The order of the objects has no meaning.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class TypeDefinitionSet.SetValue
           
static class TypeDefinitionSet.XMLHandler
           
 
Field Summary
static TypeDefinitionVariableArray AUIDSet
           
static TypeDefinitionSet ClassDefinitionStrongReference
           
static TypeDefinitionSet CodecDefinitionStrongReference
           
static TypeDefinitionSet ContainerDefinitionStrongReference
           
static TypeDefinitionSet DataDefinitionStrongReference
           
static TypeDefinitionSet DataDefinitionWeakReference
           
static TypeDefinitionSet DescriptiveObjectStrongReference
           
static TypeDefinitionSet EssenceDataStrongReference
           
static TypeDefinitionSet InterpolationDefinitionStrongReference
           
static TypeDefinitionSet KLVDataDefinitionStrongReference
           
static TypeDefinitionSet MobStrongReference
           
static TypeDefinitionSet OperationDefinitionStrongReference
           
static TypeDefinitionSet ParameterDefinitionStrongReference
           
static TypeDefinitionSet ParameterDefinitionWeakReference
           
static TypeDefinitionSet PluginDefinitionStrongReference
           
static TypeDefinitionSet PluginDefinitionWeakReference
           
static TypeDefinitionSet PropertyDefinitionStrongReference
           
static TypeDefinitionSet PropertyDefinitionWeakReference
           
static TypeDefinitionSet TaggedValueDefinitionStrongReference
           
static TypeDefinitionSet TypeDefinitionStrongReference
           
static TypeDefinitionVariableArray UInt32Set
           
 
Constructor Summary
TypeDefinitionSet(AUID identification, String typeName, TypeDefinitionObjectReference elementType)
          Creates and initializes the set type definition, which defines a property type that has a collection of object references to uniquely identified objects.
 
Method Summary
 void addElement(PropertyValue setPropertyValue, PropertyValue elementPropertyValue)
          Adds the given element to the given set, which is represented by the given property value of this set 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.
 boolean containsElement(PropertyValue setPropertyValue, PropertyValue elementPropertyValue)
          Returns true if the given element is contained in the given set; otherwise false.
 PropertyValue createEmptySet()
          Create a property value with an empty set, ready to hold property values of this type definitions element type.
 PropertyValue createValue(Object javaValue)
          Create a property value from the given Java object.
 boolean deepEquals(Object o)
          Check to see if this definition is equal to the given object by comparing each property.
 int getCount(PropertyValue setPropertyValue)
          Returns the number of elements in the given set, or -1 if the set is null.
 Set<PropertyValue> getElements(PropertyValue setPropertyValue)
          Returns a copy of the set of all the elements in the given set property value.
 TypeDefinitionObjectReference getElementType()
          Returns the type of elements referenced from the defined set.
 TypeCategory getTypeCategory()
          Returns the type category to which this type definition belongs, which corresponds to its sub interface.
 void removeElement(PropertyValue setPropertyValue, PropertyValue elementPropertyValue)
          Removes the given element from the given set, which is represented by the given property value of this set type definition.
 void setPropertiesFromInterface(TypeDefinitionSet 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

AUIDSet

public static final TypeDefinitionVariableArray AUIDSet

UInt32Set

public static final TypeDefinitionVariableArray UInt32Set

ClassDefinitionStrongReference

public static final TypeDefinitionSet ClassDefinitionStrongReference

CodecDefinitionStrongReference

public static final TypeDefinitionSet CodecDefinitionStrongReference

ContainerDefinitionStrongReference

public static final TypeDefinitionSet ContainerDefinitionStrongReference

DataDefinitionStrongReference

public static final TypeDefinitionSet DataDefinitionStrongReference

EssenceDataStrongReference

public static final TypeDefinitionSet EssenceDataStrongReference

InterpolationDefinitionStrongReference

public static final TypeDefinitionSet InterpolationDefinitionStrongReference

MobStrongReference

public static final TypeDefinitionSet MobStrongReference

OperationDefinitionStrongReference

public static final TypeDefinitionSet OperationDefinitionStrongReference

ParameterDefinitionStrongReference

public static final TypeDefinitionSet ParameterDefinitionStrongReference

PluginDefinitionStrongReference

public static final TypeDefinitionSet PluginDefinitionStrongReference

PropertyDefinitionStrongReference

public static final TypeDefinitionSet PropertyDefinitionStrongReference

TypeDefinitionStrongReference

public static final TypeDefinitionSet TypeDefinitionStrongReference

KLVDataDefinitionStrongReference

public static final TypeDefinitionSet KLVDataDefinitionStrongReference

TaggedValueDefinitionStrongReference

public static final TypeDefinitionSet TaggedValueDefinitionStrongReference

DataDefinitionWeakReference

public static final TypeDefinitionSet DataDefinitionWeakReference

ParameterDefinitionWeakReference

public static final TypeDefinitionSet ParameterDefinitionWeakReference

PluginDefinitionWeakReference

public static final TypeDefinitionSet PluginDefinitionWeakReference

PropertyDefinitionWeakReference

public static final TypeDefinitionSet PropertyDefinitionWeakReference

DescriptiveObjectStrongReference

public static final TypeDefinitionSet DescriptiveObjectStrongReference
Constructor Detail

TypeDefinitionSet

public TypeDefinitionSet(AUID identification,
                         @AAFString
                         String typeName,
                         TypeDefinitionObjectReference elementType)
                  throws NullPointerException

Creates and initializes the set type definition, which defines a property type that has a collection of object references to uniquely identified objects. The order of the objects has no meaning.

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 of set.
typeName - Friendly name for this type definition.
elementType - Type definition of each element contained in this set.
Throws:
NullPointerException - The identification and/or element type arguments is/are null.
Method Detail

setPropertiesFromInterface

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

addElement

public void addElement(PropertyValue setPropertyValue,
                       PropertyValue elementPropertyValue)
                throws NullPointerException,
                       IllegalPropertyValueException
Description copied from interface: TypeDefinitionSet

Adds the given element to the given set, which is represented by the given property value of this set type definition.

Specified by:
addElement in interface TypeDefinitionSet
Parameters:
setPropertyValue - Set to add the given element to.
elementPropertyValue - Element to add to the given set.
Throws:
NullPointerException - One or both of the arguments is/are null.
IllegalPropertyValueException - The type of the given property value does not match this set type definition.

containsElement

public boolean containsElement(PropertyValue setPropertyValue,
                               PropertyValue elementPropertyValue)
                        throws NullPointerException,
                               IllegalPropertyValueException
Description copied from interface: TypeDefinitionSet

Returns true if the given element is contained in the given set; otherwise false. The set to test membership for is represented by the given property value of this set type definition.

Specified by:
containsElement in interface TypeDefinitionSet
Parameters:
setPropertyValue - Set to check for the given element.
elementPropertyValue - Element to check for in the given set.
Returns:
Is the given element contained in the given set?
Throws:
NullPointerException - One or both of the arguments is/are null.
IllegalPropertyValueException - The type of the given property value does not match this set type definition.

getCount

public int getCount(PropertyValue setPropertyValue)
             throws NullPointerException,
                    IllegalPropertyValueException
Description copied from interface: TypeDefinitionSet

Returns the number of elements in the given set, or -1 if the set is null. The set to count the members for is represented by the given property value of this set type definition.

Specified by:
getCount in interface TypeDefinitionSet
Parameters:
setPropertyValue - Property value containing a set.
Returns:
Number of elements in the given set.
Throws:
NullPointerException - The given set property value is null.
IllegalPropertyValueException - The type of the given property value does not match this set type definition.

getElementType

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

Returns the type of elements referenced from the defined set.

Specified by:
getElementType in interface TypeDefinitionSet
Returns:
Type of elements referenced from the defined set.
See Also:
TypeDefinitionObjectReference.getObjectType()

getElements

public Set<PropertyValue> getElements(PropertyValue setPropertyValue)
                               throws NullPointerException,
                                      IllegalPropertyValueException
Description copied from interface: TypeDefinitionSet

Returns a copy of the set of all the elements in the given set property value.

Specified by:
getElements in interface TypeDefinitionSet
Parameters:
setPropertyValue - Property value to read and returns the elements for.
Returns:
Shallow copy of the value of the given set property value.
Throws:
NullPointerException - The given set property value is null.
IllegalPropertyValueException - The type of the given argument does not match this set type definition.

removeElement

public void removeElement(PropertyValue setPropertyValue,
                          PropertyValue elementPropertyValue)
                   throws NullPointerException,
                          IllegalPropertyValueException,
                          BadTypeException,
                          ObjectNotFoundException
Description copied from interface: TypeDefinitionSet

Removes the given element from the given set, which is represented by the given property value of this set type definition.

Specified by:
removeElement in interface TypeDefinitionSet
Parameters:
setPropertyValue - Set to remove the given element from.
elementPropertyValue - Element to remove from the given set.
Throws:
NullPointerException - One or both of the arguments is/are null.
IllegalPropertyValueException - The type of the given property value does not match this set type definition.
BadTypeException - The type of the given element for removal does not match the element type of this set type definition.
ObjectNotFoundException - The given element to remove cannot be found in the given set property value.

createEmptySet

public PropertyValue createEmptySet()
Description copied from interface: TypeDefinitionSet

Create a property value with an empty set, ready to hold property values of this type definitions element type. Call TypeDefinitionSet.addElement(PropertyValue, PropertyValue) to add elements to this set.

Specified by:
createEmptySet in interface TypeDefinitionSet
Returns:
New property value containing an empty set.

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.