|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.portal.lang.TypeConverter
public final class TypeConverter
The TypeConverter class provides efficient and
consistent static type converter utilities for the basic types.
| Field Summary | |
|---|---|
static String |
FALSE
Canonical string representation of false. |
static String |
TRUE
Canonical string representation of true. |
| Method Summary | |
|---|---|
static boolean |
isInt(String value)
Returns true if the value can be parsed to an
int. |
static boolean |
toBoolean(String value)
Returns the boolean value represented by the
specified string, ignoring case. |
static byte |
toByte(String value)
Returns a signed decimal byte value. |
static char |
toChar(String value)
Returns the first character of the string. |
static double |
toDouble(String value)
Returns a new double initialized to the value represented by the specified String, as performed by the valueOf method of class Double. |
static float |
toFloat(String value)
Returns a new float initialized to the value represented by the specified String, as performed by the valueOf method of class Double. |
static String |
toHexString(byte[] values)
Returns a hexidecimal string representation of the specified byte array. |
static String |
toHexString(long value)
Converts a long value to a hexidecimal string. |
static int |
toInt(String value)
Parses the string argument as a signed decimal integer. |
static long |
toLong(String value)
Parses the string argument as a signed long in the radix specified by the second argument. |
static short |
toShort(String value)
Returns the short representation of the specified
string. |
static String |
toString(boolean value)
Returns a canonical String object representing the
specified boolean. |
static String |
toString(byte value)
Returns a string representation of the argument of radix 10. |
static String |
toString(char value)
Returns a string representation of the argument. |
static String |
toString(double value)
Returns a string representation of the specified double. |
static String |
toString(float value)
Returns a string representation of the specified float. |
static String |
toString(int value)
Returns a string representation of the specified int. |
static String |
toString(long value)
Returns a string representation of the specified long. |
static String |
toString(short value)
Returns a string representation of the specified short value of radix 10. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TRUE
true.
public static final String FALSE
false.
| Method Detail |
|---|
public static final String toString(boolean value)
String object representing the
specified boolean. If the value is
true, the string "true" will be
returned; if the value is false, the string
"false".
value - boolean value to be converted
boolean valuepublic static final boolean toBoolean(String value)
boolean value represented by the
specified string, ignoring case. If the value is neither
"true", nor "false" (ignoring case),
an IllegalArgumentException is thrown.
Note: This implementation is different than the
java.lang.Boolean implementation. The
java.lang.Boolean treats null and any
non-"true" value (ignoring case) as
false, i.e., there is no validation of
false values.
value - string representation of a boolean value
boolean value represented by the argument
IllegalArgumentException - if value is (ignoring case)
neither "true", nor "false"public static final String toString(byte value)
value - byte value to be converted
public static final byte toByte(String value)
byte value. The
characters in the string must all be decimal digits, except
that the first character may be an ASCII minus sign '-'
('-') to indicate a negative value.
value - string representation of a byte value
byte value represented by the argument
IllegalArgumentException - if argument is not a parseable
bytepublic static final String toString(char value)
value - char value to be converted
public static final char toChar(String value)
value - string representation of the char
char representation of the argument
IllegalArgumentException - if value is
null or of zero lengthpublic static final String toString(short value)
short value of radix 10.
value - short value to be converted
public static final short toShort(String value)
short representation of the specified
string. The characters in the string must all be decimal
digits, except that the first character may be an ASCII minus
sign '-' ('-') to indicate a negative value.
value - string representation of the short
short representation of the argument
IllegalArgumentException - if argument is not a parseable
shortpublic static final String toString(int value)
int.
value - int >value to be converted
public static final int toInt(String value)
value - string representation of the int
int representation of the argument
IllegalArgumentException - if string does not contain a
parseable intpublic static final boolean isInt(String value)
true if the value can be parsed to an
int.
value - string representation of the int
true if argument is an int;
otherwise falsepublic static final String toString(long value)
long.
value - long value to be converted
public static final long toLong(String value)
value - string representation of the long
long representation of the argument
IllegalArgumentException - if string does not contain a
parseable longpublic static final String toString(float value)
float.
value - float value to be converted
public static final float toFloat(String value)
value - string representation of the long
long representation of the argument
IllegalArgumentException - if string does not contain a
parseable longpublic static final String toString(double value)
double.
value - double value to be converted
public static final double toDouble(String value)
value - string representation of the long
long representation of the argument
IllegalArgumentException - if string does not contain a
parseable longpublic static final String toHexString(byte[] values)
values - byte array to be converted
public static final String toHexString(long value)
value - long to be converted
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||