SMILA API documentation

org.eclipse.smila.datamodel.impl
Class ValueImpl

java.lang.Object
  extended by org.eclipse.smila.datamodel.impl.AbstractAny
      extended by org.eclipse.smila.datamodel.impl.ValueImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Any>, Any, Value

public final class ValueImpl
extends AbstractAny
implements Value

Any holding a value.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.smila.datamodel.Any
Any.ValueType
 
Field Summary
 
Fields inherited from class org.eclipse.smila.datamodel.impl.AbstractAny
_valueType
 
Method Summary
 java.lang.Boolean asBoolean()
          
 java.util.Date asDate()
          
 java.util.Date asDateTime()
          
 java.lang.Double asDouble()
          
 java.lang.Long asLong()
          
 java.lang.String asString()
          
 Value asValue()
          returns this Any as an Value object or throws an InvalidValueTypeException.
 boolean equals(java.lang.Object obj)
          
 java.lang.Object getObject()
          
 int hashCode()
          
 boolean isEmpty()
          
 java.util.Iterator<Any> iterator()
          
 int size()
          
 java.lang.String toString()
          
 
Methods inherited from class org.eclipse.smila.datamodel.impl.AbstractAny
asMap, asSeq, getFactory, getValueType, isBoolean, isDate, isDateTime, isDouble, isLong, isMap, isNumber, isSeq, isString, isValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.smila.datamodel.Any
asMap, asSeq, getFactory, getValueType, isBoolean, isDate, isDateTime, isDouble, isLong, isMap, isNumber, isSeq, isString, isValue
 

Method Detail

asDouble

public java.lang.Double asDouble()

Specified by:
asDouble in interface Value
Returns:
The double representation, an InvalidValueTypeException is thrown if the value is not a number. If value is a string then this is tried to be converted to a Double.

asLong

public java.lang.Long asLong()

Specified by:
asLong in interface Value
Returns:
The long representation, an InvalidValueTypeException is thrown if the value is not a number. If value is a string then this is tried to be converted to a Long.

asBoolean

public java.lang.Boolean asBoolean()

Specified by:
asBoolean in interface Value
Returns:
The boolean representation, an InvalidValueTypeException is thrown if the value is not of type boolean. If value is a string then this is tried to be converted to a boolean.

asDate

public java.util.Date asDate()

Specified by:
asDate in interface Value
Returns:
The date representation, an InvalidValueTypeException is thrown if the value is not of type date or datetime. If value is a string then this is tried to be converted to a date.

asDateTime

public java.util.Date asDateTime()

Specified by:
asDateTime in interface Value
Returns:
The date time representation, an InvalidValueTypeException is thrown if the value is not of type datetime. If value is a string then this is tried to be converted to a datetime.

asString

public java.lang.String asString()

Specified by:
asString in interface Value
Returns:
The string representation

getObject

public java.lang.Object getObject()

Specified by:
getObject in interface Value
Returns:
the value object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

iterator

public java.util.Iterator<Any> iterator()

Specified by:
iterator in interface java.lang.Iterable<Any>
Specified by:
iterator in interface Any
Returns:
iterator over elements. For Value, this return an iterator about the value itself. For AnyMap it returns an iterator on the values.

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Any
Returns:
true, if the Any does not have content. For Value: returns always false.

size

public int size()

Specified by:
size in interface Any
Returns:
size of Any. For Value this is always 1.

asValue

public Value asValue()
returns this Any as an Value object or throws an InvalidValueTypeException.

Specified by:
asValue in interface Any
Overrides:
asValue in class AbstractAny
See Also:
Any.asValue()

SMILA API documentation