Media Authoring
with Java API

tv.amwa.maj.meta
Class TypeDefinitionObjectReference

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

public abstract class TypeDefinitionObjectReference
extends TypeDefinition
implements TypeDefinitionObjectReference, XMLSerializable, Serializable, MAJCommon

Implements the definition of a property type that defines an object relationship.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class TypeDefinitionObjectReference.ObjectReferenceValue
           
static class TypeDefinitionObjectReference.TypeDefinitionObjectReferenceUnresolved
           
 
Constructor Summary
TypeDefinitionObjectReference()
           
 
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.
 PropertyValue createValue(Object object)
          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.
 Object getObject(PropertyValue propertyValue)
          Returns the object referenced by the given object reference property value.
 ClassDefinition getObjectType()
          Returns the class definition representing the class of objects to which this object reference type definition can refer.
 void setObject(PropertyValue propertyValue, Object object)
          Sets the given object as the target of the given object reference property value.
 void setPropertiesFromInterface(TypeDefinitionObjectReference castFrom)
           
 
Methods inherited from class tv.amwa.maj.meta.TypeDefinition
getTypeCategory, 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.TypeDefinition
getTypeCategory
 
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
 

Constructor Detail

TypeDefinitionObjectReference

public TypeDefinitionObjectReference()
Method Detail

setPropertiesFromInterface

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

createValue

public PropertyValue createValue(Object object)
                          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 interface TypeDefinitionObjectReference
Specified by:
createValue in class TypeDefinition
Parameters:
object - 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:
TypeDefinitionObjectReference.setObject(PropertyValue, Object)

getObject

public Object getObject(PropertyValue propertyValue)
                 throws NullPointerException,
                        IllegalPropertyValueException
Description copied from interface: TypeDefinitionObjectReference

Returns the object referenced by the given object reference property value.

Specified by:
getObject in interface TypeDefinitionObjectReference
Parameters:
propertyValue - Property value form which the value is to be read.
Throws:
NullPointerException - The given property value containing a reference is null.
IllegalPropertyValueException - The given property value is not defined by this object reference type.

getObjectType

public ClassDefinition getObjectType()
Description copied from interface: TypeDefinitionObjectReference

Returns the class definition representing the class of objects to which this object reference type definition can refer. The returned definition is the least-derived type that it is permissible to represent, in other words the type definition can represent objects of the given class and any of its sub-classes.

Specified by:
getObjectType in interface TypeDefinitionObjectReference
Returns:
Class definition representing the class of objects to which property values of the object reference type can refer.

setObject

public void setObject(PropertyValue propertyValue,
                      Object object)
               throws NullPointerException,
                      IllegalPropertyValueException,
                      ClassCastException
Description copied from interface: TypeDefinitionObjectReference

Sets the given object as the target of the given object reference property value.

Specified by:
setObject in interface TypeDefinitionObjectReference
Parameters:
propertyValue - Property value containing the object reference to be set.
object - Target of the object reference to set for the given property value.
Throws:
NullPointerException - Argument is null.
IllegalPropertyValueException - The given property value is not defined by this object reference type.
ClassCastException - The given object cannot be cast to one compatible with the permissible classes, as returned by TypeDefinitionObjectReference.getObjectType().
See Also:
TypeDefinitionObjectReference.createValue(Object)

deepEquals

public 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.