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

tv.amwa.maj.meta

## Interface TypeDefinitionEnumeration

- All Superinterfaces:
    MetadataObject, MetaDefinition, TypeDefinition, WeakReferenceTarget
  All Known Implementing Classes:
    TypeDefinitionEnumerationImpl

      public interface TypeDefinitionEnumeration
      extends TypeDefinition

  Specifies the definition of a property type that can have one of a set of integer values. Every element in the set has both an integer value and a string label. The enumeration type is equivalent to the Java `Enum` type.

  See Also:
    `TypeCategory.Enum`, `Enum`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `TypeDefinitionEnumeration` | `clone()` Create a cloned copy of this enumeration type definition.
    `int` | `countElements()` Returns the number of enumeration elements contained in the list of elements of this enumeration type definition.
    `PropertyValue` | `createValueFromName(String name)` Creates and returns an enumeration property value of this enumeration type using the given enumeration element name.
    `PropertyValue` | `createValueFromOrdinal(Number ordinal)` Creates and returns an enumeration property value of this enumeration type using the given enumeration element value.
    `String` | `getElementName(int index)` Returns the name of the enumeration element at the given index into the list of elements of this enumeration type definition.
    `TypeDefinition` | `getElementType()` Returns the type definition of the integer values that are found in this enumeration.
    `long` | `getElementValue(int index)` Returns the integer value associated with the enumeration element at the given index in the list of elements of this enumeration type definition.
    `Class<Enum<?>>` | `getEnumeration()` Returns the `Enum` Java type associated with this enumeration type definition.
    `long` | `getIntegerValue(PropertyValue enumerationProperty)` Returns the integer value associated with the given enumeration property value as defined by this enumeration type definition.
    `String` | `getNameFromInteger(long value)` Returns the name element with the given integer in this enumeration type definition.
    `String` | `getNameFromValue(PropertyValue value)` Returns the name associated with the given enumeration property value as defined by this enumeration type definition.

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

      `createFromBytes, createValue, getPropertyValue, getTypeCategory, lengthAsBytes, resolveReferences, setPropertyValue, writeAsBytes, writeAsStructuredStorageBytes`

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

      `appendMetadictXML, 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`

- - ### Method Detail

    - #### createValueFromName

          PropertyValue createValueFromName(@AAFString
                                            String name)
                                     throws NullPointerException,
                                            InvalidParameterException

      Creates and returns an enumeration property value of this enumeration type using the given enumeration element name.

      Parameters:
        `name` - Name of an enumeration element to create a property value for.
      Returns:
        Newly created property value element set to the given element name.
      Throws:
        `NullPointerException` - The given element name is `null`.
        `InvalidParameterException` - The given name is not in the list of element names for this enumeration type.
      See Also:
        `createValueFromOrdinal(Number)`

    - #### createValueFromOrdinal

          PropertyValue createValueFromOrdinal(Number ordinal)
                                        throws NullPointerException,
                                               InvalidParameterException

      Creates and returns an enumeration property value of this enumeration type using the given enumeration element value.

      Parameters:
        `ordinal` - Element value to create a property value for.
      Returns:
        Newly created property value element set to the given element value.
      Throws:
        `NullPointerException` - The given element value is `null`.
        `InvalidParameterException` - The given name is not in the list of element values for this enumeration type.
      See Also:
        `createValueFromName(String)`

    - #### getElementType

          TypeDefinition getElementType()

      Returns the type definition of the integer values that are found in this enumeration. For data types created using the MAJ API, this is always an `Int32`.

      Returns:
        Type definition of the integer values that are found in this enumeration.
      See Also:
        `TypeDefinitionInteger`

    - #### getElementValue

          @UInt64
          long getElementValue(@UInt32
                                       int index)
                                throws IndexOutOfBoundsException

      Returns the integer value associated with the enumeration element at the given index in the list of elements of this enumeration type definition.

      Parameters:
        `index` - 0-based index of the integer value to retrieve from the list of elements of this enumeration type definition.
      Returns:
        Integer value of the element at this given index into the enumeration type definition.
      Throws:
        `IndexOutOfBoundsException` - The given index is outside the acceptable range for the enumeration type definition.

    - #### getElementName

          @AAFString
          String getElementName(@UInt32
                                           int index)
                                    throws IndexOutOfBoundsException

      Returns the name of the enumeration element at the given index into the list of elements of this enumeration type definition.

      Parameters:
        `index` - 0-based index of the name to retrieve from the list of elements of this enumeration type definition.
      Returns:
        Name of the enumeration element at the given index in the list of elements of this enumeration type definition.
      Throws:
        `IndexOutOfBoundsException`

    - #### countElements

          @UInt32
          int countElements()

      Returns the number of enumeration elements contained in the list of elements of this enumeration type definition.

      Returns:
        Number of enumeration elements contained in this enumeration type definition.

    - #### getNameFromValue

          @AAFString
          String getNameFromValue(PropertyValue value)
                                      throws NullPointerException,
                                             IllegalPropertyValueException

      Returns the name associated with the given enumeration property value as defined by this enumeration type definition.

      Parameters:
        `value` - Enumeration property value to find the name of.
      Returns:
        Name associated with the given enumeration property definition according to this enumeration type definition.
      Throws:
        `NullPointerException` - The given property value is `null`.
        `IllegalPropertyValueException` - The given property value is not a value of this enumeration property type.

    - #### getNameFromInteger

          @AAFString
          String getNameFromInteger(@Int64
                                               long value)
                                        throws IllegalPropertyValueException

      Returns the name element with the given integer in this enumeration type definition.

      Parameters:
        `value` - Integer value associated with an enumeration element.
      Returns:
        Name of the element with the given integer in this enumeration type definition.
      Throws:
        `IllegalPropertyValueException` - The given value is not associated with an enumeration element in this enumeration type definition.

    - #### getIntegerValue

          @Int64
          long getIntegerValue(PropertyValue enumerationProperty)
                               throws NullPointerException,
                                      IllegalPropertyValueException

      Returns the integer value associated with the given enumeration property value as defined by this enumeration type definition.

      Parameters:
        `enumerationProperty` - Enumeration property value to find the associated integer for.
      Returns:
        Integer value associated with the given property value as defined by this enumeration type definition.
      Throws:
        `NullPointerException` - The given enumeration property is `null`.
        `IllegalPropertyValueException` - The given property value is not defined by the enumeration type definition.

    - #### getEnumeration

          Class<Enum<?>> getEnumeration()

      Returns the `Enum` Java type associated with this enumeration type definition.

      Returns:
        Java enumeration associated with this type definition.

    - #### clone

          TypeDefinitionEnumeration clone()

      Create a cloned copy of this enumeration type definition.

      Specified by:
        `clone` in interface `MetaDefinition`
      Specified by:
        `clone` in interface `TypeDefinition`
      Returns:
        Cloned copy of this enumeration type definition.

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