oracle.jbo.format
Class DefaultMessageFormatter
java.lang.Object
|
+--java.text.Format
|
+--oracle.jbo.format.Formatter
|
+--oracle.jbo.format.DefaultMessageFormatter
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Serializable
- public class DefaultMessageFormatter
- extends Formatter
A generic formatter class. It uses java.text.MessageFormat to
format.
- Version:
- SDK
- See Also:
- Serialized Form
Type | Method |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
|
java.lang.String |
format(java.lang.String formatString,
java.lang.Object rawData)
format raw data according to the format specified. |
LocaleContext |
getLocale()
|
java.lang.Object |
parse(java.lang.String formatString,
java.lang.String parseThisString)
parse this string according to the format specified and return an object |
java.lang.Object |
parseObject(java.lang.String parseThisString,
java.text.ParsePosition status)
|
void |
setLocale(LocaleContext thisLocale)
define locale to be used. |
Methods inherited from class java.text.Format |
clone, format, parseObject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultMessageFormatter
public DefaultMessageFormatter()
- Constructor
format
public java.lang.String format(java.lang.String formatString,
java.lang.Object rawData)
throws FormatErrorException
- format raw data according to the format specified.
Data is formatted per the 'format string' passed as an argument to this
function.
- Overrides:
format
in class Formatter
- Parameters:
formatString
- code to define how the raw data should be formatted.rawData
- data which needs to be formatted.- Returns:
- formatted string
- Throws:
FormatErrorException
- if unable to format the data according to
the format specified.
parse
public java.lang.Object parse(java.lang.String formatString,
java.lang.String parseThisString)
throws java.text.ParseException
- parse this string according to the format specified and return an object
- Overrides:
parse
in class Formatter
- Parameters:
formatString
- code to define how the raw data should be parsed.parseThisString
- data which needs to be parsed.- Returns:
- object which represents the string parsed.
- Throws:
java.text.ParseException
- when unable to parse data according to
the format specified.
setLocale
public void setLocale(LocaleContext thisLocale)
throws UnknownLocaleException
- define locale to be used.
Formatter will need to make locale specific formatting if applicable
- Overrides:
setLocale
in class Formatter
- Parameters:
thisLocale
- locale to be used- Throws:
UnknownLocaleException
- if the formatter does'nt support the
specified Locale.
getLocale
public LocaleContext getLocale()
- Overrides:
getLocale
in class Formatter
- Returns:
- Locale currently in use
parseObject
public java.lang.Object parseObject(java.lang.String parseThisString,
java.text.ParsePosition status)
- Overrides:
parseObject
in class java.text.Format
- Parameters:
parseThisString
- data which needs to be parsedstatus
- parse to start from this position- Returns:
- object which represents the string parsed
format
public java.lang.StringBuffer format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
- Overrides:
format
in class java.text.Format
- Parameters:
obj
- object which needs to be formattedtoAppendTo
- appended formatted string herepos
- additional information about the formatting performed. see
java.text.FieldPosition for more information- Returns:
- formatted string