org.apache.jackrabbit.rmi.value
Class DoubleValue

java.lang.Object
  extended by org.apache.jackrabbit.rmi.value.BaseNonStreamValue
      extended by org.apache.jackrabbit.rmi.value.DoubleValue
All Implemented Interfaces:
Serializable, Value, StatefulValue

public class DoubleValue
extends BaseNonStreamValue
implements Serializable, StatefulValue

The DoubleValue class implements the committed value state for Double values as a part of the State design pattern (Gof) used by this package.

Since:
0.16.4.1
See Also:
SerialValue, Serialized Form

Constructor Summary
protected DoubleValue(double value)
          Creates an instance for the given double value.
protected DoubleValue(String value)
          Creates an instance for the given string representation of a double.
 
Method Summary
 Calendar getDate()
          Returns a Calendar instance interpreting the double as the time in milliseconds since the epoch (1.1.1970, 0:00, UTC).
 double getDouble()
          Returns the double value.
 long getLong()
          Returns the value converted to a long.
 String getString()
          Returns the double as a string converted by the Double.toString(double).
 int getType()
          Returns PropertyType.DOUBLE.
protected static double toDouble(String value)
          Returns the double value represented by the string value.
 
Methods inherited from class org.apache.jackrabbit.rmi.value.BaseNonStreamValue
getBoolean, getStream, getValueFormatException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jcr.Value
getBoolean, getStream
 

Constructor Detail

DoubleValue

protected DoubleValue(double value)
Creates an instance for the given double value.


DoubleValue

protected DoubleValue(String value)
               throws ValueFormatException
Creates an instance for the given string representation of a double.

This implementation uses the Double.valueOf(String) method to convert the string to a double.

Throws:
ValueFormatException - if the string value cannot be parsed to double.
Method Detail

toDouble

protected static double toDouble(String value)
                          throws ValueFormatException
Returns the double value represented by the string value.

Throws:
ValueFormatException - if the string value cannot be parsed to double.

getType

public int getType()
Returns PropertyType.DOUBLE.

Specified by:
getType in interface Value

getDate

public Calendar getDate()
                 throws ValueFormatException
Returns a Calendar instance interpreting the double as the time in milliseconds since the epoch (1.1.1970, 0:00, UTC).

Specified by:
getDate in interface Value
Overrides:
getDate in class BaseNonStreamValue
Returns:
nothing
Throws:
ValueFormatException - If the value cannot be converted to a Calendar instance.

getDouble

public double getDouble()
Returns the double value.

Specified by:
getDouble in interface Value
Overrides:
getDouble in class BaseNonStreamValue
Returns:
nothing

getString

public String getString()
Returns the double as a string converted by the Double.toString(double).

Specified by:
getString in interface Value

getLong

public long getLong()
Returns the value converted to a long.

Specified by:
getLong in interface Value
Overrides:
getLong in class BaseNonStreamValue
Returns:
nothing


Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.