|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tv.amwa.maj.entity.InterchangeObject
@AAFClass(uuid1=218169601, uuid2=257, uuid3=256, uuid4={6,14,43,52,2,6,1,1}, definedName="InterchangeObject", description="The InterchangeObject class is a root class. All classes defined in an AAF file shall be sub-classes of InterchangeObject with the exception of the MetaDefinition classes defined by this document.") public abstract class InterchangeObject
Implements the root class for all AAF persistent classes. All classes defined in an AAF file shall be sub-classes of interchange object with the exception of the meta definition classes.
THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.
Nested Class Summary | |
---|---|
static class |
InterchangeObject.InterchangeObjectXMLHandler
XML handler that is the root class for all XML handlers of interchange objects. |
Constructor Summary | |
---|---|
InterchangeObject()
|
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. |
static InterchangeObject |
castFromInterface(InterchangeObject alien)
Casts a class that implements one of the generic interfaces of the Java AAF object model to a known concrete implementation. |
int |
countProperties()
Returns the number of properties currently present in this interchange object. |
PropertyValue |
createOptionalPropertyValue(PropertyDefinition propertyDefinition,
Object intialValue)
Creates and returns a property value according to the given property definition and sets it for this interchange object. |
void |
disableGenerationTracking()
Calling this method will cause generation tracking to be disabled for the object. |
void |
enableGenerationTracking()
Calling this method will cause generation tracking to be enabled for the object. |
ClassDefinition |
getDefinition()
Returns the class definition that identifies the class of this interchange object. |
Identification |
getGeneration()
Gets the generation of this object, which identifies when this object was created or last modified. |
AUID |
getGenerationAUID()
Shortcut to get the AUID of the identification representing this object's generation. |
Iterator<Property> |
getProperties()
Returns the set of properties of this interchange object, where each property contains its property definition and current value. |
PropertyValue |
getPropertyValue(PropertyDefinition propDef)
Returns the requested property value of the object. |
boolean |
isGenerationTracked()
Returns true if generations are being tracked by
the object. |
boolean |
isPropertyPresent(PropertyDefinition propDef)
Returns true if the property identified by the given
property definition is legal and
present; otherwise returns false . |
void |
omitOpionalProperty(PropertyDefinition propDef)
Omits the given optional property from this interchange object if the property definition is legal, optional and is present. |
static boolean |
registerImplementation(Class<?> implementor)
Register the known implementation of an interface. |
void |
setPropertiesFromInterface(InterchangeObject castFrom)
Set the properties of this instance value from those available in the given instance of an AAF interface. |
void |
setPropertyValue(PropertyDefinition propDef,
PropertyValue propVal)
Sets the value of the given property of this interchange object to the given value. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InterchangeObject()
Method Detail |
---|
public static final InterchangeObject castFromInterface(InterchangeObject alien) throws NullPointerException, ClassCastException
Casts a class that implements one of the generic interfaces of the Java AAF object model to a known concrete implementation. If the given class matches the known implementation, no casting takes place.
Implementing classes must first be registered using the registerImplementation(Class)
method. A maximum of one concrete implementing class per interface is permitted. External
classes that implement more than one interface are not supported and the behaviour of this
method will not be deterministic in this case.
As an example, consider the example class castFrom
or type
org.external.ExternalTaggedValue
that implements
TaggedValue
. To cast this to the known
implementation of tagged value
in this package, use the following code:
TaggedValue castTo = (TaggedValue) AAFObject.castFromInterface(castFrom);
Note that if the registration process has been unsuccessful, a runtime
ClassCastException
will be thrown by this code.
alien
- Class implementing any interface that extends
InterchangeObject
.
NullPointerException
- Argument is null.
ClassCastException
- The given class cannot be cast to a known implementations due to
incompatibilities, unknown interfaces, instantiation or invocation exceptions.public static final boolean registerImplementation(Class<?> implementor) throws NullPointerException, IllegalArgumentException
Register the known implementation of an interface. All concrete classes that extend this object must be registered, whether they are internal to this package or externally defined extensions.
All registered classes must implement a public
and final
method
called setPropertiesFromInterface()
. This method takes one parameter that is
the primary interface of the Java AAF object interfaces that the concrete class
supports. For example, in the TaggedValue
class:
public final void setPropertiesFromInterface( tv.amwa.maj.iface.TaggedValue castFrom) { super.setPropertiesFromInterface(castFrom); setName(castFrom.getName()); setTypeDefinition(castFrom.getTypeDefinition()); setValue(castFrom.getValue()); }
It is recommended that all concrete classes register themselves as part of their static initializers. For example:
class TaggedValue extends AAFObject { ... static { ... AAFObject.registerImplementation(TaggedValue.class); ... } ... }
If an interface is registered more than once, the previous registration is replaced. If
a replacement has taken place, this method will return true
.
implementor
- A class to register as an implementation of an interface, specified
by the parameter to the required method setPropertiesFromInterface()
.
NullPointerException
- Argument is null.
IllegalArgumentException
- The given class is not concrete or it does not implement
the required method setPropertiesFromInterface()
.public final void setPropertiesFromInterface(InterchangeObject castFrom) throws NullPointerException
Set the properties of this instance value from those available in the given instance of an AAF interface.
castFrom
- Value to extract properties from.
NullPointerException
- The given value to use to set this value is null
.public int countProperties()
InterchangeObject
Returns the number of properties currently present in this interchange object.
countProperties
in interface InterchangeObject
public PropertyValue createOptionalPropertyValue(PropertyDefinition propertyDefinition, Object intialValue) throws NullPointerException, IllegalPropertyException, PropertyAlreadyPresentException
InterchangeObject
Creates and returns a property value according to the given property definition and sets it for this interchange object. The property must be legal for this class and not currently present.
Important note: This is a low-level method that allows direct access to properties. If such access takes place, any semantic checking provided in named property get/set methods of the object is bypassed at the user's own risk.
createOptionalPropertyValue
in interface InterchangeObject
propertyDefinition
- Property definition identifying the property value to
create.intialValue
- Initial value for the optional property.
NullPointerException
- The given property definition and/or value is/are null
.
IllegalPropertyException
- The given property definition is illegal for this
interchange object's class.
PropertyAlreadyPresentException
- The given property is optional, but
already present in this class.TypeDefinition.createValue(Object)
,
InterchangeObject.setPropertyValue(PropertyDefinition, PropertyValue)
public void disableGenerationTracking()
InterchangeObject
Calling this method will cause generation tracking to be disabled
for the object. Generation information will then not be
available through the InterchangeObject.getGeneration()
and
InterchangeObject.getGenerationAUID()
methods.
Calling the InterchangeObject.enableGenerationTracking()
method will enable
generation tracking for this object.
Generation tracking is disabled by default.
disableGenerationTracking
in interface InterchangeObject
public void enableGenerationTracking()
InterchangeObject
Calling this method will cause generation tracking to be enabled
for the object. Generation information will then be available
through the InterchangeObject.getGeneration()
and InterchangeObject.getGenerationAUID()
methods.
Calling the InterchangeObject.disableGenerationTracking()
method will disable
generation tracking for this object.
Generation tracking is disabled by default.
enableGenerationTracking
in interface InterchangeObject
@AAFProperty(uuid1=100729092, uuid2=257, uuid3=0, uuid4={6,14,43,52,1,1,1,2}, definedName="ObjClass", typeName="WeakReference to ClassDefinition", optional=false, uniqueIdentifier=false, pid=257) public ClassDefinition getDefinition()
InterchangeObject
Returns the class definition that identifies the class of this interchange object.
getDefinition
in interface InterchangeObject
public Identification getGeneration() throws InvalidParameterException, ObjectNotAttachedException
InterchangeObject
Gets the generation of this object, which identifies when this object was created or last modified.
This method will succeed if generation tracking is enabled for
this object. Call InterchangeObject.enableGenerationTracking()
and
InterchangeObject.disableGenerationTracking()
to control generation tracking for
this object. Call InterchangeObject.isGenerationTracked()
to determine if
generation tracking is currently enabled for this object.
getGeneration
in interface InterchangeObject
InvalidParameterException
- Generation tracking is not enabled
for this object.
ObjectNotAttachedException
- This object is not attached to a file
from which generation information can be obtained.@AAFProperty(uuid1=85985025, uuid2=2048, uuid3=0, uuid4={6,14,43,52,1,1,1,2}, definedName="Generation", typeName="AUID", optional=true, uniqueIdentifier=false, pid=258) public AUID getGenerationAUID() throws InvalidParameterException, ObjectNotAttachedException
InterchangeObject
Shortcut to get the AUID of the identification representing this object's generation.
This method will succeed if generation tracking is enabled for
this object. Call InterchangeObject.enableGenerationTracking()
and
InterchangeObject.disableGenerationTracking()
to control generation tracking for
this object. Call InterchangeObject.isGenerationTracked()
to determine if
generation tracking is currently enabled for this object.
getGenerationAUID
in interface InterchangeObject
InvalidParameterException
- Generation tracking is not enabled for
this object.
ObjectNotAttachedException
- This object is not attached to a file
from which generation information can be obtained.InterchangeObject.getGeneration()
,
Identification.getGenerationAUID()
public Iterator<Property> getProperties()
InterchangeObject
Returns the set of properties of this interchange object, where each property contains its property definition and current value. The set contains both optional and required properties and any extended properties if present.
Important note: This is a low-level method that allows direct access to properties. If such access takes place, any semantic checking provided in named property get/set methods of the object is bypassed at the user's own risk.
getProperties
in interface InterchangeObject
public PropertyValue getPropertyValue(PropertyDefinition propDef) throws NullPointerException, IllegalPropertyException, PropertyNotPresentException
InterchangeObject
Returns the requested property value of the object. The desired property data is identified by the given property definition.
Important note: This is a low-level method that allows direct access to properties. If such access takes place, any semantic checking provided in named property get/set methods of the object is bypassed at the user's own risk.
getPropertyValue
in interface InterchangeObject
propDef
- Property definition identifying the requested property.
NullPointerException
- The given property definition is null
.
IllegalPropertyException
- The given property is illegal for this
interchange object's class.
PropertyNotPresentException
- The given property is optional, but not
currently present in this instance of the class.public void setPropertyValue(PropertyDefinition propDef, PropertyValue propVal) throws NullPointerException, IllegalPropertyException
InterchangeObject
Sets the value of the given property of this interchange object to the given value. If the selected property is optional but not yet present, this method will make the property present before setting its value.
Important note: This is a low-level method that allows direct access to properties. If such access takes place, any semantic checking such as that which is performed in all other named property get/set methods, is at the user's own risk.
setPropertyValue
in interface InterchangeObject
propDef
- Property definition identifying the property to set.propVal
- Value to set for the property.
NullPointerException
- One or both of the arguments is null
.
IllegalPropertyException
- The given property definition defines a property that is
illegal for this object's class.InterchangeObject.getProperties()
,
InterchangeObject.getPropertyValue(PropertyDefinition)
,
PropertyDefinition.getTypeDefinition()
,
TypeDefinition.createValue(Object)
public boolean isGenerationTracked()
InterchangeObject
Returns true
if generations are being tracked by
the object. A value of true
indicates that generation
information will be available through the InterchangeObject.getGeneration()
and InterchangeObject.getGenerationAUID()
methods.
Calling the InterchangeObject.enableGenerationTracking()
method will enable
generation tracking for this object; calling the
InterchangeObject.disableGenerationTracking()
method will disable generation
tracking for this object.
Generation tracking is disabled by default.
isGenerationTracked
in interface InterchangeObject
InterchangeObject.enableGenerationTracking()
,
InterchangeObject.disableGenerationTracking()
public boolean isPropertyPresent(PropertyDefinition propDef) throws NullPointerException, IllegalPropertyException
InterchangeObject
Returns true
if the property identified by the given
property definition is legal and
present; otherwise returns false
.
Important note: This is a low-level method that allows direct access to properties. If such access takes place, any semantic checking provided in named property get/set methods of the object is bypassed at the user's own risk.
isPropertyPresent
in interface InterchangeObject
propDef
- Property definition identifying an optional property of this
interchange object to test for.
NullPointerException
- The given property definition is null
.
IllegalPropertyException
- The given property is illegal for this
interchange object's class.InterchangeObject.getDefinition()
,
ClassDefinition.getPropertyDefinitions()
,
InterchangeObject.getProperties()
public void omitOpionalProperty(PropertyDefinition propDef) throws NullPointerException, IllegalPropertyException
InterchangeObject
Omits the given optional property from this interchange object if the property definition is legal, optional and is present.
Important note: This is a low-level method that allows direct access to properties. If such access takes place, any semantic checking provided in named property get/set methods of the object is bypassed at the user's own risk.
omitOpionalProperty
in interface InterchangeObject
propDef
- Property definition identifying the optional property to omit
from this interchange object.
NullPointerException
- The given property definition is null
.
IllegalPropertyException
- The given property definition is illegal for the class
defining this interchange object.InterchangeObject.getDefinition()
,
ClassDefinition.getPropertyDefinitions()
,
InterchangeObject.getProperties()
public final String toString()
toString
in class Object
Object.toString()
public void appendXMLChildren(Node parent)
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.
appendXMLChildren
in interface XMLSerializable
parent
- XML parent element to append child nodes to.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |