|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TypeDefinitionInteger
Specifies the definition of a property type that is an integer with the specified number of bytes.
The representation of integers in the MAJ API is explained in the
description of the integer package. The
methods of this class cast values of subclasses of Number
to values
of Java type used to represent an integer value, as described in the
type mapping table.
The methods here are specified in such a way that rounding or truncations errors should
be avoidable
makeTypeDefinitionInteger()
,
TypeCategory.Int
,
Int32
,
UInt8
Method Summary | |
---|---|
PropertyValue |
createValueFromNumber(Number value)
Creates a property value as defined by this integer type definition using the given number. |
Number |
getInteger(PropertyValue integerProperty)
Returns the value of the given integer property value as a Number . |
byte |
getSize()
Returns the size of integral value of the integer type definition, measured in number of bytes. |
boolean |
isSigned()
Returns true if the integer type definition
defines signed integer values; otherwise false . |
void |
setInteger(PropertyValue integerProperty,
Number value)
Convert the given number value to one appropriate for this integer type definition and set the value of the given integer property value to be the converted value. |
Methods inherited from interface tv.amwa.maj.iface.TypeDefinition |
---|
createValue, getTypeCategory |
Methods inherited from interface tv.amwa.maj.iface.MetaDefinition |
---|
getAUID, getDescription, getName, setDescription, setName |
Method Detail |
---|
PropertyValue createValueFromNumber(Number value) throws NullPointerException, BadSizeException, IllegalArgumentException
Creates a property value as defined by this integer type definition using the given number. The given number will he cast to a value that fits with this integer type definition.
It is possible that the given Java value cannot be converted to
a value compatible with this integer type definition. If this is the
case, an IllegalArgumentException
is thrown. Conversion may not be
possible for the following reasons:
float
, double
or
BigDecimal
that includes decimal part to its value that
would require rounding as part of the conversion.getSize()
.
Conversion will require truncation of the value.To specifically cause truncation or rounding to take place, perform an appropriate cast before calling this method.
A BadSizeException
may also be thrown if the given value is
a BigInteger
or BigDecimal
value as an implementation
is not required to support values greater than 8-bytes in length.
value
- Value to create a new integer property value from.
NullPointerException
- The given number value is null
.
IllegalArgumentException
- Due to its value, the given value cannot
be converted to a property value defined by this integer type definition.
BadSizeException
setInteger(PropertyValue, Number)
Number getInteger(PropertyValue integerProperty) throws NullPointerException, IllegalPropertyValueException
Returns the value of the given integer property value as
a Number
. This value can then be converted
to the required type by calling
Number.intValue()
, Number.byteValue()
etc..
integerProperty
- Property value of integer type.
java.lang
package, e.g. Byte
,
Integer
etc..
NullPointerException
- The given integer property value is null
.
IllegalPropertyValueException
- The given integer property value
is not as defined by this integer type definition.void setInteger(PropertyValue integerProperty, Number value) throws NullPointerException, BadSizeException, IllegalPropertyValueException, IllegalArgumentException
Convert the given number value to one appropriate for this integer type definition and set the value of the given integer property value to be the converted value. This method can make use of Java's autoboxing features.
It is possible that the given Java value cannot be converted to
a value compatible with the integer type definition. If this is the
case, an IllegalArgumentException
is thrown. Conversion may not be
possible for the following reasons:
float
, double
or
BigDecimal
that includes decimal part to its value that
would require rounding as part of the conversion.getSize()
.
Conversion will require truncation of the value.To specifically cause truncation or rounding to take place, perform an appropriate cast before calling this method.
integerProperty
- Property value to set the value of.value
- Value to set for the given integer property value to.
NullPointerException
- One or both of the integer property value and/or number
value arguments is/are null
.
IllegalPropertyValueException
- The given property value is not compatible
with this integer type definition.
IllegalArgumentException
- Due to its value, the given value cannot
be converted to a property value defined by the integer type definition.
BadSizeException
createValueFromNumber(Number)
@UInt8 byte getSize()
Returns the size of integral value of the integer type definition, measured in number of bytes.
@Bool boolean isSigned()
Returns true
if the integer type definition
defines signed integer values; otherwise false
.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |