|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.formatter.Formatter
ariba.util.formatter.LongFormatter
public class LongFormatter
LongFormatter
is a subclass of Formatter
which
is responsible for formatting, parsing, and comparing long
values and/or Long
objects.
Field Summary | |
---|---|
static java.lang.String |
ClassName
Our Java class name. |
Fields inherited from interface ariba.util.core.Compare |
---|
EqualTo, GreaterThan, LessThan |
Constructor Summary | |
---|---|
LongFormatter()
Creates a new LongFormatter . |
Method Summary | |
---|---|
static int |
compareLongs(long l1,
long l2)
Compares two long values for sorting purposes. |
static int |
compareLongs(java.lang.Long l1,
java.lang.Long l2)
Compares two Long objects for sorting purposes. |
static long |
getLongValue(java.lang.Object object)
Returns a long value derived from the given object in the
default locale. |
static java.lang.String |
getStringValue(long value)
Returns a formatted string for the given long value in
the default locale. |
static java.lang.String |
getStringValue(java.lang.Long object)
Returns a formatted string for the given Long in the
default locale. |
static java.lang.String |
getStringValue(long value,
java.util.Locale locale)
Returns a formatted string for the given long value in
the given locale. |
static java.lang.String |
getStringValue(java.lang.Long object,
java.util.Locale locale)
Returns a formatted string for the given Long in the
given locale. |
static java.lang.String |
getStringValue(long value,
java.util.Locale locale,
boolean useGrouping)
Returns a formatted string for the given long value in
the given locale. |
static java.lang.String |
getStringValue(java.lang.Long object,
java.util.Locale locale,
boolean useGrouping)
Returns a formatted string for the given Long in the
given locale. |
static java.lang.String |
getStringValue(long value,
java.util.Locale locale,
java.lang.String pattern)
Returns a formatted string for the given long value in
the given locale. |
static java.lang.String |
getStringValue(java.lang.Long object,
java.util.Locale locale,
java.lang.String pattern)
Returns a formatted string for the given Long in the
given locale. |
static java.lang.String |
getStringValue(long value,
java.util.Locale locale,
java.lang.String pattern,
boolean useGrouping)
Returns a formatted string for the given long value in
the given locale. |
static java.lang.String |
getStringValue(java.lang.Long object,
java.util.Locale locale,
java.lang.String pattern,
boolean useGrouping)
Returns a formatted string for the given Long in the
given locale. |
java.lang.Object |
getValue(java.lang.Object object,
java.util.Locale locale)
Returns a new Long derived from the given object in the
given locale. |
static long |
parseLong(java.lang.String string)
Tries to parse the given string as a long in the default
locale. |
static long |
parseLong(java.lang.String string,
java.util.Locale locale)
Tries to parse the given string as a long in the given
locale . |
static long |
parseLong(java.lang.String string,
java.util.Locale locale,
java.lang.String pattern)
Tries to parse the given string as a long in the given
locale . |
Methods inherited from class ariba.util.formatter.Formatter |
---|
canFormatNulls, compare, compare, equal, equal, getFormat, getFormat, getFormatterClassForType, getFormatterForObject, getFormatterForType, getLocale, getStringValue, getStringValue, getValue, handlesNulls, isBidirectional, makeParseException, makeParseException, makeParseException, makeParseExceptionMessage, makeParseExceptionMessage, objectsAreEqual, objectsAreEqual, parse, parse, parseString, parseString, quickCompare, quickCompare, quickCompareValue, registerFormatter |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ClassName
Constructor Detail |
---|
public LongFormatter()
LongFormatter
.
Method Detail |
---|
public static java.lang.String getStringValue(java.lang.Long object)
Long
in the
default locale.
object
- the Long
to format into a string
Long
public static java.lang.String getStringValue(java.lang.Long object, java.util.Locale locale)
Long
in the
given locale. The locale
parameter must be non-null.
object
- the Long
to format into a stringlocale
- the Locale
to use for formatting
Long
,
or empty string if the Long
is nullpublic static java.lang.String getStringValue(java.lang.Long object, java.util.Locale locale, java.lang.String pattern)
Long
in the
given locale. The locale
parameter must be non-null.
object
- the Long
to format into a stringlocale
- the Locale
to use for formattingpattern
- the DecimalFormat pattern to use for formatting
Long
,
or empty string if the Long
is nullDecimalFormat
public static java.lang.String getStringValue(java.lang.Long object, java.util.Locale locale, boolean useGrouping)
Long
in the
given locale. The locale
parameter must be non-null.
object
- the Long
to format into a stringlocale
- the Locale
to use for formattinguseGrouping
- whether grouping characters should be used
Long
,
or empty string if the Long
is nullpublic static java.lang.String getStringValue(java.lang.Long object, java.util.Locale locale, java.lang.String pattern, boolean useGrouping)
Long
in the
given locale. The locale
parameter must be non-null.
object
- the Long
to format into a stringlocale
- the Locale
to use for formattingpattern
- the DecimalFormat pattern to use for formattinguseGrouping
- whether grouping characters should be used
Long
,
or empty string if the Long
is nullDecimalFormat
public static java.lang.String getStringValue(long value)
long
value in
the default locale.
value
- the long
value to format into a string
long
public static java.lang.String getStringValue(long value, java.util.Locale locale)
long
value in
the given locale. The locale
parameter must be non-null.
value
- the long
value to format into a stringlocale
- the Locale
to use for formatting
long
public static java.lang.String getStringValue(long value, java.util.Locale locale, java.lang.String pattern)
long
value in
the given locale. The locale
parameter must be non-null.
value
- the long
value to format into a stringlocale
- the Locale
to use for formattingpattern
- the DecimalFormat pattern to use for formatting
long
DecimalFormat
public static java.lang.String getStringValue(long value, java.util.Locale locale, boolean useGrouping)
long
value in
the given locale. The locale
parameter must be non-null.
value
- the long
value to format into a stringlocale
- the Locale
to use for formattinguseGrouping
- whether grouping characters should be used
long
public static java.lang.String getStringValue(long value, java.util.Locale locale, java.lang.String pattern, boolean useGrouping)
long
value in
the given locale. The locale
parameter must be non-null.
value
- the long
value to format into a stringlocale
- the Locale
to use for formattingpattern
- the DecimalFormat pattern to use for formattinguseGrouping
- whether grouping characters should be used
long
DecimalFormat
public static long parseLong(java.lang.String string) throws java.text.ParseException
long
in the default
locale.
string
- the string to parse as a long
long
value derived from the string
java.text.ParseException
- if the string cannot be parsed as an
long
public static long parseLong(java.lang.String string, java.util.Locale locale) throws java.text.ParseException
long
in the given
locale
.
string
- the string to parse as a long
locale
- the Locale
to use for parsing
long
value derived from the string
java.text.ParseException
- if the string cannot be parsed as an
long
public static long parseLong(java.lang.String string, java.util.Locale locale, java.lang.String pattern) throws java.text.ParseException
long
in the given
locale
.
string
- the string to parse as a long
locale
- the Locale
to use for parsingpattern
- the DecimalFormat pattern to use for parsing
long
value derived from the string
java.text.ParseException
- if the string cannot be parsed as an
long
DecimalFormat
public static long getLongValue(java.lang.Object object)
long
value derived from the given object in the
default locale. If the object is not a Long
, it is
converted to a string and parsed. Returns zero if the object can't be
converted to a long
.
object
- the object to convert to an long
value
long
derived from the given objectpublic static int compareLongs(java.lang.Long l1, java.lang.Long l2)
Long
objects for sorting purposes. Returns
an int
value which is less than, equal to, or greater
than zero depending on whether the first object sorts before, the
same, or after the second object.
l1
- the first Long
to comparel2
- the second Long
to compare
int
value which determines how the two objects
should be orderedpublic static int compareLongs(long l1, long l2)
long
values for sorting purposes. Returns an
int
value which is less than, equal to, or greater than
zero depending on whether the first value sorts before, the same, or
after the second value.
l1
- the first long
value to comparel2
- the second long
value to compare
int
value which determines how the two values
should be orderedpublic java.lang.Object getValue(java.lang.Object object, java.util.Locale locale)
Long
derived from the given object in the
given locale. If the object is not a Long
, it is
converted to a string and parsed. Returns null if the object can't be
parsed as a Long
. The locale
parameter is
currently unused.
getValue
in class Formatter
object
- the object to convert to a Long
locale
- the Locale
to use for conversion (unused)
Long
derived from the given object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |