|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.text.Format
com.davisor.data.Type
com.davisor.data.LocaleType
com.davisor.data.FormatType
FormatType implements an abstract base class for types that wish to use Java Format objects to format and parse strings. This class manages a format object, a format pattern, and a format sample object.
Format object is an instance of standard
java.text.Format class that provides interface for
formatting and parsing object and string values. Both standard and
custom formats may be used, as appropriate to each subclass.
Format pattern is some string that somehow describes the details of the desired formatting and parsing rules. The interpretation of the pattern string depends on subclass and format object implementations.
Format sample is any generic object subclasses may want to use to further describe the details of formatting and parsing. In particular, the sample may provide a context in which the operation is to occur. A represnetative example would be a number format that leaves the desired number unit scale unspecified. With a sample of number value magnitude, a formatter can later produce numbers scaled appropriately for a context the formatter results will be used in.
Format locale management is done by super-class, and format object
constructing by sub-classes. In particular, sub-classes are
expected to define the createFormatter() method. All methods
that modify any format related parameters must then call the createFormatter() method to produce a corresponding format object.
A missing locale indicates system default locale formatting. A missing pattern indicates locale spesific default formatting.
createFormatter(),
Serialized Form| Nested Class Summary |
| Nested classes inherited from class java.text.Format |
java.text.Format.Field |
| Field Summary | |
protected java.lang.String |
M_pattern
Format pattern (may be null). |
protected java.lang.Object |
M_sample
Format sample (may be null). |
| Fields inherited from class com.davisor.data.LocaleType |
DEFAULT_LOCALE, M_locale |
| Fields inherited from class com.davisor.data.Type |
METADATA_GROUP, METADATA_NAME, METADATA_PARENT, METADATA_SUBCHANNELS, TYPENAME |
| Constructor Summary | |
protected |
FormatType(FormatType ft)
Deep copy constructor. |
protected |
FormatType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.util.Locale locale,
java.lang.String pattern,
java.lang.Object sample)
Creates a new format type. |
| Method Summary | |
void |
clearFormatter()
Clears the current format, if any. |
protected abstract java.text.Format |
createFormatter()
Creates a new format instance suitable for the purposes of this class. |
boolean |
equals(java.lang.Object o)
Tests if this object is equal with another object. |
java.lang.String |
getFormat()
Gets the format specification string. |
java.text.Format |
getFormatter()
Gets a reference to the current format instance. |
java.lang.String |
getPattern()
Gets the current format pattern. |
java.lang.Object |
getSample()
Gets the current format sample. |
java.lang.Class |
getValueClass()
Gets value container class. |
int |
hashCode()
Returns a hash code value for the object. |
void |
setFormat(java.util.Locale locale,
java.lang.String pattern)
Sets the current format from given locale and format pattern. |
void |
setFormat(java.lang.String format)
Sets the format type specification string. |
void |
setLocale(java.util.Locale locale)
Sets the current format with locale. |
void |
setPattern(java.lang.String pattern)
Sets the current format with a format pattern. |
void |
setSample(java.lang.Object sample)
Sets the current format with a format sample. |
| Methods inherited from class com.davisor.data.LocaleType |
getLocale, setLocale |
| Methods inherited from class com.davisor.data.Type |
ceil, check, check, compare, create, create, create, create, create, dup, dup, floor, format, getCompatibility, getDataName, getId, getID, getMetaData, getMetaData, getSpecs, getSQLCode, getSQLName, getSQLName, getTypeName, isNull, parseObject, register, register, setDataName, setId, setID, setMetaData, setMetaData, setSpecs, toData, toData, toData, toData, toString, toXML, xmlEnd, xmlStart, zero |
| Methods inherited from class java.text.Format |
clone, format, formatToCharacterIterator, parseObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.String M_pattern
protected java.lang.Object M_sample
| Constructor Detail |
protected FormatType(FormatType ft)
null value.
getFormatter()
protected FormatType(java.lang.String typeName,
java.lang.String dataName,
java.lang.String id,
java.util.Map metaData,
java.util.Locale locale,
java.lang.String pattern,
java.lang.Object sample)
null value.
typeName - type namedataName - data nameid - type identitymetaData - type meta data map (may be null)locale - type locale (may be null)pattern - format pattern (may be null)sample - format sample (may be null)getFormatter(),
setLocale(java.util.Locale),
setPattern(java.lang.String),
setSample(java.lang.Object)| Method Detail |
public void setLocale(java.util.Locale locale)
After setting the locale, this method clears the current format
with a call to clearFormatter().
setLocale in class LocaleTypelocale - new locale (may be null)createFormatter(),
setFormat(Locale,String),
setPattern(java.lang.String),
LocaleType.setLocale(java.util.Locale)public boolean equals(java.lang.Object o)
Format types are equal if their super-classes and patterns are.
equals in interface java.util.Comparatorequals in class LocaleTypeCompare.equals(Object,Object)public int hashCode()
hashCode in class LocaleTypeCompare.hashCode(java.lang.Object)protected abstract java.text.Format createFormatter()
clearFormatter(),
getFormatter(),
setFormat(Locale,String),
setLocale(Locale),
setPattern(String)public void clearFormatter()
getFormatter() to call createFormatter() next time getFormatter() is invoked.
createFormatter(),
getFormatter()public java.text.Format getFormatter()
null, an attempt to create a new format is
made by calling the createFormatter() method. The result is
then stored and returned.
Depending on sub-class implementation, the result may also be
null, in which case the format remains
null, and null is also returned. This
means also that next the this method is called, a new attempt to
creat the format is made again.
clearFormatter(),
LocaleType.getLocale(),
getPattern(),
getSample()public java.lang.String getPattern()
getFormatter(),
LocaleType.getLocale(),
getSample(),
setPattern(java.lang.String)public java.lang.Object getSample()
getFormatter(),
LocaleType.getLocale(),
getPattern(),
setSample(java.lang.Object)
public void setFormat(java.util.Locale locale,
java.lang.String pattern)
After setting the locale, this method clears the current format
with a call to clearFormatter().
locale - locale instance (may be null)pattern - format pattern (may be null)clearFormatter(),
createFormatter(),
getFormatter(),
setLocale(java.util.Locale),
setPattern(java.lang.String),
setSample(java.lang.Object)public void setPattern(java.lang.String pattern)
After setting the locale, this method clears the current format
with a call to clearFormatter().
pattern - format pattern (may be null)createFormatter(),
getPattern(),
setSample(java.lang.Object)public void setSample(java.lang.Object sample)
After setting the locale, this method clears the current format
with a call to clearFormatter().
sample - format sample (may be null)clearFormatter(),
createFormatter(),
getSample()public java.lang.String getFormat()
; character. However, if the locale
specification string is null, then the specification string will
only contain a Format keyword.
getFormat in class LocaleTypegetFormatter(),
LocaleType.getLocale(),
getPattern(),
getSample(),
setFormat(java.util.Locale, java.lang.String),
LocaleType.getFormat()public void setFormat(java.lang.String format)
Format pattern and a locale specification string,
separated by a ; character. Either or both of the two
settings may also be missing. The following combinations are
therefore supported:
After the spesification string is interpreted, appropriate attribute
setter methods are called. They in turn will clear the current format
with a call to clearFormatter().
setFormat in class LocaleTypeformat - type specification string as described above (may be
empty or null)getFormat(),
setFormat(java.util.Locale, java.lang.String),
setLocale(java.util.Locale),
setPattern(java.lang.String)public java.lang.Class getValueClass()
getValueClass in class Type
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||