|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.silentq.util.Conversions
This class handles conversions between types. Each primitive type has its own method, and tries to make a best-guess conversion.
| Constructor Summary | |
Conversions()
|
|
| Method Summary | |
protected static boolean |
convertToBoolean(java.lang.Object obj)
Returns true if the value is a Number and not equal to 0, a character equal to 't' or 'T', a boolean true value, or a String "true". |
protected static byte |
convertToByte(java.lang.Object obj)
Returns Number.byteValue() if possible, 1 for true, 0 for false, or new Byte(toString).byteValue(). |
protected static char |
convertToChar(java.lang.Object obj)
Returns the first character of a Number converted to a String, 't' for a boolean true value, 'f' for a boolean false value, or the first character in obj.toString(). |
protected static double |
convertToDouble(java.lang.Object obj)
Returns Number.doubleValue() if possible, 1 for true, 0 for false, the digit if it's a character and a digit, or new Double(toString).doubleValue(). |
protected static float |
convertToFloat(java.lang.Object obj)
Returns Number.floatValue() if possible, 1 for true, 0 for false, the digit if it's a character and a digit, or new Float(toString).floatValue(). |
protected static int |
convertToInt(java.lang.Object obj)
Returns Number.intValue() if possible, 1 for true, 0 for false, the digit if it's a character and a digit, or new Integer(toString).intValue(). |
protected static long |
convertToLong(java.lang.Object obj)
Returns Number.longValue() if possible, 1 for true, 0 for false, the digit if it's a character and a digit, or new Long(toString).longValue(). |
protected static short |
convertToShort(java.lang.Object obj)
Returns Number.shortValue() if possible, 1 for true, 0 for false, the digit if it's a character and a digit, or new Short(toString).shortValue(). |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public Conversions()
| Method Detail |
protected static int convertToInt(java.lang.Object obj)
protected static byte convertToByte(java.lang.Object obj)
protected static long convertToLong(java.lang.Object obj)
protected static short convertToShort(java.lang.Object obj)
protected static float convertToFloat(java.lang.Object obj)
protected static double convertToDouble(java.lang.Object obj)
protected static boolean convertToBoolean(java.lang.Object obj)
protected static char convertToChar(java.lang.Object obj)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||