|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.xmlio.in.ConversionHelpers
public class ConversionHelpers
Collection of some simple conversion and fallback methods for convenience.
Constructor Summary | |
---|---|
ConversionHelpers()
|
Method Summary | |
---|---|
static boolean |
getBoolean(String value,
boolean fallBack)
Gets boolean value from a string value. |
static int |
getInt(String value)
Gets int value from a string value. |
static int |
getInt(String value,
int fallBack)
Gets int value from a string value. |
static long |
getLong(String value)
Gets long value from a string value. |
static long |
getLong(String value,
long fallBack)
Gets long value from a string value. |
static String |
getString(String value,
String fallBack)
Returns value if not null, otherwise fallBack . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConversionHelpers()
Method Detail |
---|
public static String getString(String value, String fallBack)
value
if not null, otherwise fallBack
.
public static int getInt(String value)
value
- string value to get int from
-1
if it can not be converted to an intpublic static int getInt(String value, int fallBack)
value
- string value to get int fromfallBack
- fall back value
fallBack
if it can not be converted to an intpublic static long getLong(String value)
value
- string value to get long from
-1L
if it can not be converted to a longpublic static long getLong(String value, long fallBack)
value
- string value to get long fromfallBack
- fall back value
fallBack
if it can not be converted to a longpublic static boolean getBoolean(String value, boolean fallBack)
value
- string value to get boolean fromfallBack
- fall back value
fallBack
if it can not properly be converted to a boolean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |