org.apache.jackrabbit.rmi.value
Class LongValue

java.lang.Object
  extended byorg.apache.jackrabbit.rmi.value.BaseNonStreamValue
      extended byorg.apache.jackrabbit.rmi.value.LongValue
All Implemented Interfaces:
Serializable, StatefulValue, Value

public class LongValue
extends BaseNonStreamValue
implements Serializable, StatefulValue

The LongValue class implements the committed value state for Long 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 LongValue(long value)
          Creates an instance for the given long value.
protected LongValue(String value)
          Creates an instance for the given string representation of a long.
 
Method Summary
 Calendar getDate()
          Returns a Calendar instance interpreting the long as the time in milliseconds since the epoch (1.1.1970, 0:00, UTC).
 double getDouble()
          Returns the value converted to a double.
 long getLong()
          Returns the double value.
 String getString()
          Returns the long as a string converted by the Long.toString(long).
 int getType()
          Returns PropertyType.LONG.
protected static long toLong(String value)
          Returns the long 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

LongValue

protected LongValue(long value)
Creates an instance for the given long value.


LongValue

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

This implementation uses the Long.valueOf(String) method to convert the string to a long.

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

toLong

protected static long toLong(String value)
                      throws ValueFormatException
Returns the long value represented by the string value.

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

getType

public int getType()
Returns PropertyType.LONG.

Specified by:
getType in interface Value

getDate

public Calendar getDate()
                 throws ValueFormatException
Returns a Calendar instance interpreting the long 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.

getLong

public long getLong()
Returns the double value.

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

getString

public String getString()
Returns the long as a string converted by the Long.toString(long).

Specified by:
getString in interface Value

getDouble

public double getDouble()
Returns the value converted to a double.

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


Copyright © 2004-2006 . All Rights Reserved.