org.apache.jackrabbit.rmi.value
Class DateValue

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

public class DateValue
extends BaseNonStreamValue
implements Serializable, StatefulValue

The DateValue class implements the committed value state for Date 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 DateValue(Calendar value)
          Creates an instance for the given Calendar value.
protected DateValue(String value)
          Creates a new DateValue initialized to the value represented by the specified String.
 
Method Summary
 Calendar getDate()
          Returns (a copy) of this Calendar value.
 double getDouble()
          Returns the time represented by this instance as the number of milliseconds since the epoch (1.1.1970, 0:00, UTC).
 long getLong()
          Returns the time represented by this instance as the number of milliseconds since the epoch (1.1.1970, 0:00, UTC).
 String getString()
          Returns the string represented of this DateValue value formatted using a ISO8601-compliant date/time.
 int getType()
          Returns PropertyType.DATE.
 
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

DateValue

protected DateValue(Calendar value)
Creates an instance for the given Calendar value.

Parameters:
value - the calendar for this value.

DateValue

protected DateValue(String value)
             throws ValueFormatException
Creates a new DateValue initialized to the value represented by the specified String.

The specified String must be a ISO8601-compliant date/time string.

Parameters:
value - the string to be parsed.
Throws:
ValueFormatException - If the String is not a valid ISO8601-compliant date/time string.
See Also:
ISO8601
Method Detail

getType

public int getType()
Returns PropertyType.DATE.

Specified by:
getType in interface Value

getDouble

public double getDouble()
Returns the time represented by this instance as the number of milliseconds since the epoch (1.1.1970, 0:00, UTC).

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

getString

public String getString()
Returns the string represented of this DateValue value formatted using a ISO8601-compliant date/time.

Specified by:
getString in interface Value

getLong

public long getLong()
Returns the time represented by this instance as the number of milliseconds since the epoch (1.1.1970, 0:00, UTC).

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

getDate

public Calendar getDate()
Returns (a copy) of this Calendar value. Modifying the returned Calendar does not change the value of this instance.

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


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