public class CommonFns
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
CommonFns() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String pattern)
Formats a Date into a date/time string.
|
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String pattern,
java.util.Locale locale,
java.util.TimeZone timezone,
java.lang.String dateStyle,
java.lang.String timeStyle)
Formats a Date into a date/time string.
|
static java.lang.String |
formatNumber(java.lang.Object value,
java.lang.String format)
Formats a number (Integer, BigDecimal...) into a string.
|
static java.lang.String |
formatNumber(java.lang.Object number,
java.lang.String pattern,
java.util.Locale locale)
Formats a number (Integer, BigDecimal...) into a string.
|
static java.lang.String |
getLabel(java.lang.String key)
Returns the label or message of the specified key.
|
static java.lang.String |
getLabel(java.lang.String key,
java.lang.Object[] args)
Returns the label of the specified key and formats it
with the specified argument, or null if not found.
|
static int |
indexOf(java.lang.Object o,
java.lang.Object element)
Returns the index of the given element.
|
static boolean |
isInstance(java.lang.Object c,
java.lang.Object o)
Tests whether an object, o, is an instance of a class, c.
|
static int |
lastIndexOf(java.lang.Object o,
java.lang.Object element)
Returns the last index of the given element.
|
static int |
length(java.lang.Object o)
Returns the length of an array, string, collection or map.
|
static java.lang.Object |
new_(java.lang.Object o)
Instantiates the specified class.
|
static java.lang.Object |
new_(java.lang.Object o,
java.lang.Object arg)
Instantiates the specified class, and argument.
|
static java.lang.Object |
new_(java.lang.Object o,
java.lang.Object arg1,
java.lang.Object arg2)
Instantiates the specified class, and two arguments.
|
static java.lang.Object |
new_(java.lang.Object o,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Instantiates the specified class, and two arguments.
|
static java.util.Date |
parseDate(java.lang.String source,
java.lang.String pattern)
Parses text from the beginning of the given string to produce a date.
|
static java.util.Date |
parseDate(java.lang.String source,
java.lang.String pattern,
java.util.Locale locale,
java.util.TimeZone timezone,
java.lang.String dateStyle,
java.lang.String timeStyle)
Parses text from the beginning of the given string to produce a date.
|
static java.lang.Number |
parseNumber(java.lang.String source,
java.lang.String pattern)
Parses text from the beginning of the given string to produce a number.
|
static java.lang.Number |
parseNumber(java.lang.String source,
java.lang.String pattern,
java.util.Locale locale)
Parses text from the beginning of the given string to produce a number.
|
static boolean |
toBoolean(java.lang.Object val)
Converts the specified object to a boolean.
|
static char |
toChar(java.lang.Object val)
Converts the specified object to an character.
|
static java.math.BigDecimal |
toDecimal(java.lang.Object val)
Converts the specified object to a (big) decimal.
|
static int |
toInt(java.lang.Object val)
Converts the specified object to an integer.
|
static java.lang.Number |
toNumber(java.lang.Object val)
Converts the specified object to a number.
|
static java.lang.String |
toString(java.lang.Object val)
Converts the specified object to a string.
|
public static boolean toBoolean(java.lang.Object val)
public static java.lang.String toString(java.lang.Object val)
public static java.lang.Number toNumber(java.lang.Object val)
public static int toInt(java.lang.Object val)
public static java.math.BigDecimal toDecimal(java.lang.Object val)
public static char toChar(java.lang.Object val)
public static boolean isInstance(java.lang.Object c, java.lang.Object o)
public static final java.lang.String getLabel(java.lang.String key)
Labels.getLabel(String)
is called.
getLabel(String, Object[])
public static final java.lang.String getLabel(java.lang.String key, java.lang.Object[] args)
It first uses getLabel(String)
to load the label.
Then, it, if not null, invokes MessageFormats.format(java.lang.String, java.lang.Object[], java.util.Locale)
to format it.
The current locale is given by Locales.getCurrent()
.
public static final int length(java.lang.Object o)
public static final int indexOf(java.lang.Object o, java.lang.Object element)
o
- the array/collection of objects to examine, or a string.
If o is a map, then Map.keySet()
is assumed.public static final int lastIndexOf(java.lang.Object o, java.lang.Object element)
o
- the array/list of objects to examine, or a string.public static final java.lang.Object new_(java.lang.Object o) throws java.lang.Exception
java.lang.Exception
public static final java.lang.Object new_(java.lang.Object o, java.lang.Object arg) throws java.lang.Exception
o
- the class name or classarg
- the argumentjava.lang.Exception
public static final java.lang.Object new_(java.lang.Object o, java.lang.Object arg1, java.lang.Object arg2) throws java.lang.Exception
o
- the class name or classarg1
- the first argumentarg2
- the second argumentjava.lang.Exception
public static final java.lang.Object new_(java.lang.Object o, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3) throws java.lang.Exception
o
- the class name or classarg1
- the first argumentarg2
- the second argumentjava.lang.Exception
public static final java.lang.String formatDate(java.util.Date date, java.lang.String pattern)
date
- the time value to be formatted into a time string.pattern
- the pattern describing the date and time formatpublic static final java.util.Date parseDate(java.lang.String source, java.lang.String pattern) throws java.lang.Exception
source
- A String
whose beginning should be parsed.pattern
- the pattern describing the date and time formatDate
parsed from the string.java.lang.Exception
public static final java.lang.String formatNumber(java.lang.Object value, java.lang.String format)
A utility to assist the handling of numeric data.
value
- The number to format.format
- The pattern to apply, if it is null,
the system's default format is used.public static final java.lang.Number parseNumber(java.lang.String source, java.lang.String pattern) throws java.lang.Exception
source
- A String
whose beginning should be parsed.pattern
- the pattern describing the date and time formatNumber
parsed from the string.java.lang.Exception
public static final java.lang.String formatDate(java.util.Date date, java.lang.String pattern, java.util.Locale locale, java.util.TimeZone timezone, java.lang.String dateStyle, java.lang.String timeStyle)
date
- the time value to be formatted into a time string.pattern
- the pattern describing the date and time formatlocale
- The Locale to apply, if it is null,
The current locale given by Locales.getCurrent()
is used.timezone
- the time zone to apply, if it is null,
The current timezone given by TimeZones.getCurrent()
is used.dateStyle
- styling index of date.timeStyle
- styling index of time.public static final java.util.Date parseDate(java.lang.String source, java.lang.String pattern, java.util.Locale locale, java.util.TimeZone timezone, java.lang.String dateStyle, java.lang.String timeStyle) throws java.lang.Exception
source
- A String
whose beginning should be parsed.pattern
- the pattern describing the date and time formatlocale
- The Locale to apply, if it is null,
The current locale given by Locales.getCurrent()
is used.timezone
- the time zone to apply, if it is null,
The current timezone given by TimeZones.getCurrent()
is used.dateStyle
- styling index of date.timeStyle
- styling index of time.Date
parsed from the string.java.lang.Exception
public static final java.lang.String formatNumber(java.lang.Object number, java.lang.String pattern, java.util.Locale locale)
A utility to assist the handling of numeric data.
number
- The number to format.pattern
- The pattern to apply, if it is null,
the system's default format is used.locale
- The Locale to apply, if it is null,
The current locale given by Locales.getCurrent()
is used.public static final java.lang.Number parseNumber(java.lang.String source, java.lang.String pattern, java.util.Locale locale) throws java.lang.Exception
source
- A String
whose beginning should be parsed.pattern
- the pattern describing the date and time formatlocale
- The Locale to apply, if it is null,
The current locale given by Locales.getCurrent()
is used.Number
parsed from the string.java.lang.Exception
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.