de.zeigermann.xml.simpleImporter
Class ConversionHelpers
public class ConversionHelpers
Collection of some simple conversion and fallback methods for convenience.
static boolean | getBoolean(String value, boolean fallBack) - Gets boolean value 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 .
|
getBoolean
public static boolean getBoolean(String value,
boolean fallBack)
Gets boolean value a string value.
value
- string value to get boolean fromfallBack
- fall back value
- boolean representation of value
fallBack
if it can not properly be converted to a boolean
getInt
public static int getInt(String value)
Gets int value from a string value.
value
- string value to get int from
- int representation of value or
-1
if it can not be converted to an int
getInt
public static int getInt(String value,
int fallBack)
Gets int value from a string value.
value
- string value to get int fromfallBack
- fall back value
- int representation of value or
fallBack
if it can not be converted to an int
getLong
public static long getLong(String value)
Gets long value from a string value.
value
- string value to get long from
- long representation of value or
-1L
if it can not be converted to a long
getLong
public static long getLong(String value,
long fallBack)
Gets long value from a string value.
value
- string value to get long fromfallBack
- fall back value
- long representation of value or
fallBack
if it can not be converted to a long
getString
public static String getString(String value,
String fallBack)
Returns value
if not null, otherwise fallBack
.
Copyright B) 2002-2004 Oliver Zeigermann. All Rights Reserved.