|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttv.amwa.maj.industry.TypeDefinitionWarehouse
public final class TypeDefinitionWarehouse
Stores and provides access to type definitions, allowing the range of supported types to be dynamically extended at runtime.
This class acts as a static cache of all type definitions known to a runtime on a specific Java virtual machine. An internal hashtable provides an efficient way of mapping from a type name or the type's identifying universal label to the types meta-class. This class is used to bootstrap the types known to a virtual machine on MAJ API initialization.
To add a user-defined extension type, use addTypesFromClass(Class)
.
In this implementation, you can also get a reference to a type definition using the static
references within each class. For example, the following Java statement evaluates to true
:
TypeDefinitionFactory.forName("UInt8") == TypeDefinitionInteger.UInt8
TypeDefinition
,
AAFFactory.typeDefinitionForName(String)
,
AAFFactory.typeDefinitionForIdentification(tv.amwa.maj.record.AUID)
Method Summary | |
---|---|
static void |
addTypesFromClass(Class<?> typeClass)
Looks through the given class for public static fields of type definitions
and adds these to the known type definitions available from this factory. |
static TypeDefinition |
forIdentification(AUID identification)
Finds and returns the type definition for the given AUID identification. |
static TypeDefinition |
forName(String typeName)
Finds and returns the type definition for the given name. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final void addTypesFromClass(Class<?> typeClass) throws NullPointerException
Looks through the given class for public static fields of type definitions
and adds these to the known type definitions available from this factory.
This method picks out static fields in the given class and adds them to the cache of known types in this class. Here is an example of the declaration of a UInt8 value:
public final static TypeDefinitionInteger UInt8 = new TypeDefinitionInteger( new AUID(0x01010100, (short) 0x0000, (short) 0x0000, new byte[] { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x04, 0x01, 0x01 } ), "UInt8", (byte) 1, false);
typeClass
- Class to check for static type definition instances.
NullPointerException
- The given class is null
.public static final TypeDefinition forName(String typeName) throws NullPointerException
Finds and returns the type definition for the given name. Type definition names are the same as used in the AAF specification, for example:
UInt32
Int8Array
WeakReferenceVector of TypeDefinition
StrongReference to CompositionMob
StrongReferenceVector<Component>
WeakReference<ClassDefinition>
If a corresponding type cannot be found, this method returns null
.
typeName
- Name of the type definition to check for.
NullPointerException
- The given type name is null
.public static final TypeDefinition forIdentification(AUID identification) throws NullPointerException
Finds and returns the type definition for the given AUID identification. If a type definition
matching the given identification cannot be found, null
is returned.
identification
- AUID to use to lookup a type definition.
NullPointerException
- The given type identifier is null
.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |