de.zeigermann.xml.simpleImporter
Class ConversionHelpers

java.lang.Object
  |
  +--de.zeigermann.xml.simpleImporter.ConversionHelpers

public class ConversionHelpers
extends Object

Collection of some simple conversion and fallback methods for convenience.

Author:
Olli Z.

Constructor Summary
ConversionHelpers()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionHelpers

public ConversionHelpers()
Method Detail

getString

public static String getString(String value,
                               String fallBack)
Returns value if not null, otherwise fallBack.


getInt

public static int getInt(String value)
Gets int value from a string value.

Parameters:
value - string value to get int from
Returns:
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.

Parameters:
value - string value to get int from
fallBack - fall back value
Returns:
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.

Parameters:
value - string value to get long from
Returns:
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.

Parameters:
value - string value to get long from
fallBack - fall back value
Returns:
long representation of value or fallBack if it can not be converted to a long

getBoolean

public static boolean getBoolean(String value,
                                 boolean fallBack)
Gets boolean value a string value.

Parameters:
value - string value to get boolean from
fallBack - fall back value
Returns:
boolean representation of value fallBack if it can not properly be converted to a boolean


Copyright 2002-2003 Oliver Zeigermann. All Rights Reserved.