|
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.meta.MetaDefinition
tv.amwa.maj.meta.TypeDefinition
tv.amwa.maj.meta.TypeDefinitionString
@AAFClass(uuid1=218169601,
uuid2=523,
uuid3=0,
uuid4={6,14,43,52,2,6,1,1},
definedName="TypeDefinitionString",
description="The TypeDefinitionString class defines a property type that consists of a zero-terminated array of the underlying character or integer type.")
public final class TypeDefinitionString
Implements the definition of a property type that consists, effectively, of an array of the underlying character or integer type. In the MAJ API, all strings are represented as Java strings.
THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.
| Nested Class Summary | |
|---|---|
static class |
TypeDefinitionString.BaseStringValue
Base representation for all property values representing string values. |
static class |
TypeDefinitionString.ByteArrayStringValue
Property value for strings with an underlying element type of TypeDefinitionInteger. |
static class |
TypeDefinitionString.CharacterStringValue
Property value for strings with an underlying element type of TypeDefinitionCharacter. |
static class |
TypeDefinitionString.XMLHandler
|
| Field Summary | |
|---|---|
static TypeDefinitionString |
String
|
| Constructor Summary | |
|---|---|
TypeDefinitionString(AUID identification,
String typeName,
TypeDefinition typeDefinition)
Creates and initializes the string type definition with its identity and the underlying data representation. |
|
| Method Summary | |
|---|---|
void |
appendElements(PropertyValue stringProperty,
Buffer elements)
Append to the string value of the given property value using a data buffer. |
void |
appendElements(PropertyValue stringProperty,
PropertyValue[] elements)
Append to the string value of the given property value using the array of property value elements. |
void |
appendString(PropertyValue stringProperty,
Buffer extension)
Appends the given data buffer to the string of the given property value. |
void |
appendString(PropertyValue stringProperty,
String extension)
Appends the given Java String to the string of the given property value. |
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 javaValue)
Create a property value from the given Java object. |
PropertyValue |
createValueFromString(Buffer initData)
Create a new string type property value consistent with this type definition from the given data buffer. |
PropertyValue |
createValueFromString(String initData)
Create a new string type property value consistent with this type definition from the given Java string. |
boolean |
deepEquals(Object o)
Check to see if this definition is equal to the given object by comparing each property. |
String |
getCharacterSet()
Returns the character set that will be used for conversion between a Java string and this string type definition. |
int |
getCount(PropertyValue stringProperty)
Returns the length of the string contained in the given string property value, measured in the number of characters. |
Buffer |
getElements(PropertyValue stringProperty)
Returns the value of the given string property as a data buffer consistent with the element type of this string type definition. |
TypeDefinition |
getElementType()
Returns the underlying AAF type used to represent characters of a string of this string type definition. |
PropertyValue[] |
getPropertyValues(PropertyValue stringProperty)
Returns the value of the given string property as an array of property values of a compatible type to the string type definition, as returned by TypeDefinitionString.getElementType(). |
String |
getString(PropertyValue stringProperty)
Returns the value of the given string property as a Java string. |
TypeCategory |
getTypeCategory()
Returns the type category to which this type definition belongs, which corresponds to its sub interface. |
void |
setCharacterSet(String charSet)
Set the character set that will be used for conversion between a Java string and this string type definition. |
void |
setPropertiesFromInterface(TypeDefinitionString castFrom)
|
void |
setString(PropertyValue stringProperty,
Buffer data)
Set the value of the string contained in the given string property value to the given data buffer. |
void |
setString(PropertyValue stringProperty,
String data)
Set the value of the string contained in the given string property value to the given Java string value. |
| Methods inherited from class tv.amwa.maj.meta.TypeDefinition |
|---|
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.MetaDefinition |
|---|
getAUID, getDescription, getName, setDescription, setName |
| Methods inherited from interface tv.amwa.maj.meta.MAJCommon |
|---|
equals, hashCode, toString |
| Field Detail |
|---|
public static final TypeDefinitionString String
| Constructor Detail |
|---|
public TypeDefinitionString(AUID identification,
@AAFString
String typeName,
TypeDefinition typeDefinition)
throws NullPointerException,
IllegalArgumentException
Creates and initializes the string type definition with its identity and the underlying data representation. Acceptable underlying type definitions are:
It is anticipated that most Java versions of this interface will be
choose TypeDefinitionCharacter and will use Java string handling
in their implementation. However, by using a call to setCharacterSet(String)
it is possible to define mappings between different character sets to and
from Java strings.
Creating new and unregistered type definitions is not recommended as this may cause
interoperability issues with other systems. 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
AAFFactory.typeDefinitionForName(String) or
AAFFactory.typeDefinitionForIdentification(tv.amwa.maj.record.AUID)
respectively.
identification - AUID to be used to identify this type.typeName - Friendly name for the string data type.typeDefinition - Type of each element to be contained in the array.
NullPointerException - The identification and/or type definition arguments is/are
null.
IllegalArgumentException - The given type is not an acceptable underlying
type for a string type definition.| Method Detail |
|---|
public final void setPropertiesFromInterface(TypeDefinitionString castFrom)
MetaDefinition.setPropertiesFromInterface(tv.amwa.maj.iface.MetaDefinition)
public void appendElements(PropertyValue stringProperty,
PropertyValue[] elements)
throws NullPointerException,
IllegalPropertyValueException,
BadTypeException,
BadSizeException
TypeDefinitionStringAppend to the string value of the given property value using
the array of property value elements. Each
element of the given array must match the type definition returned
by TypeDefinitionString.getElementType().
appendElements in interface TypeDefinitionStringstringProperty - Property value containing a string to be
extended.elements - Array of property value elements to use to extend
the given string.
NullPointerException - One or both of the arguments is/are null, or
one or more of the values of the given array is null.
IllegalPropertyValueException - The given string property value is not
of this string type definition.
BadTypeException - One or more of the elements of the given array
of property values is of an incompatible type.
BadSizeException - The number of bytes per integer of the underlying element
type of this string type definition is not supported by this implementation.TypeDefinitionString.appendElements(PropertyValue, Buffer),
TypeDefinitionString.appendString(PropertyValue, String)
public void appendElements(PropertyValue stringProperty,
Buffer elements)
throws NullPointerException,
IllegalArgumentException,
IllegalPropertyValueException
TypeDefinitionStringAppend to the string value of the given property value using
a data buffer. Any character set conversion required takes place using the
character set returned by TypeDefinitionString.getCharacterSet(). An attempt to
pass in a null buffer will result in no change to the property
value and no error.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException.
This method has the same behaviour as TypeDefinitionString.appendString(PropertyValue, Buffer).
appendElements in interface TypeDefinitionStringstringProperty - Property value containing a string value
to append the given elements to.elements - Buffer containing values to be appended to to
the given property value.
NullPointerException - The given string property argument is null.
IllegalArgumentException - The given buffer must be of an appropriate type
for conversion to the underlying element type for this string type definition.
IllegalPropertyValueException - The given string property type does not match this
type definition.TypeDefinitionString.appendElements(PropertyValue, PropertyValue[]),
TypeDefinitionString.appendString(PropertyValue, String)
public int getCount(PropertyValue stringProperty)
throws NullPointerException,
IllegalPropertyValueException
TypeDefinitionStringReturns the length of the string contained in the given string property value, measured in the number of characters.
getCount in interface TypeDefinitionStringstringProperty - Property value containing a string to determine
the length of.
NullPointerException - The given string property value is null.
IllegalPropertyValueException - The given string property value type does not match
this string type definition.String.length()
public Buffer getElements(PropertyValue stringProperty)
throws NullPointerException,
IllegalPropertyValueException,
BadSizeException
TypeDefinitionStringReturns the value of the given string property as a data buffer
consistent with the element type of this string type definition.
Any character set conversion required takes place using the
character set returned by TypeDefinitionString.getCharacterSet(). If the internal
representation of the string property value is null then
this method will return null.
Note that a null character will not be inserted as the last
byte of the buffer.
getElements in interface TypeDefinitionStringstringProperty - Property value containing the string to convert.
NullPointerException - The given string property value is null.
IllegalPropertyValueException - The given string property type does not match
this string property value.
BadSizeException - The number of bytes per integer of the underlying element type of this
string type definition is not supported by this implementation.TypeDefinitionString.setString(PropertyValue, Buffer),
TypeDefinitionString.getString(PropertyValue)
public String getString(PropertyValue stringProperty)
throws NullPointerException,
IllegalPropertyValueException
TypeDefinitionStringReturns the value of the given string property as a Java string.
getString in interface TypeDefinitionStringstringProperty - Property value containing the string to convert.
null string.
NullPointerException - The given string property value is null.
IllegalPropertyValueException - The given string property is not of
this string type definition.
public PropertyValue[] getPropertyValues(PropertyValue stringProperty)
throws NullPointerException,
IllegalPropertyValueException,
BadSizeException
TypeDefinitionStringReturns the value of the given string property as an array of
property values of a compatible type to the
string type definition, as returned by TypeDefinitionString.getElementType().
getPropertyValues in interface TypeDefinitionStringstringProperty - Property value containing the string to convert.
NullPointerException - The given string property value is null.
IllegalPropertyValueException - The type of the given string property value does not match this
string type definition.
BadSizeException - The number of bytes per integer of the underlying element type of this
string type definition is not supported by this implementation.TypeDefinitionString.appendElements(PropertyValue, PropertyValue[])
@AAFProperty(uuid1=100729095,
uuid2=3840,
uuid3=0,
uuid4={6,14,43,52,1,1,1,2},
definedName="ElementType",
typeName="WeakReference to TypeDefinition",
optional=false,
uniqueIdentifier=false,
pid=27)
public TypeDefinition getElementType()
TypeDefinitionStringReturns the underlying AAF type used to represent characters of a string of this string type definition.
getElementType in interface TypeDefinitionString
public void appendString(PropertyValue stringProperty,
String extension)
throws NullPointerException,
IllegalPropertyValueException
TypeDefinitionStringAppends the given Java String to the string of the given
property value. Any character set conversion required takes place using the
character set returned by TypeDefinitionString.getCharacterSet(). An attempt to
pass a null string will result in no change to the property
value and no error.
appendString in interface TypeDefinitionStringstringProperty - Property value containing the string to extend.extension - String to append to the end of the given property
value.
NullPointerException - The given string property argument is null.
IllegalPropertyValueException - The given string property value type does not match
this string type definition.TypeDefinitionString.appendString(PropertyValue, Buffer),
TypeDefinitionString.appendElements(PropertyValue, PropertyValue[])public PropertyValue createValueFromString(String initData)
TypeDefinitionStringCreate a new string type property value consistent with
this type definition from the given Java string. Conversion to
the underlying character type takes place according to the
character set returned by TypeDefinitionString.getCharacterSet(). Setting
a null value will result in the return of a property
value with its internal string representation set to
null.
createValueFromString in interface TypeDefinitionStringinitData - Initial string data to create a new string
property value.
TypeDefinitionString.createValueFromString(Buffer)
public PropertyValue createValueFromString(Buffer initData)
throws IllegalArgumentException
TypeDefinitionStringCreate a new string type property value consistent with
this type definition from the given data buffer. Any character
set conversion required takes place using the
character set returned by TypeDefinitionString.getCharacterSet(). Setting
a null value will result in the return of a property
value with its internal string representation set to
null.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException.
createValueFromString in interface TypeDefinitionStringinitData - Initial string data to use to create a new string
property value.
IllegalArgumentException - The given buffer must be of an appropriate type for
conversion to the underlying element type for this string type definition.TypeDefinitionString.createValueFromString(Buffer)public String getCharacterSet()
TypeDefinitionStringReturns the character set that will be used for conversion between a Java
string and this string type definition. If a character
set has not been provided by a user then the value returned will be the default
Java character set of "UTF-16".
getCharacterSet in interface TypeDefinitionStringCharset
public void setCharacterSet(String charSet)
throws NullPointerException,
IllegalCharsetNameException
TypeDefinitionStringSet the character set that will be used for conversion between a Java string and this string type definition. For information on valid character set names, see the relevant Java API documentation.
setCharacterSet in interface TypeDefinitionStringcharSet - Character set used for conversion between this string type and Java strings.
NullPointerException - The given character set name is null.
IllegalCharsetNameExceptionCharset
public void setString(PropertyValue stringProperty,
String data)
throws NullPointerException,
IllegalPropertyValueException
TypeDefinitionStringSet the value of the string contained in the given
string property value to the given Java
string value. Any character set conversion required takes place using the
character set returned by TypeDefinitionString.getCharacterSet(). Setting
a null value will result in the return of a property
value with its internal string representation set to
null.
setString in interface TypeDefinitionStringstringProperty - Property value to have its string value set.data - Value to set for the string type property value, represented
as a Java String.
NullPointerException - The given string property value is null.
IllegalPropertyValueException - The given string property type does not match
this string type definition.TypeDefinitionString.getString(PropertyValue),
TypeDefinitionString.setString(PropertyValue, Buffer)
public void setString(PropertyValue stringProperty,
Buffer data)
throws NullPointerException,
IllegalPropertyValueException,
IllegalArgumentException
TypeDefinitionStringSet the value of the string contained in the given
string property value to the given data buffer.
Any character set conversion required takes place using the
character set returned by TypeDefinitionString.getCharacterSet(). Setting
a null value will result in the return of a property
value with its internal string representation set to
null.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException.
setString in interface TypeDefinitionStringstringProperty - Property value to have its string value set.data - Value to set for the string type property value, represented
as a data buffer.
NullPointerException - The given string property is null.
IllegalPropertyValueException - The given string property type does not match
this string type definition.
IllegalArgumentException - The given buffer must be of an appropriate type for
conversion to the underlying element type for this string type definition.TypeDefinitionString.getElements(PropertyValue),
TypeDefinitionString.setString(PropertyValue, String)
public void appendString(PropertyValue stringProperty,
Buffer extension)
throws NullPointerException,
IllegalArgumentException,
IllegalPropertyValueException
TypeDefinitionStringAppends the given data buffer to the string of the given
property value. Any character set conversion required takes place using the
character set returned by TypeDefinitionString.getCharacterSet(). An attempt to
pass a null buffer will result in no change to the property
value and no error.
The buffer of data must be one of the following types:
Any other buffer types will result in an IllegalArgumentException.
This method has the same behaviour as TypeDefinitionString.appendElements(PropertyValue, Buffer).
appendString in interface TypeDefinitionStringstringProperty - Property value containing the string to extend.extension - Buffer of string data to use to extend the given property value.
NullPointerException - The given string property value is null.
IllegalArgumentException - The given buffer must be of an appropriate type for
conversion to the underlying element type for this string type definition.
IllegalPropertyValueException - The given string property value type does not match
this string type definition.TypeDefinitionString.appendElements(PropertyValue, PropertyValue[]),
TypeDefinitionString.appendString(PropertyValue, String)public TypeCategory getTypeCategory()
TypeDefinitionReturns the type category to which this type definition belongs, which
corresponds to its sub interface. For example, TypeCategory.Int
is returned for a TypeDefinitionInteger.
getTypeCategory in interface TypeDefinitiongetTypeCategory in class TypeDefinitionTypeCategorypublic final boolean deepEquals(Object o)
MetaDefinitionCheck 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.
deepEquals in class MetaDefinitiono - Object to compare to this definition.
public PropertyValue createValue(Object javaValue)
throws ClassCastException
TypeDefinitionCreate 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.
createValue in interface TypeDefinitioncreateValue in class TypeDefinitionjavaValue - Java object to use to create a property value of this type.
ClassCastException - The given object cannot be cast to a property value with
this type definition.public void appendXMLChildren(Node parent)
XMLSerializableAppend 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 XMLSerializableappendXMLChildren in class MetaDefinitionparent - 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 | |||||||