com.jgoodies.common.format
public abstract class AbstractWrappedDateFormat extends java.text.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.Modifier and Type | Field and Description |
---|---|
protected java.text.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(java.text.DateFormat delegate)
Constructs an AbstractWrappedDateFormat that wraps the given mandatory
format.
|
Modifier and Type | Method and Description |
---|---|
abstract java.lang.StringBuffer |
format(java.util.Date date,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos) |
java.text.AttributedCharacterIterator |
formatToCharacterIterator(java.lang.Object obj) |
java.util.Calendar |
getCalendar() |
java.text.NumberFormat |
getNumberFormat() |
java.util.TimeZone |
getTimeZone() |
boolean |
isLenient() |
abstract java.util.Date |
parse(java.lang.String source,
java.text.ParsePosition pos) |
void |
setCalendar(java.util.Calendar newCalendar) |
void |
setLenient(boolean lenient) |
void |
setNumberFormat(java.text.NumberFormat newNumberFormat) |
void |
setTimeZone(java.util.TimeZone zone) |
clone, equals, format, format, getAvailableLocales, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getTimeInstance, getTimeInstance, getTimeInstance, hashCode, parse, parseObject
protected final java.text.DateFormat delegate
#format
and #parseObject
.public AbstractWrappedDateFormat(java.text.DateFormat delegate)
delegate
- the format that handles the standard casesjava.lang.NullPointerException
- if delegate
is null
public abstract java.lang.StringBuffer format(java.util.Date date, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.DateFormat
public abstract java.util.Date parse(java.lang.String source, java.text.ParsePosition pos)
parse
in class java.text.DateFormat
public java.util.Calendar getCalendar()
getCalendar
in class java.text.DateFormat
public void setCalendar(java.util.Calendar newCalendar)
setCalendar
in class java.text.DateFormat
public java.text.NumberFormat getNumberFormat()
getNumberFormat
in class java.text.DateFormat
public void setNumberFormat(java.text.NumberFormat newNumberFormat)
setNumberFormat
in class java.text.DateFormat
public java.util.TimeZone getTimeZone()
getTimeZone
in class java.text.DateFormat
public void setTimeZone(java.util.TimeZone zone)
setTimeZone
in class java.text.DateFormat
public boolean isLenient()
isLenient
in class java.text.DateFormat
public void setLenient(boolean lenient)
setLenient
in class java.text.DateFormat
public java.text.AttributedCharacterIterator formatToCharacterIterator(java.lang.Object obj)
formatToCharacterIterator
in class java.text.Format
Copyright © 2009-2012 JGoodies Karsten Lentzsch. All Rights Reserved.