public class DateValue extends BaseValue
DateValue
provides an implementation
of the Value
interface representing a date value.Modifier and Type | Field and Description |
---|---|
static int |
TYPE |
Constructor and Description |
---|
DateValue(java.util.Calendar date)
Constructs a
DateValue object representing a date. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
boolean |
getBoolean() |
java.util.Calendar |
getDate() |
java.math.BigDecimal |
getDecimal() |
double |
getDouble() |
long |
getLong() |
int |
hashCode()
Returns zero to satisfy the Object equals/hashCode contract.
|
static DateValue |
valueOf(java.lang.String s)
Returns a new
DateValue initialized to the value
represented by the specified String . |
public DateValue(java.util.Calendar date) throws java.lang.IllegalArgumentException
DateValue
object representing a date.date
- the date this DateValue
should representjava.lang.IllegalArgumentException
- if the given date cannot be represented
as defined by ISO 8601.public static DateValue valueOf(java.lang.String s) throws ValueFormatException
DateValue
initialized to the value
represented by the specified String
.
The specified String
must be a ISO8601-compliant date/time
string.
s
- the string to be parsed.DateValue
representing the
the specified value.javax.jcr.ValueFormatException
- If the String
is not a valid
ISO8601-compliant date/time string.ValueFormatException
ISO8601
public boolean equals(java.lang.Object obj)
The result is true
if and only if the argument is not
null
and is a DateValue
object that
represents the same value as this object.
The value comparison is performed using the ISO 8601 string representation of the dates, since the native Calendar.equals() method may produce false negatives (see JSR-598).
Note that the comparison still returns false when comparing the same time in different time zones, but that seems to be the intent of JSR 170. Compare the Value.getDate().getTime() values if you need an exact time comparison in UTC.
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.util.Calendar getDate() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
public long getLong() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
public boolean getBoolean() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
getBoolean
in class BaseValue
ValueFormatException
java.lang.IllegalStateException
RepositoryException
public double getDouble() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
public java.math.BigDecimal getDecimal() throws ValueFormatException, java.lang.IllegalStateException, RepositoryException
getDecimal
in class BaseValue
ValueFormatException
java.lang.IllegalStateException
RepositoryException
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"