org.tmapi.core
Interface DatatypeAware

All Superinterfaces:
Construct, Reifiable, Scoped
All Known Subinterfaces:
Occurrence, Variant

public interface DatatypeAware
extends Reifiable, Scoped

Common base interface for Occurrences and Variants.

Some convenience methods for a subset of XML Schema Part 2: Datatypes are supported.

Version:
$Rev: 124 $ - $Date: 2009-10-01 19:21:27 +0200 (Do, 01 Okt 2009) $
Author:
The TMAPI Project

Method Summary
 java.math.BigDecimal decimalValue()
          Returns the BigDecimal representation of the value.
 float floatValue()
          Returns the float representation of the value.
 Locator getDatatype()
          Returns the Locator identifying the datatype of the value.
 java.lang.String getValue()
          Returns the lexical representation of the value.
 java.math.BigInteger integerValue()
          Returns the BigInteger representation of the value.
 int intValue()
          Returns the int representation of the value.
 Locator locatorValue()
          Returns the Locator representation of the value.
 long longValue()
          Returns the long representation of the value.
 void setValue(java.math.BigDecimal value)
          Sets the decimal value.
 void setValue(java.math.BigInteger value)
          Sets the integer value.
 void setValue(float value)
          Sets the float value.
 void setValue(int value)
          Sets the int value.
 void setValue(Locator value)
          Sets the IRI value.
 void setValue(long value)
          Sets the long value.
 void setValue(java.lang.String value)
          Sets the string value.
 void setValue(java.lang.String value, Locator datatype)
          Sets the string value and the datatype.
 
Methods inherited from interface org.tmapi.core.Reifiable
getReifier, setReifier
 
Methods inherited from interface org.tmapi.core.Scoped
addTheme, getScope, removeTheme
 
Methods inherited from interface org.tmapi.core.Construct
addItemIdentifier, equals, getId, getItemIdentifiers, getParent, getTopicMap, hashCode, remove, removeItemIdentifier
 

Method Detail

getDatatype

Locator getDatatype()
Returns the Locator identifying the datatype of the value.

Returns:
The datatype of this construct (never null).

getValue

java.lang.String getValue()
Returns the lexical representation of the value.

For the datatype xsd:string the string itself is returned. For the datatype xsd:anyURI the Locator.getReference() is returned.

Returns:
The lexical representation of the value (never null).

setValue

void setValue(java.lang.String value)
              throws ModelConstraintException
Sets the string value. This method sets the datatype implicitly to xsd:string.

Parameters:
value - The string value.
Throws:
ModelConstraintException - In case the value is null.

setValue

void setValue(Locator value)
              throws ModelConstraintException
Sets the IRI value.

This method sets the datatype implicitly to xsd:anyURI.

Parameters:
value - The IRI value.
Throws:
ModelConstraintException - In case the value is null.

setValue

void setValue(java.lang.String value,
              Locator datatype)
              throws ModelConstraintException
Sets the string value and the datatype.

Parameters:
value - The string value.
datatype - The value's datatype.
Throws:
ModelConstraintException - In case the value or datatype is null.

setValue

void setValue(java.math.BigDecimal value)
              throws ModelConstraintException
Sets the decimal value.

This method sets the datatype implicitly to xsd:decimal.

Parameters:
value - The decimal value.
Throws:
ModelConstraintException - In case the value is null.

setValue

void setValue(java.math.BigInteger value)
              throws ModelConstraintException
Sets the integer value.

This method sets the datatype implicitly to xsd:integer.

Parameters:
value - The integer value.
Throws:
ModelConstraintException - In case the value is null.

setValue

void setValue(long value)
Sets the long value.

This method sets the datatype implicitly to xsd:long.

Parameters:
value - The integer value.

setValue

void setValue(float value)
Sets the float value.

This method sets the datatype implicitly to xsd:float.

Parameters:
value - The float value.

setValue

void setValue(int value)
Sets the int value.

This method sets the datatype implicitly to xsd:int.

Parameters:
value - The int value.

intValue

int intValue()
Returns the int representation of the value.

Returns:
An int representation of the value.
Throws:
java.lang.NumberFormatException - If the value cannot be represented as a int.

integerValue

java.math.BigInteger integerValue()
Returns the BigInteger representation of the value.

Returns:
A BigInteger representation of the value.
Throws:
java.lang.NumberFormatException - If the value cannot be represented as a BigInteger instance.

floatValue

float floatValue()
Returns the float representation of the value.

Returns:
A float representation of the value.
Throws:
java.lang.NumberFormatException - If the value cannot be represented as a float.

decimalValue

java.math.BigDecimal decimalValue()
Returns the BigDecimal representation of the value.

Returns:
A BigDecimal representation of the value.
Throws:
java.lang.NumberFormatException - If the value cannot be represented as a BigDecimal instance.

longValue

long longValue()
Returns the long representation of the value.

Returns:
A long representation of the value.
Throws:
java.lang.NumberFormatException - If the value cannot be represented as a long.

locatorValue

Locator locatorValue()
Returns the Locator representation of the value.

Returns:
A Locator representation of the value.
Throws:
java.lang.IllegalArgumentException - If the value cannot be represented as a Locator instance.