| com.go.tea.runtime.Context
Method Summary | |
public void | dateFormat(String format) Defines a format to use when printing dates from templates. | public void | dateFormat(String format, String timeZoneID) A function that sets the formatted value of dates.
Parameters: format - date format specification string Parameters: timeZoneID - time zone ID, i.e. | public java.util.Locale[] | getAvailableLocales() Returns a list of all the available locales. | public java.util.TimeZone[] | getAvailableTimeZones() Returns a list of all the available time zones. | public String | getDateFormat() Returns the current date format specification. | public String | getDateFormatTimeZone() Returns the current date format time zone. | public java.util.Locale | getLocale() Returns the current locale setting. | public String | getNullFormat() Returns the current null format specification. | public String | getNumberFormat() Returns the current number format specification. | public String | getNumberFormatInfinity() Returns the current number format for infinity. | public String | getNumberFormatNaN() Returns the current number format for NaN. | public void | nullFormat(String format) A function that sets the formatted value of null object references. | public void | numberFormat(String format) A function that sets the formatted value of numbers.
Defines a format to use when printing numbers from templates. | public void | numberFormat(String format, String infinity, String NaN) A function that sets the formatted value of numbers.
Defines a format to use when printing numbers from templates. | public void | print(Object obj) Method that is the runtime receiver. | public void | print(java.util.Date date) | public void | print(Number n) | public void | print(int n) | public void | print(float n) | public void | print(long n) | public void | print(double n) | public void | setLocale(java.util.Locale locale) Setting the locale resets date and number formats to the default for
that locale. | public void | setLocale(String language, String country) Setting the locale resets date and number formats to the default for
that locale. | public void | setLocale(String language, String country, String variant) Setting the locale resets date and number formats to the default for
that locale. | public String | toString(Object obj) A function that converts an object to a string, applying any applicable
formatting settings. | public String | toString(String str) A function that converts a string to the null format string if it is
null. | public String | toString(java.util.Date date) A function that converts a date to a string, using the current
date format. | public String | toString(Number n) A function that converts a number to a string, using the current
number format. | public String | toString(int n) A function that converts a number to a string, using the current
number format. | public String | toString(float n) A function that converts a number to a string, using the current
number format. | public String | toString(long n) A function that converts a number to a string, using the current
number format. | public String | toString(double n) A function that converts a number to a string, using the current
number format. |
dateFormat | public void dateFormat(String format)(Code) | | Defines a format to use when printing dates from templates.
Passing null sets the format back to the default.
Time Format Syntax:
To specify the time format use a time pattern string.
In this pattern, all ASCII letters are reserved as pattern letters,
which are defined as the following:
Symbol Meaning Presentation Example
------ ------- ------------ -------
G era designator (Text) AD
y year (Number) 1996
M month in year (Text & Number) July & 07
d day in month (Number) 10
h hour in am/pm (1~12) (Number) 12
H hour in day (0~23) (Number) 0
m minute in hour (Number) 30
s second in minute (Number) 55
S millisecond (Number) 978
E day in week (Text) Tuesday
D day in year (Number) 189
F day of week in month (Number) 2 (2nd Wed in July)
w week in year (Number) 27
W week in month (Number) 2
a am/pm marker (Text) PM
k hour in day (1~24) (Number) 24
K hour in am/pm (0~11) (Number) 0
z time zone (Text) Pacific Standard Time
' escape for text (Delimiter)
'' single quote (Literal) '
The count of pattern letters determine the format.
(Text): 4 or more pattern letters--use full form,
less than 4--use short or abbreviated form if one exists.
(Number): the minimum number of digits. Shorter
numbers are zero-padded to this amount. Year is handled specially;
that is, if the count of 'y' is 2, the Year will be truncated to 2
digits.
(Text & Number): 3 or over, use text, otherwise use
number.
Any characters in the pattern that are not in the ranges of
['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance,
characters like ':', '.', ' ', '#' and '@' will appear in the resulting
time text even they are not embraced within single quotes.
A pattern containing any invalid pattern letter will result in a thrown
exception during formatting or parsing.
Examples:
Format Pattern Result
-------------- -------
"yyyy.MM.dd G 'at' hh:mm:ss z" ->> 1996.07.10 AD at 15:08:56 PDT
"EEE, MMM d, ''yy" ->> Wed, July 10, '96
"h:mm a" ->> 12:08 PM
"hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time
"K:mm a, z" ->> 0:00 PM, PST
"yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 1996.July.10 AD 12:08 PM
Parameters: format - date format specification string |
dateFormat | public void dateFormat(String format, String timeZoneID)(Code) | | A function that sets the formatted value of dates.
Parameters: format - date format specification string Parameters: timeZoneID - time zone ID, i.e. "PST" |
getAvailableLocales | public java.util.Locale[] getAvailableLocales()(Code) | | Returns a list of all the available locales.
|
getAvailableTimeZones | public java.util.TimeZone[] getAvailableTimeZones()(Code) | | Returns a list of all the available time zones.
|
getDateFormat | public String getDateFormat()(Code) | | Returns the current date format specification.
|
getDateFormatTimeZone | public String getDateFormatTimeZone()(Code) | | Returns the current date format time zone.
|
getNullFormat | public String getNullFormat()(Code) | | Returns the current null format specification.
|
getNumberFormat | public String getNumberFormat()(Code) | | Returns the current number format specification.
|
getNumberFormatInfinity | public String getNumberFormatInfinity()(Code) | | Returns the current number format for infinity.
|
getNumberFormatNaN | public String getNumberFormatNaN()(Code) | | Returns the current number format for NaN.
|
nullFormat | public void nullFormat(String format)(Code) | | A function that sets the formatted value of null object references.
Parameters: format - string to print in place of "null". |
numberFormat | public void numberFormat(String format)(Code) | | A function that sets the formatted value of numbers.
Defines a format to use when printing numbers from templates.
Passing null sets the format back to the default. The format string is
of the form "#.#".
Here are the special characters used in the parts of the format string,
with notes on their usage.
Symbol Meaning
------ -------
0 a digit
# a digit, zero shows as absent
. placeholder for decimal separator.
, placeholder for grouping separator.
; separates formats.
- default negative prefix.
% multiply by 100 and show as percentage
? multiply by 1000 and show as per mille
\u00a4 currency sign; replaced by currency symbol;
if doubled, replaced by international currency
symbol. If present in a pattern, the monetary
decimal separator is used instead of the decimal
separator. (Unicode escape is \\u00a4)
X any other characters can be used in the prefix or suffix
' used to quote special characters in a prefix or suffix.
Parameters: format - number format specification string |
numberFormat | public void numberFormat(String format, String infinity, String NaN)(Code) | | A function that sets the formatted value of numbers.
Defines a format to use when printing numbers from templates.
Passing null sets the format back to the default. The format string is
of the form "#.#".
Here are the special characters used in the parts of the format string,
with notes on their usage.
Symbol Meaning
------ -------
0 a digit
# a digit, zero shows as absent
. placeholder for decimal separator.
, placeholder for grouping separator.
; separates formats.
- default negative prefix.
% multiply by 100 and show as percentage
? multiply by 1000 and show as per mille
\u00a4 currency sign; replaced by currency symbol;
if doubled, replaced by international currency
symbol. If present in a pattern, the monetary
decimal separator is used instead of the decimal
separator. (Unicode escape is \\u00a4)
X any other characters can be used in the prefix or suffix
' used to quote special characters in a prefix or suffix.
Parameters: format - number format specification string Parameters: infinity - display string for infinity Parameters: NaN - display string for not-a-number, resulting from zero dividedby zero. |
setLocale | public void setLocale(java.util.Locale locale)(Code) | | Setting the locale resets date and number formats to the default for
that locale. Setting a locale of null resets date and number formats
to the system defaults.
See getAvailableLocales to get all the available language, country
and variant codes.
Parameters: locale - pre-constructed locale object |
setLocale | public void setLocale(String language, String country)(Code) | | Setting the locale resets date and number formats to the default for
that locale.
Parameters: language - language code Parameters: country - country code |
setLocale | public void setLocale(String language, String country, String variant)(Code) | | Setting the locale resets date and number formats to the default for
that locale.
Parameters: language - language code Parameters: country - country code Parameters: variant - optional variant code |
|
|