org.exoplatform.services.jcr.rmi.api.value
Class DoubleValue

java.lang.Object
  extended by org.exoplatform.services.jcr.rmi.api.value.BaseNonStreamValue
      extended by org.exoplatform.services.jcr.rmi.api.value.DoubleValue
All Implemented Interfaces:
java.io.Serializable, javax.jcr.Value, ExtendedValue, StatefulValue

public class DoubleValue
extends BaseNonStreamValue
implements java.io.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

Field Summary
 
Fields inherited from class org.exoplatform.services.jcr.rmi.api.value.BaseNonStreamValue
orderNumber
 
Constructor Summary
protected DoubleValue(double value)
          Creates an instance for the given double value.
protected DoubleValue(java.lang.String value)
          Creates an instance for the given string representation of a double.
 
Method Summary
 java.util.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 getLength()
           
 long getLong()
          Returns the value converted to a long.
 int getOrderNumber()
           
 java.lang.String getString()
          Returns the double as a string converted by the Double.toString(double).
 int getType()
          Returns PropertyType.DOUBLE.
protected static double toDouble(java.lang.String value)
          Returns the double value represented by the string value.
 
Methods inherited from class org.exoplatform.services.jcr.rmi.api.value.BaseNonStreamValue
getBoolean, getReference, getStream, getValueFormatException, setOrderNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.exoplatform.services.jcr.core.value.ExtendedValue
getReference, setOrderNumber
 
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(java.lang.String value)
               throws javax.jcr.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:
javax.jcr.ValueFormatException - if the string value cannot be parsed to double.
Method Detail

toDouble

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

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

getType

public int getType()
Returns PropertyType.DOUBLE.

Specified by:
getType in interface javax.jcr.Value

getDate

public java.util.Calendar getDate()
                           throws javax.jcr.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 javax.jcr.Value
Overrides:
getDate in class BaseNonStreamValue
Returns:
nothing
Throws:
javax.jcr.ValueFormatException - If the value cannot be converted to a Calendar instance.

getDouble

public double getDouble()
Returns the double value.

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

getString

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

Specified by:
getString in interface javax.jcr.Value

getLong

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

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

getLength

public long getLength()
Specified by:
getLength in interface ExtendedValue

getOrderNumber

public int getOrderNumber()
Specified by:
getOrderNumber in interface ExtendedValue
Overrides:
getOrderNumber in class BaseNonStreamValue


Copyright © 2010 eXo Platform SAS. All Rights Reserved.