org.w3c.ddr.simple
Interface PropertyValue


public interface PropertyValue

Represents the value of a property.

NOTE: The underlying data type of a property is determined by its vocabulary. The programmatic determination of a property type from a vocabulary is out of scope for this API. Therefore, the only practical way to determine the appropriate getX() method for an arbitrary instance supporting this interface is to obtain the name details via the getPropertyRef() method and compare the property information against externally available vocabulary information. Under the normal use cases for this API, the usage of an instance supporting this interface will be such that the data type is already known, and the developer will take steps to use the appropriate getX() method.

Author:
Jo Rabin (dotMobi),
Jose Manuel Cantera Fonseca (Telefonica I+D),
Rotan Hanrahan (MobileAware),
Ignacio Marin (Fundacion CTIC)
Copyright © 2008 W3C® (MIT, ERCIM, Keio), All Rights Reserved.
W3C liability, trademark and document use rules apply.

Method Summary
 boolean exists()
          Returns 'true' only if a value is available from the repository.
Returns 'false' if a value is not available from the repository.

If this method returns 'true', then the getX() methods will return valid data if type X is appropriate to the data stored in the repository.
 boolean getBoolean()
          Returns the Boolean value of the property.
 double getDouble()
          Returns the double value of the property, in the default units specified in its vocabulary.
 java.lang.String[] getEnumeration()
          Returns the value of the property as a list of strings.
 float getFloat()
          Returns the float value of the property, in the default units specified in its vocabulary.
 int getInteger()
          Returns the integer value of the property, in the default units specified in its vocabulary.
 long getLong()
          Returns the long value of the property, in the default units specified in its vocabulary.
 PropertyRef getPropertyRef()
          Returns the PropertyRef that identifies the property to which this PropertyValue instance applies.
 java.lang.String getString()
          Returns the string value of the property, or a string version of the property.
 

Method Detail

getDouble

double getDouble()
                 throws ValueException
Returns the double value of the property, in the default units specified in its vocabulary.

Returns:
the double value of the property
Throws:
ValueException - MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a double according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.

getLong

long getLong()
             throws ValueException
Returns the long value of the property, in the default units specified in its vocabulary.

Returns:
the long value of the property
Throws:
ValueException - MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a long according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.

getBoolean

boolean getBoolean()
                   throws ValueException
Returns the Boolean value of the property.

Returns:
the Boolean value of the property
Throws:
ValueException - MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a Boolean according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.

getInteger

int getInteger()
               throws ValueException
Returns the integer value of the property, in the default units specified in its vocabulary.

Returns:
the integer value of the property
Throws:
ValueException - MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not an integer according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.

getEnumeration

java.lang.String[] getEnumeration()
                                  throws ValueException
Returns the value of the property as a list of strings.

Returns:
the value of the property as a list of strings
Throws:
ValueException - MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not an enumeration according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.

getFloat

float getFloat()
               throws ValueException
Returns the float value of the property, in the default units specified in its vocabulary.

Returns:
the float value of the property
Throws:
ValueException - MUST be thrown (with code ValueException.INCOMPATIBLE_TYPES) if the property is not a float according to its vocabulary definition, or (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.

getPropertyRef

PropertyRef getPropertyRef()
Returns the PropertyRef that identifies the property to which this PropertyValue instance applies.

Returns:
The corresponding PropertyRef instance.

getString

java.lang.String getString()
                           throws ValueException
Returns the string value of the property, or a string version of the property.

Returns:
The string value of the property or an implementation-specific string version of the property if the underlying data type is not a string.
Throws:
ValueException - MUST be thrown (with code ValueException.NOT_KNOWN) if the the value is not known to the implementation.

exists

boolean exists()
Returns 'true' only if a value is available from the repository.
Returns 'false' if a value is not available from the repository.

If this method returns 'true', then the getX() methods will return valid data if type X is appropriate to the data stored in the repository. If this method returns 'false', an attempt to retrieve a value via a getX() method (other than getString) will cause a ValueException (with code ValueException.NOT_KNOWN) to be thrown.

Returns:
The value 'true' if a value for the property is known in the repository, or 'false' otherwise.