public abstract class AbstractWrappedDateFormat extends DateFormat
DateFormat
and delegates most
of its behavior to the delegate, except for the abstract methods
format(Date, StringBuffer, FieldPosition)
and
parse(String, ParsePosition)
that can be overridden by
a subclass. For example the subclass EmptyDateFormat wraps a DateFormat
but it parses the empty String and returns null
where the
predefined Java DateFormats throw an exception.DateFormat.Field
Modifier and Type | Field and Description |
---|---|
protected DateFormat |
delegate
Refers to the wrapped Format that is used to forward
#format and #parseObject . |
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
Constructor and Description |
---|
AbstractWrappedDateFormat(DateFormat delegate)
Constructs an AbstractWrappedDateFormat that wraps the given mandatory
format.
|
Modifier and Type | Method and Description |
---|---|
abstract StringBuffer |
format(Date date,
StringBuffer toAppendTo,
FieldPosition pos) |
AttributedCharacterIterator |
formatToCharacterIterator(Object obj) |
Calendar |
getCalendar() |
NumberFormat |
getNumberFormat() |
TimeZone |
getTimeZone() |
boolean |
isLenient() |
abstract Date |
parse(String source,
ParsePosition pos) |
void |
setCalendar(Calendar newCalendar) |
void |
setLenient(boolean lenient) |
void |
setNumberFormat(NumberFormat newNumberFormat) |
void |
setTimeZone(TimeZone zone) |
clone, equals, format, format, getAvailableLocales, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getTimeInstance, getTimeInstance, getTimeInstance, hashCode, parse, parseObject
format, parseObject
protected final DateFormat delegate
#format
and #parseObject
.public AbstractWrappedDateFormat(DateFormat delegate)
delegate
- the format that handles the standard casesNullPointerException
- if delegate
is null
public abstract StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos)
format
in class DateFormat
public abstract Date parse(String source, ParsePosition pos)
parse
in class DateFormat
public Calendar getCalendar()
getCalendar
in class DateFormat
public void setCalendar(Calendar newCalendar)
setCalendar
in class DateFormat
public NumberFormat getNumberFormat()
getNumberFormat
in class DateFormat
public void setNumberFormat(NumberFormat newNumberFormat)
setNumberFormat
in class DateFormat
public TimeZone getTimeZone()
getTimeZone
in class DateFormat
public void setTimeZone(TimeZone zone)
setTimeZone
in class DateFormat
public boolean isLenient()
isLenient
in class DateFormat
public void setLenient(boolean lenient)
setLenient
in class DateFormat
public AttributedCharacterIterator formatToCharacterIterator(Object obj)
formatToCharacterIterator
in class Format
Copyright © 2014 JGoodies Software GmbH. All rights reserved.