|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectariba.util.formatter.Formatter
ariba.util.formatter.DateFormatter
ariba.util.formatter.UserDateFormatter
public class UserDateFormatter
UserDateFormatter is a subclass of DateFormatter
which is responsible for parsing user date strings, i.e. string typed in
or selected by the user. Additional natural language processing is done
to make date input more user-friendly. The localized strings for "today",
"tomorrow", and "yesterday" are recognized and converted to the
appropriate date relative to the current date. Day of week strings
(e.g. "monday", "sunday", etc.) are also supported for input.
| Field Summary | |
|---|---|
static String |
ClassName
Our Java class name. |
| Fields inherited from interface ariba.util.core.Compare |
|---|
EqualTo, GreaterThan, LessThan |
| Constructor Summary | |
|---|---|
UserDateFormatter()
Creates a new UserDateFormatter. |
|
| Method Summary | |
|---|---|
String |
getDateString(Date date,
Locale locale,
TimeZone timeZone)
|
static String |
getStringValue(Date date)
Returns a formatted string for the given Date in the
default locale. |
static String |
getStringValue(Date date,
Locale locale,
TimeZone timeZone)
Returns a formatted string for the given Date in the
given locale. |
static String |
getStringValue(Date date,
TimeZone timeZone)
Returns a formatted string for the given Date in the
given timeZone using the default locale. |
Object |
getValue(Object object,
Locale locale)
Overrides DateFormatter.parseString() to call our static method for converting an object into a date. |
Object |
parseString(String string,
Locale locale,
TimeZone tz,
boolean calendarDate)
Parse the given string as a Date in the given
locale and time zone. |
static Date |
parseUserDate(String string)
Tries to parse the given user string as a Date in the
default locale. |
static Date |
parseUserDate(String string,
boolean calendarDate)
Tries to parse the given user string as a Date in the
default locale. |
static Date |
parseUserDate(String string,
Locale locale)
Tries to parse the given user string as a Date in the
given locale. |
static Date |
parseUserDate(String string,
Locale locale,
boolean calendarDate)
Tries to parse the given user string as a Date in the
given locale. |
static Date |
parseUserDate(String string,
Locale locale,
TimeZone tz,
boolean calendarDate)
Tries to parse the given user string as a Date in the
given locale. |
static Date |
userDateValue(Object object)
Returns a new Date derived from the given object in the
default locale. |
static Date |
userDateValue(Object object,
boolean calendarDate)
Returns a new Date derived from the given object in the
default locale. |
static Date |
userDateValue(Object object,
Locale locale)
Returns a new Date derived from the given object in the
given locale. |
static Date |
userDateValue(Object object,
Locale locale,
boolean calendarDate)
Returns a new Date derived from the given object in the
given locale. |
| Methods inherited from class ariba.util.formatter.Formatter |
|---|
canFormatNulls, compare, compare, equal, equal, getFormat, getFormat, getFormatterClassForType, getFormatterForObject, getFormatterForType, getLocale, getStringValue, getStringValue, getValue, handlesNulls, isBidirectional, makeParseException, makeParseException, objectsAreEqual, objectsAreEqual, parse, parse, parseString, parseString, quickCompare, quickCompare, quickCompareValue, registerFormatter |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ClassName
| Constructor Detail |
|---|
public UserDateFormatter()
UserDateFormatter.
| Method Detail |
|---|
public static String getStringValue(Date date)
Date in the
default locale. Recognizes if the given Date is today
and formats the output accordingly.
date - the Date to format into a string
Date
public static String getStringValue(Date date,
TimeZone timeZone)
Date in the
given timeZone using the default locale. Recognizes if
the given Date is today and formats the output
accordingly.
date - the Date to format into a stringtimeZone - the TimeZone to use for formatting
Date
public static String getStringValue(Date date,
Locale locale,
TimeZone timeZone)
Date in the
given locale. Recognizes if the given Date is today and
formats the output accordingly.
date - the Date to format into a stringlocale - the Locale to use for formattingtimeZone - the TimeZone to use for formatting
Date
public String getDateString(Date date,
Locale locale,
TimeZone timeZone)
public static Date parseUserDate(String string,
boolean calendarDate)
throws ParseException
Date in the
default locale. In addition to the default date parsing, this method
will also try to handle a number of more natural date strings,
e.g. the string "today", "tomorrow", "monday", etc. It also handles
cases where the string is incomplete, e.g. "2/21". In this case, the
current year is used as the default.
string - the string to parse as a DatecalendarDate - if true, a calendar date will be created
Date derived from the string
ParseException - if the string can't be parsed as a
Date
public static Date parseUserDate(String string)
throws ParseException
Date in the
default locale. In addition to the default date parsing, this method
will also try to handle a number of more natural date strings,
e.g. the string "today", "tomorrow", "monday", etc. It also handles
cases where the string is incomplete, e.g. "2/21". In this case, the
current year is used as the default.
string - the string to parse as a Date
Date derived from the string
ParseException - if the string can't be parsed as a
Date
public static Date parseUserDate(String string,
Locale locale)
throws ParseException
Date in the
given locale. In addition to the default date parsing, this method
will also try to handle a number of more natural date strings,
e.g. the string "today", "tomorrow", "monday", etc. It also handles
cases where the string is incomplete, e.g. "2/21". In this case, the
current year is used as the default.
string - the string to parse as a Datelocale - the Locale to use for parsing
Date derived from the string
ParseException - if the string can't be parsed as a
Date
public static Date parseUserDate(String string,
Locale locale,
boolean calendarDate)
throws ParseException
Date in the
given locale. In addition to the default date parsing, this method
will also try to handle a number of more natural date strings,
e.g. the string "today", "tomorrow", "monday", etc. It also handles
cases where the string is incomplete, e.g. "2/21". In this case, the
current year is used as the default.
string - the string to parse as a Datelocale - the Locale to use for parsingcalendarDate - if true, a calendar date will be created
Date derived from the string
ParseException - if the string can't be parsed as a
Date
public static Date parseUserDate(String string,
Locale locale,
TimeZone tz,
boolean calendarDate)
throws ParseException
Date in the
given locale. In addition to the default date parsing, this method
will also try to handle a number of more natural date strings,
e.g. the string "today", "tomorrow", "monday", etc. It also handles
cases where the string is incomplete, e.g. "2/21". In this case, the
current year is used as the default.
string - the string to parse as a Datelocale - the Locale to use for parsingtz - the TimeZone to use for parsingcalendarDate - if true, a calendar date will be created
Date derived from the string
ParseException - if the string can't be parsed as a
Date
public static Date userDateValue(Object object,
boolean calendarDate)
Date derived from the given object in the
default locale. If the object is not a Date, it is
converted to a string and parsed as a user string. Returns null if
the object can't be converted to a Date.
object - the object to convert to a DatecalendarDate - if true, a calendar date will be created
Date derived from the given objectpublic static Date userDateValue(Object object)
Date derived from the given object in the
default locale. If the object is not a Date, it is
converted to a string and parsed as a user string. Returns null if
the object can't be converted to a Date.
object - the object to convert to a Date
Date derived from the given object
public static Date userDateValue(Object object,
Locale locale)
Date derived from the given object in the
given locale. If the object is not a Date, it is
converted to a string and parsed as a user string. Returns null if
the object can't be converted to a Date.
object - the object to convert to a Datelocale - the Locale to use for conversion
Date derived from the given object
public static Date userDateValue(Object object,
Locale locale,
boolean calendarDate)
Date derived from the given object in the
given locale. If the object is not a Date, it is
converted to a string and parsed as a user string. Returns null if
the object can't be converted to a Date.
object - the object to convert to a Datelocale - the Locale to use for conversioncalendarDate - if true, a calendar date will be created
Date derived from the given object
public Object parseString(String string,
Locale locale,
TimeZone tz,
boolean calendarDate)
throws ParseException
Date in the given
locale and time zone. The locale and
timeZone parameters must be non-null.
parseString in class DateFormatterstring - the string to parse as a Datelocale - the Locale to use for parsingtz - the TimeZone to use for parsingcalendarDate - if true, a calendar date will be created
Date derived from the string
ParseException - if the string can't be parsed as a
Date
public Object getValue(Object object,
Locale locale)
getValue in class DateFormatterobject - the object to convert to a Datelocale - the Locale to use for conversion
Date derived from the string
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||