Media Authoring
with Java API

tv.amwa.maj.meta
Class PropertyDefinition

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

@AAFClass(uuid1=218169601,
          uuid2=514,
          uuid3=0,
          uuid4={6,14,43,52,2,6,1,1},
          definedName="PropertyDefinition",
          description="The PropertyDefinition class describes properties allowed for a class.")
public final class PropertyDefinition
extends MetaDefinition
implements PropertyDefinition, Serializable, XMLSerializable

Implementation of a AAF property definition, which describes properties allowed for a class.

The preferred method of creating and managing property definitions in this Java implementation is by annotating get methods on class implementations with the AAFProperty annotation. Property definitions are then created and attached to their appropriate class definition using ClassDefinition.forClass(Class).

Author:
Richard Cartwright
See Also:
PropertyDefinition, AAFProperty, InterchangeObject.getProperties(), PropertyValue, Serialized Form

Nested Class Summary
static class PropertyDefinition.XMLHandler
           
 
Constructor Summary
PropertyDefinition(AUID identification, String name, TypeDefinition type, ClassDefinition memberOf, boolean isOptional)
          Creates and initializes a new property definition, which describes an allowed property of a class definition.
 
Method Summary
 void appendXMLChildren(Node parent)
          Append child elements to the given parent node to serialize the value of an object to an XML fragment.
 boolean deepEquals(Object o)
          Tests if all the properties of this property definition are equals to all the properties of the given object.
 Method getAnnotatedMethod()
           
 boolean getIsOptional()
          Returns true for a property that is optional and false for a mandatory property.
 boolean getIsUniqueIdentifier()
          Returns true for a property that provides a unique identifier for its associated object; otherwise false.
 short getLocalIdentification()
          Returns the local identification associated with this property definition, which is used to identify the property within the scope of its associated class, as returned by PropertyDefinition.getMemberOf().
 ClassDefinition getMemberOf()
          Returns the class definition for the class that this property definition defines a property for.
 TypeDefinition getTypeDefinition()
          Returns the property type of the defined property.
 void setAnnotatedMethod(Method annotatedMethod)
           
 void setPropertiesFromInterface(PropertyDefinition castFrom)
          Set the value of the properties of this property definition using any class that implements PropertyDefinition.
 
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
 

Constructor Detail

PropertyDefinition

public PropertyDefinition(AUID identification,
                          @AAFString
                          String name,
                          TypeDefinition type,
                          ClassDefinition memberOf,
                          @Bool
                          boolean isOptional)
                   throws NullPointerException

Creates and initializes a new property definition, which describes an allowed property of a class definition.

It is not normally necessary to create property definitions directly as they are available through methods of ClassDefinition. To extend the AAF object model with user defined classes, the AAFProperty annotation can be used to automatically generate property definitions.

Parameters:
identification - Unique identifier for the new property definition.
name - Display name of the new property definition.
type - Property type for the new property definition.
memberOf - Reference to the class this property is a member of, or null if this property is not associated with a class.
isOptional - Can an object omit a value for this property?
Throws:
NullPointerException - One of the identification, name or type arguments is/are null and they are all required in this implementation.
Method Detail

setPropertiesFromInterface

public final void setPropertiesFromInterface(PropertyDefinition castFrom)

Set the value of the properties of this property definition using any class that implements PropertyDefinition.

Parameters:
castFrom - Object to use to set property values from.
See Also:
MetaDefinition.setPropertiesFromInterface(tv.amwa.maj.iface.MetaDefinition)

getIsOptional

@AAFProperty(uuid1=50397698,
             uuid2=256,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="IsOptional",
             typeName="Boolean",
             optional=false,
             uniqueIdentifier=false,
             pid=12)
public boolean getIsOptional()
Description copied from interface: PropertyDefinition

Returns true for a property that is optional and false for a mandatory property. Optional properties can be omitted from an objects persistent representation.

Specified by:
getIsOptional in interface PropertyDefinition
Returns:
Is the property optional?

getIsUniqueIdentifier

@AAFProperty(uuid1=100729095,
             uuid2=1536,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="IsUniqueIdentifier",
             typeName="Boolean",
             optional=true,
             uniqueIdentifier=false,
             pid=14)
public boolean getIsUniqueIdentifier()
                              throws PropertyNotPresentException
Description copied from interface: PropertyDefinition

Returns true for a property that provides a unique identifier for its associated object; otherwise false.

Specified by:
getIsUniqueIdentifier in interface PropertyDefinition
Returns:
Is this property a unique identifier for an object it is part of?
Throws:
PropertyNotPresentException - The optional is unique identifier property is not present in this property definition.

getTypeDefinition

@AAFProperty(uuid1=100729095,
             uuid2=1024,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="Type",
             typeName="WeakReference to TypeDefinition",
             optional=false,
             uniqueIdentifier=false,
             pid=11)
public TypeDefinition getTypeDefinition()
Description copied from interface: PropertyDefinition

Returns the property type of the defined property.

Specified by:
getTypeDefinition in interface PropertyDefinition
Returns:
Type definition for this property definition.

getLocalIdentification

@AAFProperty(uuid1=100729095,
             uuid2=1280,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="LocalIdentification",
             typeName="UInt16",
             optional=false,
             uniqueIdentifier=false,
             pid=13)
public short getLocalIdentification()
                             throws PropertyNotPresentException
Description copied from interface: PropertyDefinition

Returns the local identification associated with this property definition, which is used to identify the property within the scope of its associated class, as returned by PropertyDefinition.getMemberOf(). This property is optional in the MAJ API as this API may not use an AAF-file based persistent representation of data.

Specified by:
getLocalIdentification in interface PropertyDefinition
Returns:
Local identification associated with this property definition.
Throws:
PropertyNotPresentException - The optional local identification property is not present in this property definition.

getMemberOf

public ClassDefinition getMemberOf()
                            throws PropertyNotPresentException
Description copied from interface: PropertyDefinition

Returns the class definition for the class that this property definition defines a property for. This property is optional in the MAJ API but is almost always available in the implementation.

Specified by:
getMemberOf in interface PropertyDefinition
Returns:
Class definition of the class that this property definition is associated with.
Throws:
PropertyNotPresentException - The optional member of a class property is not present in this property definition.
See Also:
ClassDefinition.getPropertyDefinitions()

deepEquals

public boolean deepEquals(Object o)

Tests if all the properties of this property definition are equals to all the properties of the given object.

Overrides:
deepEquals in class MetaDefinition
Parameters:
o - Object to compare to this definition.
Returns:
Are all the properties of this property definition are equals to all the properties of the given object?
See Also:
MetaDefinition.deepEquals(java.lang.Object)

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.

setAnnotatedMethod

public void setAnnotatedMethod(Method annotatedMethod)
                        throws NullPointerException
Throws:
NullPointerException

getAnnotatedMethod

public Method getAnnotatedMethod()

Media Authoring
with Java API

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