TypeDefinitionRecordImpl (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.meta.impl

## Class TypeDefinitionRecordImpl

- java.lang.Object
- - tv.amwa.maj.meta.impl.MetaDefinitionImpl
  - - tv.amwa.maj.meta.impl.TypeDefinitionImpl
    - - tv.amwa.maj.meta.impl.SingletonTypeDefinitionImpl
      - - tv.amwa.maj.meta.impl.TypeDefinitionRecordImpl

- All Implemented Interfaces:
    Serializable, Cloneable, CommonConstants, MetadataObject, WeakReferenceTarget, MetaDefinition, TypeDefinition, TypeDefinitionRecord, DefinitionType

      @MediaClass(uuid1=218169601,
                  uuid2=525,
                  uuid3=0,
                  uuid4={6,14,43,52,2,6,1,1},
                  definedName="TypeDefinitionRecord",
                  description="The TypeDefinitionRecord class defines a property type that consists of an ordered set of fields, where each field has a name and type.",
                  symbol="TypeDefinitionRecord")
      public final class TypeDefinitionRecordImpl
      extends SingletonTypeDefinitionImpl
      implements TypeDefinitionRecord, Serializable, Cloneable

  Implements the definition of a property type that consists of an ordered set of fields, where each field has a name and type.

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TypeDefinitionRecordImpl.RecordValue`

    - ### Nested classes/interfaces inherited from class tv.amwa.maj.meta.impl.SingletonTypeDefinitionImpl

      `SingletonTypeDefinitionImpl.SingletonMethodBag`

    - ### Nested classes/interfaces inherited from class tv.amwa.maj.meta.impl.TypeDefinitionImpl

      `TypeDefinitionImpl.PropertyValueImpl`

  - ### Field Summary

    - ### Fields inherited from interface tv.amwa.maj.constant.CommonConstants

      `AAF_METADICT_NAMESPACE, AAF_METADICT_PREFIX, AAF_XML_NAMESPACE, AAF_XML_PREFIX, ApplicationPluginObjectID, ApplicationPluginsID, MAX_NUM_RGBA_COMPS, MemberOfID, ObjectClassID, ParentClassID, PropertiesID, XMLClassIDAsAttributeName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TypeDefinitionRecordImpl(AUID identification, String typeName, String[] names, Map<String,TypeDefinition> elements, Class<?> specification)` Creates and initializes this record type definition, which defines a property type that consists of an ordered set of fields, where each field has a name and type.
    `TypeDefinitionRecordImpl(AUID identification, String typeName, String[] names, TypeDefinition[] types, Class<?> specification)` Version of the constructor that can be used in static initializers.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendMemberName(String memberName)`
    `void` | `appendMemberName(TypeDefinition memberType)`
    `void` | `appendMetadictXML(Node metadict, String namespace, String prefix)` Append an XML representation of this meta definition to the given XML node.
    `void` | `clearMemberNames()`
    `void` | `clearMemberTypes()`
    `TypeDefinitionRecord` | `clone()` Create a cloned copy of this meta definition.
    `PropertyValue` | `createFromBytes(ByteBuffer buffer)` Create a value of this type by reading the bytes in the given byte buffer.
    `PropertyValue` | `createValue(Object javaValue)` Create a property value from the given Java object.
    `PropertyValue` | `createValueFromObject(Object initialData)` Creates and returns a new record property value that is initialized using the given Java object.
    `PropertyValue` | `createValueFromString(String content)` Create a record type value of this type from a string representation.
    `PropertyValue` | `createValueFromValues(PropertyValue[] memberValues)` Creates and returns a new record property value from the given array of property values, matching the elements of the given array to the fields of a new record value by index into the list of fields of this record type definition.
    `int` | `getCount()` Returns the number of fields stored in a record defined by this record type definition.
    `Class<?>` | `getImplementation()` Returns an implementation of the specified interface if available; otherwise `null`.
    `String` | `getMemberName(int index)` Returns the name of the field of a record defined by this record type definition at the given index into the list of fields.
    `String[]` | `getMemberNames()`
    `TypeDefinition` | `getMemberType(int index)` Returns the type of the field of a record defined by this record type definition at the given index into the list of fields.
    `List<TypeDefinition>` | `getMemberTypes()`
    `Object` | `getObject(PropertyValue recordProperty)` Returns the object representing the record value.
    `Class<?>` | `getSpecification()` Returns the interface that specifies acceptable implementations of record values of this type.
    `TypeCategory` | `getTypeCategory()` Returns the type category to which this type definition belongs, which corresponds to its sub interface.
    `PropertyValue` | `getValue(PropertyValue recordProperty, int index)` Returns the property value of one of the fields of the given record property value, where the value to return is determined by an index into the list of fields of this record type definition.
    `PropertyValue` | `getValue(PropertyValue recordProperty, String memberName)` Returns the property value of one of the fields of the given record property value, where the value to return corresponds to the given field name.
    `static String[]` | `initializeMemberNames()`
    `static List<TypeDefinition>` | `initializeMemberTypes()`
    `long` | `lengthAsBytes(PropertyValue value)` Returns the number of bytes that the given value of this type is serialized as a sequence of bytes.
    `static void` | `registerInterfaceMapping(Class<?> recordTypeInterface, Class<?> recordTypeImplementation)`
    `void` | `setObject(PropertyValue recordProperty, Object data)` Sets the value of the given record property value using the given Java object.
    `void` | `setValue(PropertyValue recordProperty, int index, PropertyValue memberProperty)` Sets the value of a field of the given record property value, determined by index into the list of fields of its record type definition.
    `void` | `setValue(PropertyValue recordProperty, String memberName, PropertyValue memberProperty)` Sets the value of a field of the given record property value, determined by field name, to be the given field property value.
    `List<PropertyValue>` | `writeAsBytes(PropertyValue value, ByteBuffer buffer)` Write the given property value of this type to the given byte stream.
    `List<PropertyValue>` | `writeAsStructuredStorageBytes(PropertyValue value, ByteBuffer buffer)` Write the given property value of this type to the given byte stream that is to be written to a structured storage format file.

    - ### Methods inherited from class tv.amwa.maj.meta.impl.SingletonTypeDefinitionImpl

      `setPropertyValue`

    - ### Methods inherited from class tv.amwa.maj.meta.impl.TypeDefinitionImpl

      `getNamespace, getPrefix, getPropertyValue, initalizeTypeNameMap, nameToAAFName, resolveReferences`

    - ### Methods inherited from class tv.amwa.maj.meta.impl.MetaDefinitionImpl

      `aafNameToName, appendXMLChildren, deepEquals, equals, getAAFNamesInUse, getAliases, getAUID, getComment, getDescription, getIdentification, getName, getSymbol, getWeakTargetReference, hashCode, initializeMetaDefinitionIdentification, initializeMetaDefinitionName, setAAFNamesInUse, setAliases, setDescription, setIdentification, setName, setNamespace, setPrefix, setSymbol, toString`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface tv.amwa.maj.meta.TypeDefinition

      `getPropertyValue, resolveReferences, setPropertyValue`

    - ### Methods inherited from interface tv.amwa.maj.meta.MetaDefinition

      `deepEquals, equals, getAAFNamesInUse, getAliases, getAUID, getDescription, getName, getNamespace, getPrefix, getSymbol, hashCode, setAAFNamesInUse, setDescription, setName, setNamespace, setPrefix, setSymbol, toString`

    - ### Methods inherited from interface tv.amwa.maj.industry.WeakReferenceTarget

      `getWeakTargetReference`

- - ### Constructor Detail

    - #### TypeDefinitionRecordImpl

          public TypeDefinitionRecordImpl(AUID identification,
                                          @AAFString
                                          String typeName,
                                          @AAFString
                                          String[] names,
                                          Map<String,TypeDefinition> elements,
                                          Class<?> specification)
                                   throws NullPointerException,
                                          IllegalArgumentException

      Creates and initializes this record type definition, which defines a property type that consists of an ordered set of fields, where each field has a name and type.

      It is only possible to use the following types as members of a record:

      - `TypeDefinitionInteger`
      - `TypeDefinitionRecord`
      - `TypeDefinitionEnumeration`
      - `TypeDefinitionExtendibleEnumeration`
      - `TypeDefinitionFixedArray`

      If a type definition of a kind other than one listed above is used, an `IllegalArgumentException` will be thrown.

      Record type definitions provide a documented mechanism for extended the AAF meta model. However, care must be taken as any user-defined record types may not be interoperable with other systems if the record is not registered. The official registry of type definitions is available from SMPTE at SMPTE Metadata Registries And Related Items. The full range of data types documented in the AAF 1.1 object specification can be accessed by name and identification using either `Warehouse.lookForType(String)` or `Warehouse.lookForType(tv.amwa.maj.record.AUID)` respectively.

      Parameters:
        `identification` - AUID to be used to identify this type.
        `typeName` - Friendly name for the record type definition.
        `names` - Names of the element of the record in the order of the records.
        `elements` - Elements of the records represented as a map from name to type.
        `specification` - A Java interface specifying implementations of instances of this type.
      Throws:
        `NullPointerException` - One or more of the identification, names or elements arguments is `null`, or one or more of the elements of the given arrays is `null`.
        `IllegalArgumentException` - Thress possible causes: One or more of the types contained in the member type array is not a permissable type for a record; a member type name is duplicated in the given array of member names; the given Java specification is not an interface.

    - #### TypeDefinitionRecordImpl

          public TypeDefinitionRecordImpl(AUID identification,
                                          @AAFString
                                          String typeName,
                                          @AAFString
                                          String[] names,
                                          TypeDefinition[] types,
                                          Class<?> specification)
                                   throws NullPointerException,
                                          IndexOutOfBoundsException,
                                          IllegalArgumentException

      Version of the constructor that can be used in static initializers.

      Parameters:
        `identification` - AUID to be used to identify this type.
        `typeName` - Friendly name for the record type definition.
        `names` - Names of the element of the record in the order of the records.
        `types` - Elements of the records represented as a map from name to type mapped to the names by array index.
        `specification` - A Java interface specifying implementations of instances of this type.
      Throws:
        `NullPointerException` - One or more of the arguments is null.
        `IndexOutOfBoundsException` - The arrays are of different lengths.
        `IllegalArgumentException`
      See Also:
        `#TypeDefinitionRecord(tv.amwa.maj.record.AUID, String, String[], Map)`

  - ### Method Detail

    - #### registerInterfaceMapping

          public static final void registerInterfaceMapping(Class<?> recordTypeInterface,
                                                            Class<?> recordTypeImplementation)
                                                     throws NullPointerException,
                                                            IllegalArgumentException

      Throws:
        `NullPointerException`
        `IllegalArgumentException`

    - #### getMemberNames

          @MediaProperty(uuid1=50397699,
                         uuid2=1536,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="MemberNames",
                         typeName="UTF16StringArray",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=29,
                         symbol="MemberNames")
          public final String[] getMemberNames()

    - #### initializeMemberNames

          public static final String[] initializeMemberNames()

    - #### clearMemberNames

          @MediaPropertyClear(value="MemberNames")
          public void clearMemberNames()

    - #### appendMemberName

          @MediaListAppend(value="MemberNames")
          public void appendMemberName(String memberName)

    - #### getMemberTypes

          @MediaProperty(uuid1=100729095,
                         uuid2=4352,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="MemberTypes",
                         typeName="TypeDefinitionWeakReferenceVector",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=28,
                         symbol="MemberTypes")
          public final List<TypeDefinition> getMemberTypes()

    - #### initializeMemberTypes

          public static final List<TypeDefinition> initializeMemberTypes()

    - #### clearMemberTypes

          @MediaPropertyClear(value="MemberTypes")
          public void clearMemberTypes()

    - #### appendMemberName

          @MediaListAppend(value="MemberTypes")
          public void appendMemberName(TypeDefinition memberType)

    - #### getSpecification

          public Class<?> getSpecification()

      Description copied from interface: `TypeDefinitionRecord`

      Returns the interface that specifies acceptable implementations of record values of this type.

      Specified by:
        `getSpecification` in interface `TypeDefinitionRecord`
      Returns:
        Interface specifying Java implementations of values of this type.
      See Also:
        `TypeDefinitionRecord.getImplementation()`

    - #### getImplementation

          public Class<?> getImplementation()

      Description copied from interface: `TypeDefinitionRecord`

      Returns an implementation of the specified interface if available; otherwise `null`.

      Specified by:
        `getImplementation` in interface `TypeDefinitionRecord`
      Returns:
        Implementation of the specified interface.
      See Also:
        `TypeDefinitionRecord.getSpecification()`

    - #### createValueFromObject

          public final PropertyValue createValueFromObject(Object initialData)
                                                    throws BadTypeException

      Description copied from interface: `TypeDefinitionRecord`

      Creates and returns a new record property value that is initialized using the given Java object. The Java reflection API is used to discover if the fields of the record, matched by name, are readable from the given object, either as public fields or as public `get...` methods. The type of each field in the Java object must be compatible with the type definition defined for that field in this record type definition.

      Note that the object may define more fields than the number of elements of the record. If this is the case, the record property value will contain less information than the given object instance. Be aware that a future call to `TypeDefinitionRecord.getObject(PropertyValue)` with a record property created by this method may result in a different Java object value.

      Specified by:
        `createValueFromObject` in interface `TypeDefinitionRecord`
      Parameters:
        `initialData` - Object to use to set the values of the a new record property value. A `null` value is permitted.
      Returns:
        Newly created record property value, created using the the current value of the given object.
      Throws:
        `BadTypeException` - The type of the object cannot be converted to the interface specification defined in this record type definition.
      See Also:
        `Class.getFields()`, `Class.getMethods()`, `TypeDefinitionRecord.createValueFromValues(PropertyValue[])`

    - #### createValueFromValues

          public final PropertyValue createValueFromValues(PropertyValue[] memberValues)
                                                    throws NullPointerException,
                                                           IllegalArgumentException,
                                                           BadTypeException

      Description copied from interface: `TypeDefinitionRecord`

      Creates and returns a new record property value from the given array of property values, matching the elements of the given array to the fields of a new record value by index into the list of fields of this record type definition.

      Specified by:
        `createValueFromValues` in interface `TypeDefinitionRecord`
      Parameters:
        `memberValues` - Array of property values to set for the new record property value.
      Returns:
        Newly created record property value from the given array of property values.
      Throws:
        `NullPointerException` - The given array of field values is `null` or one or more of the elements of the array is `null`.
        `IllegalArgumentException` - The given array is of a different size from that defined by the record type definition and returned by `TypeDefinitionRecord.getCount()`.
        `BadTypeException` - One or more of the given property values is of a type that does not match the one defined for the field at the equivalent index in the list of fields of this record type definition.

    - #### getCount

          public final int getCount()

      Description copied from interface: `TypeDefinitionRecord`

      Returns the number of fields stored in a record defined by this record type definition.

      Specified by:
        `getCount` in interface `TypeDefinitionRecord`
      Returns:
        Number of fields stored in a record defined by this record type definition.

    - #### getObject

          public final Object getObject(PropertyValue recordProperty)
                                 throws NullPointerException,
                                        BadTypeException,
                                        IllegalPropertyValueException

      Description copied from interface: `TypeDefinitionRecord`

      Returns the object representing the record value. Note that the internal value is permitted to be `null`.

      This method is very similar to `recordProperty.getValue()` except that it checks the type definition matches this one first.

      Specified by:
        `getObject` in interface `TypeDefinitionRecord`
      Parameters:
        `recordProperty` - Property value containing a record to extract the field values from.
      Returns:
        New Java object with its values set by the fields of the given record property value.
      Throws:
        `NullPointerException` - One or both of the arguments is/are `null`.
        `BadTypeException` - The types of the field properties of the record type definition cannot be converted to the types of the fields of an instance of the given class.
        `IllegalPropertyValueException` - The given property value is not defined by a compatible record type definition.
      See Also:
        `TypeDefinitionRecord.createValueFromObject(Object)`, `TypeDefinitionRecord.setObject(PropertyValue, Object)`, `PropertyValue.getValue()`

    - #### getMemberName

          public final String getMemberName(int index)
                                     throws IndexOutOfBoundsException

      Description copied from interface: `TypeDefinitionRecord`

      Returns the name of the field of a record defined by this record type definition at the given index into the list of fields.

      Specified by:
        `getMemberName` in interface `TypeDefinitionRecord`
      Parameters:
        `index` - 0-based index into the record type definition's list of fields.
      Returns:
        Field name at the given index.
      Throws:
        `IndexOutOfBoundsException` - The index is outside the acceptable range for the number of fields of this record type definition.

    - #### getMemberType

          public final TypeDefinition getMemberType(int index)
                                             throws IndexOutOfBoundsException

      Description copied from interface: `TypeDefinitionRecord`

      Returns the type of the field of a record defined by this record type definition at the given index into the list of fields.

      Specified by:
        `getMemberType` in interface `TypeDefinitionRecord`
      Parameters:
        `index` - 0-based index into the record type definition's fields.
      Returns:
        Field type at the given index.
      Throws:
        `IndexOutOfBoundsException` - The index is outside the acceptable range for the list of fields of this record type definition.

    - #### getValue

          public final PropertyValue getValue(PropertyValue recordProperty,
                                              int index)
                                       throws NullPointerException,
                                              IllegalPropertyValueException,
                                              IndexOutOfBoundsException

      Description copied from interface: `TypeDefinitionRecord`

      Returns the property value of one of the fields of the given record property value, where the value to return is determined by an index into the list of fields of this record type definition.

      Specified by:
        `getValue` in interface `TypeDefinitionRecord`
      Parameters:
        `recordProperty` - Property value containing a record that is to have a value returned.
        `index` - 0-based index into the array of fields of this record type definition that is used to determine the field of the given record property value to return.
      Returns:
        Member of the given record property value selected using the given index.
      Throws:
        `NullPointerException` - The given record property value is `null`.
        `IllegalPropertyValueException` - The type of the given property value does not match this record type definition.
        `IndexOutOfBoundsException` - The given index is not within the acceptable range for this record type definition.
      See Also:
        `TypeDefinitionRecord.getValue(PropertyValue, String)`

    - #### getValue

          public final PropertyValue getValue(PropertyValue recordProperty,
                                              String memberName)
                                       throws NullPointerException,
                                              IllegalPropertyValueException,
                                              IllegalArgumentException

      Description copied from interface: `TypeDefinitionRecord`

      Returns the property value of one of the fields of the given record property value, where the value to return corresponds to the given field name.

      Specified by:
        `getValue` in interface `TypeDefinitionRecord`
      Parameters:
        `recordProperty` - Property value containing a record that is to have a value returned.
        `memberName` - Name of the field value to retrieve.
      Returns:
        Property value containing the requested field value.
      Throws:
        `NullPointerException` - One or both of the arguments is/are `null`.
        `IllegalPropertyValueException` - The type of the given property value does not match this record type definition.
        `IllegalArgumentException` - The given field name does not identify a field of this record type definition.

    - #### setObject

          public final void setObject(PropertyValue recordProperty,
                                      Object data)
                               throws NullPointerException,
                                      IllegalPropertyValueException,
                                      BadTypeException

      Description copied from interface: `TypeDefinitionRecord`

      Sets the value of the given record property value using the given Java object. The Java reflection API is used to discover if the fields of the record are readable from the given object, either as public fields or public `get...` methods. The types of the fields of the given object must be compatible with the type definitions of the matching fields in this record type definition.

      Note that the object may define more fields than the number of elements of the record. If this is the case, the record property value will contain less information than the given object. Be aware that a subsequent call to `TypeDefinitionRecord.getObject(PropertyValue)` with a record property value created by this method may result in a different object value.

      Specified by:
        `setObject` in interface `TypeDefinitionRecord`
      Parameters:
        `recordProperty` - Property value containing a record that is to have its values set.
        `data` - A Java object that is used to set the fields of the given record property value.
      Throws:
        `NullPointerException` - One or both of the arguments is/are `null`.
        `IllegalPropertyValueException` - The given object does not provide values for one or more of the record's values, or the given property value is not defined by a compatible record type definition.
        `BadTypeException` - One or more of the field types of the given object do not match or cannot be converted to the type of their equivalent property in this record type definition.
      See Also:
        `TypeDefinitionRecord.createValueFromObject(Object)`, `TypeDefinitionRecord.getObject(PropertyValue)`

    - #### setValue

          public final void setValue(PropertyValue recordProperty,
                                     int index,
                                     PropertyValue memberProperty)
                              throws NullPointerException,
                                     IllegalPropertyValueException,
                                     IndexOutOfBoundsException,
                                     BadTypeException

      Description copied from interface: `TypeDefinitionRecord`

      Sets the value of a field of the given record property value, determined by index into the list of fields of its record type definition. The field property must be of a type that is compatible with the type at the given index, as returned by `TypeDefinitionRecord.getMemberType(int)` for the same index.

      Specified by:
        `setValue` in interface `TypeDefinitionRecord`
      Parameters:
        `recordProperty` - Property value containing a record that is to have one of its fields set.
        `index` - 0-based index into the record type definition defining the given record property value. This determines the name and required type of the record field.
        `memberProperty` - Value to set as a field of the given record property value.
      Throws:
        `NullPointerException` - One or both of the property arguments is/are `null`.
        `IllegalPropertyValueException` - The type of the given property definition does not match this record type definition.
        `IndexOutOfBoundsException` - The given index is outside the range of the list of fields of this record type definition.
        `BadTypeException` - The type of the given field property value does not match that defined at the given index in the record type definition.
      See Also:
        `TypeDefinitionRecord.getValue(PropertyValue, int)`, `TypeDefinitionRecord.setValue(PropertyValue, String, PropertyValue)`

    - #### setValue

          public final void setValue(PropertyValue recordProperty,
                                     String memberName,
                                     PropertyValue memberProperty)
                              throws NullPointerException,
                                     IllegalPropertyValueException,
                                     IllegalArgumentException,
                                     BadTypeException

      Description copied from interface: `TypeDefinitionRecord`

      Sets the value of a field of the given record property value, determined by field name, to be the given field property value. The field property must be of a type that is compatible with the type of the field specified in the list of fields of this property.

      Specified by:
        `setValue` in interface `TypeDefinitionRecord`
      Parameters:
        `recordProperty` - Property value containing a record that is to have one of its fields set.
        `memberName` - Name of the field to set the value for within the given record property value.
        `memberProperty` - Value to set the field to.
      Throws:
        `NullPointerException` - One or more or the arguments is/are `null` and all are required.
        `IllegalPropertyValueException` - The type of the given record property definition does not match this record type definition.
        `IllegalArgumentException` - The field name is not known as a field of this record type definition.
        `BadTypeException` - The type of the given field property value does not match that defined for the field with given name in this record type definition.
      See Also:
        `TypeDefinitionRecord.getValue(PropertyValue, String)`, `TypeDefinitionRecord.setValue(PropertyValue, int, PropertyValue)`

    - #### createValue

          public final PropertyValue createValue(Object javaValue)
                                          throws ClassCastException

      Description copied from class: `TypeDefinitionImpl`

      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 class `TypeDefinitionImpl`
      Parameters:
        `javaValue` - 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.

    - #### createValueFromString

          public final PropertyValue createValueFromString(String content)
                                                    throws ClassCastException

      Create a record type value of this type from a string representation.

      This method expects the Java implementing class of the record type to implement a static method `parseFactory(String)` that can create an instance of the represented type from a string. This value is then passed into `createValueFromObject(Object)`.

      Parameters:
        `content` - String representation of the record value.
      Returns:
        Newly created property value based on the given string.
      Throws:
        `ClassCastException` - It was not possible to parse the string a create a value of this record type.
      See Also:
        `createValue(Object)`, `createValueFromObject(Object)`

    - #### getTypeCategory

          public final TypeCategory getTypeCategory()

      Description copied from interface: `TypeDefinition`

      Returns the type category to which this type definition belongs, which corresponds to its sub interface. For example, TypeCategory.Int is returned for a `TypeDefinitionInteger`.

      Specified by:
        `getTypeCategory` in interface `TypeDefinition`
      Specified by:
        `getTypeCategory` in class `TypeDefinitionImpl`
      Returns:
        Type category to which the type definition belongs.
      See Also:
        `TypeCategory`

    - #### createFromBytes

          public PropertyValue createFromBytes(ByteBuffer buffer)
                                        throws NullPointerException,
                                               EndOfDataException

      Description copied from interface: `TypeDefinition`

      Create a value of this type by reading the bytes in the given byte buffer. The buffer is assumed to have exactly the number of bytes that represent the value. For example, the length of a string value will be determined by the length (remaining bytes) in the buffer and not by reading a length value from the buffer.

      This method is able to read values written by the `TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer)` method.

      Specified by:
        `createFromBytes` in interface `TypeDefinition`
      Overrides:
        `createFromBytes` in class `TypeDefinitionImpl`
      Parameters:
        `buffer` - Buffer to create a value from.
      Returns:
        Value of this type created from the given byte array.
      Throws:
        `NullPointerException` - Cannot read values from a `null` buffer.
        `EndOfDataException` - Insufficient bytes remaining in the given buffer to create a value of this type.
      See Also:
        `TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer)`, `TypeDefinition.lengthAsBytes(PropertyValue)`

    - #### lengthAsBytes

          public long lengthAsBytes(PropertyValue value)
                             throws NullPointerException,
                                    IllegalPropertyValueException

      Description copied from interface: `TypeDefinition`

      Returns the number of bytes that the given value of this type is serialized as a sequence of bytes.

      The number returned by this method is the same as the number of bytes written to a byte buffer by the `TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer)` method.

      Specified by:
        `lengthAsBytes` in interface `TypeDefinition`
      Overrides:
        `lengthAsBytes` in class `TypeDefinitionImpl`
      Parameters:
        `value` - Value to find the length of when serialized to bytes.
      Returns:
        Number of bytes used to represent the given value when serialized.
      Throws:
        `NullPointerException` - Cannot compute the serialized length of a `null` value.
        `IllegalPropertyValueException` - The given property value is not of this type.
      See Also:
        `TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer)`, `TypeDefinition.createFromBytes(ByteBuffer)`

    - #### writeAsBytes

          public List<PropertyValue> writeAsBytes(PropertyValue value,
                                                  ByteBuffer buffer)
                                           throws NullPointerException,
                                                  IllegalPropertyValueException,
                                                  InsufficientSpaceException

      Description copied from interface: `TypeDefinition`

      Write the given property value of this type to the given byte stream. This version is most appropriate for writing KLV streams (MXF files).

      The format used to serialize the value with be compatible with the `TypeDefinition.createFromBytes(ByteBuffer)` method. The number of bytes written to the byte buffer will be the same as returned by `TypeDefinition.lengthAsBytes(PropertyValue)`.

      Specified by:
        `writeAsBytes` in interface `TypeDefinition`
      Overrides:
        `writeAsBytes` in class `TypeDefinitionImpl`
      Parameters:
        `value` - Value to write to the given buffer.
        `buffer` - Buffer to write the value to.
      Returns:
        List of any strongly referenced property values referenced from the new structure of bytes. Elements of this list will require separate serialization to the stream if the reference if to be resolved.
      Throws:
        `NullPointerException` - Cannot write from a `null` property value and/or to a `null` value.
        `IllegalPropertyValueException` - The given property value is not of this type.
        `InsufficientSpaceException` - Insufficient space to write the given value into the given buffer.
      See Also:
        `TypeDefinition.writeAsStructuredStorageBytes(PropertyValue, ByteBuffer)`, `TypeDefinition.createFromBytes(ByteBuffer)`, `TypeDefinition.lengthAsBytes(PropertyValue)`

    - #### writeAsStructuredStorageBytes

          public List<PropertyValue> writeAsStructuredStorageBytes(PropertyValue value,
                                                                   ByteBuffer buffer)
                                                            throws NullPointerException,
                                                                   IllegalPropertyValueException,
                                                                   InsufficientSpaceException

      Description copied from interface: `TypeDefinition`

      Write the given property value of this type to the given byte stream that is to be written to a structured storage format file.

      The number of bytes written to the byte buffer will be the same as returned by `TypeDefinition.lengthAsBytes(PropertyValue)`.

      Specified by:
        `writeAsStructuredStorageBytes` in interface `TypeDefinition`
      Overrides:
        `writeAsStructuredStorageBytes` in class `TypeDefinitionImpl`
      Parameters:
        `value` - Value to write to the given buffer.
        `buffer` - Buffer to write the value to.
      Returns:
        List of any strongly referenced property values referenced from the new structure of bytes. Elements of this list will require separate serialization to the stream if the reference if to be resolved.
      Throws:
        `NullPointerException` - Cannot write from a `null` property value and/or to a `null` value.
        `IllegalPropertyValueException` - The given property value is not of this type.
        `InsufficientSpaceException` - Insufficient space to write the given value into the given buffer.
      See Also:
        `TypeDefinition.writeAsBytes(PropertyValue, ByteBuffer)`, `TypeDefinition.lengthAsBytes(PropertyValue)`

    - #### appendMetadictXML

          public void appendMetadictXML(Node metadict,
                                        String namespace,
                                        String prefix)

      Description copied from interface: `MetaDefinition`

      Append an XML representation of this meta definition to the given XML node.

      Specified by:
        `appendMetadictXML` in interface `MetaDefinition`
      Overrides:
        `appendMetadictXML` in class `MetaDefinitionImpl`
      Parameters:
        `metadict` - Meta dictionary node to append a description of this node to.
      See Also:
        `CommonConstants.AAF_METADICT_NAMESPACE`

    - #### clone

          public TypeDefinitionRecord clone()

      Description copied from interface: `MetaDefinition`

      Create a cloned copy of this meta definition.

      Specified by:
        `clone` in interface `MetaDefinition`
      Specified by:
        `clone` in interface `TypeDefinition`
      Specified by:
        `clone` in interface `TypeDefinitionRecord`
      Overrides:
        `clone` in class `TypeDefinitionImpl`
      Returns:
        Cloned copy of this meta definition.

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.