Media Authoring
with Java API

tv.amwa.maj.iface
Interface ClassDefinition

All Superinterfaces:
MetaDefinition
All Known Implementing Classes:
ClassDefinition

public interface ClassDefinition
extends MetaDefinition

Specifies the definition of an AAF class. The definition can be used to extend the class hierarchy defined in the AAF object specification v1.1 by specifying a new class or by defining additional optional properties for a defined class. The operations on a class definition include: managing the position of the class within the class hierarchy; accessing property definitions associated with the class.

With the MAJ API, a Java class can be used to specify a class definition by using the AAFClass and AAFProperty annotations. In this way, AAF class specification data and the MAJ API implementation methods can be managed alongside one another.

Author:
Richard Cartwright
See Also:
makeClassDefinition(), AAFClass, ClassDefinitionWarehouse

Method Summary
 int countPropertyDefinitions()
          Returns number of property definitions in this class.
 Object createInstance()
          Creates an instance of this class, and returns it.
 Class<?> getJavaImplementation()
          Returns the Java class implementation associated with the defined class.
 ClassDefinition getParent()
          Gets the Parent class for this class definition.
 Set<? extends PropertyDefinition> getPropertyDefinitions()
          Returns all of the AAF property definitions attached to the current class.
 PropertyDefinition getUniqueIdentifier()
          Returns the property definition corresponding to this class' unique identifier.
 boolean isConcrete()
          Returns true if the defined class can be instantiated; returns false otherwise.
 boolean isRoot()
          Returns true if the defined class is the base of the inheritance hierarchy; returns false otherwise.
 boolean isUniquelyIdentified()
          Returns true if the defined class is uniquely identified, which means that it has a single property that is a unique identifier for any given instance.
 PropertyDefinition lookupPropertyDefinition(AUID propertyId)
          Looks up and returns the property definition corresponding to the given AUID in the set of propertise defined for this class.
 PropertyDefinition registerNewPropertyDefinition(AUID identification, String name, TypeDefinition typeDefinition, boolean isOptional, boolean isUniqueIdentifier, Short pid)
          Creates a new property definition and registers it in this class definition.
 PropertyDefinition registerOptionalPropertyDefinition(AUID identification, String name, TypeDefinition typeDefinition)
          Creates a new property definition and registers it in this class definition.
 void setJavaImplementation(Class<?> javaImplementation)
          Sets the Java class implementation associated with the defined class.
 
Methods inherited from interface tv.amwa.maj.iface.MetaDefinition
getAUID, getDescription, getName, setDescription, setName
 

Method Detail

getPropertyDefinitions

Set<? extends PropertyDefinition> getPropertyDefinitions()

Returns all of the AAF property definitions attached to the current class.

Returns:
Shallow copy of the set of property definitions object that define the properties for this defined class.

countPropertyDefinitions

@UInt32
int countPropertyDefinitions()

Returns number of property definitions in this class.

Returns:
Number of properties contained in this class definition.

registerNewPropertyDefinition

PropertyDefinition registerNewPropertyDefinition(AUID identification,
                                                 @AAFString
                                                 String name,
                                                 TypeDefinition typeDefinition,
                                                 boolean isOptional,
                                                 boolean isUniqueIdentifier,
                                                 Short pid)
                                                 throws NullPointerException,
                                                        ObjectAlreadyAttachedException,
                                                        AlreadyUniquelyIdentifiedException

Creates a new property definition and registers it in this class definition. The new property definition is returned.

Note that it is illegal to add mandatory properties to an existing (registered) class. This method will allow adding either optional or mandatory properties to a class, but they must be added to a class which has not yet been registered in the dictionary. If this class has already been registered, it is possible to add optional properties, but not through this method. Optional properties added to an existing (registered) class may be added through the InterchangeObject.createOptionalPropertyValue(PropertyDefinition, Object) method.

Parameters:
identification - AUID to be used to identify this property.
name - Name of the new property.
typeDefinition - Type of the new property.
isOptional - True if new property is to be optional.
isUniqueIdentifier - True if new property is to be the unique identifier of the class.
pid - Short tag used to identify the property, or null if it is not known.
Returns:
The newly created property definition.
Throws:
NullPointerException - One of the name or type definition arguments is null.
ObjectAlreadyAttachedException - A property with the given identifier has already been registered.
AlreadyUniquelyIdentifiedException - This class already has a unique identifier property.
See Also:
Dictionary.getClassDefinitions(), PropertyDefinition, InterchangeObject.createOptionalPropertyValue(PropertyDefinition, Object)

