public class DateValue extends Object implements OrderedValue, Comparable<DateValue>, Serializable
| Constructor and Description |
|---|
DateValue()
Constructs a new date value object representing the current time.
|
DateValue(Date date)
Constructs a new date value from a Java date object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ValueVisitor valueVisitor)
Performs some processing on a value.
|
DateValueBuilder |
asBuilder() |
ValueComparator |
compare(Value o)
Compares this date value and another date value according to their
natural order, or checks this date value for membership in a value list.
|
int |
compareTo(DateValue other) |
boolean |
equals(Object obj) |
String |
format(Format format)
Formats this date value with a custom
Format. |
Date |
getDate()
Gets the date represented by this object as a Java
Date. |
String |
getFormatted()
Returns a string representing this value for display purposes.
|
static DateValue |
getInstance()
Constructs a new date value representing the current time.
|
static DateValue |
getInstance(Date date)
Constructs a new date value from a Java date object.
|
ValueType |
getType()
Returns this object's type, guaranteed not
null. |
int |
hashCode() |
static DateValue |
parse(String str)
Parses a date from a string.
|
Value |
replace()
Returns a value from a cache that is equal to this one, if such a value
exists.
|
String |
toString() |
public DateValue()
getInstance() instead to leverage a cache of frequently used
date values.public DateValue(Date date)
getInstance(Date) instead to leverage a cache of frequently
used date values.public static DateValue parse(String str)
AbsoluteTimeGranularity.DAY's getShortFormat().str - a string representing a date.null if no date could be parsed.public static DateValue getInstance(Date date)
public static DateValue getInstance()
DateValue.public Date getDate()
Date.Date.public String getFormatted()
ValuegetFormatted in interface ValueString. Guaranteed not null.public ValueType getType()
Valuenull.public ValueComparator compare(Value o)
compare in interface Valueo - a Value.ValueComparator.GREATER_THAN,
ValueComparator.LESS_THAN or ValueComparator.EQUAL_TO
depending on whether this value is greater than, less than or equal to
the value provided as argument. If the provided value is a value list,
returns ValueComparator.IN if this date value is in the list, or
ValueComparator.NOT_IN if this date value is not in the list.
Otherwise, returns ValueComparator.UNKNOWN.public Value replace()
Valuepublic void accept(ValueVisitor valueVisitor)
ValueVisitableaccept in interface ValueVisitablepublic int compareTo(DateValue other)
compareTo in interface Comparable<DateValue>public DateValueBuilder asBuilder()
asBuilder in interface OrderedValueasBuilder in interface ValueCopyright © 2012–2018 Emory University. All rights reserved.