registerOptionalPropertyDefinition

PropertyDefinition registerOptionalPropertyDefinition(AUID identification,
                                                      @AAFString
                                                      String name,
                                                      TypeDefinition typeDefinition)
                                                      throws NullPointerException,
                                                             ObjectAlreadyAttachedException

Creates a new property definition and registers it in this class definition. The new property definition is returned.

Note that it is illegal to add mandatory properties to an already existing (registered) class. It is assumed that this property is being added to a class which is already registered. If so, it must be optional and this method will declare it so. If it is wished to add a mandatory property, that may be done through the registerNewPropertyDef() method, but that must be called on a class which is not yet registered.

Parameters:
identification - AUID to be used to identify this property.
name - Name of the new property.
typeDefinition - Type of the new property.
Returns:
Newly created property definition.
Throws:
NullPointerException - Name or typeDef argument is null.
ObjectAlreadyAttachedException - The given property identifier has already been registered.

lookupPropertyDefinition

PropertyDefinition lookupPropertyDefinition(AUID propertyId)
                                            throws NullPointerException,
                                                   BadParameterException

Looks up and returns the property definition corresponding to the given AUID in the set of propertise defined for this class.

Parameters:
propertyId - AUID identifying the property to look up.
Returns:
Property definition with the given identifier.
Throws:
NullPointerException - The given property identifier is null.
BadParameterException - The given property identifier is not registered as a property definition for this class.

getParent

ClassDefinition getParent()

Gets the Parent class for this class definition. If there is no parent then null is returned. The only classes which have no parent will be InterchangeObject and MetaDefinition. These classes return themselves as their own parents to indicate that they are the root of the type hierarchy.

Returns:
Parent class of this class definition, this class if it is the root of the class hierarchy or null if no parent class has been defined.

isConcrete

@Bool
boolean isConcrete()

Returns true if the defined class can be instantiated; returns false otherwise. If the class is not concrete, then it is abstract and implemented by an abstract Java class in the MAJ API. Any object in an AAF file that belongs to an abstract class shall also belong to a concrete subclass of the abstract class.

Returns:
Can the defined class be instantiated?

isRoot

@Bool
boolean isRoot()

Returns true if the defined class is the base of the inheritance hierarchy; returns false otherwise.

Returns:
Is this a root (base) class?

isUniquelyIdentified

@Bool
boolean isUniquelyIdentified()

Returns true if the defined class is uniquely identified, which means that it has a single property that is a unique identifier for any given instance.

Returns:
Is this a uniquely identified class?
See Also:
getUniqueIdentifier(), PropertyDefinition.getIsUniqueIdentifier()

getUniqueIdentifier

PropertyDefinition getUniqueIdentifier()

Returns the property definition corresponding to this class' unique identifier.

Returns:
The unique identifier of this class definition, or null if the class does not have a unique identifier property definition.
See Also:
isUniquelyIdentified(), PropertyDefinition.getIsUniqueIdentifier()

createInstance

Object createInstance()
                      throws NotImplementedException

Creates an instance of this class, and returns it. This method is not supported in the MAJ API and will always throw a NotImplementedException. Use implementations of the AAF factory instead.

Returns:
An instance object of this class definition.
Throws:
NotImplementedException

getJavaImplementation

Class<?> getJavaImplementation()
                               throws PropertyNotPresentException

Returns the Java class implementation associated with the defined class.

Returns:
Java class implementation associated with this AAF class definition.
Throws:
PropertyNotPresentException - The optional java implementation property is not present in this AAF class definition.
See Also:
AAFClass, ClassDefinition.forClass(Class)

setJavaImplementation

void setJavaImplementation(Class<?> javaImplementation)

Sets the Java class implementation associated with the defined class.

Parameters:
javaImplementation - Java class implementation associated with this AAF class definition.
See Also:
AAFClass, ClassDefinition.forClass(Class)

Media Authoring
with Java API

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