org.crosswire.common.util
Class Convert

java.lang.Object
  extended by org.crosswire.common.util.Convert

public final class Convert
extends Object

Conversions between various types and Strings.

Author:
Joe Walker
See Also:
The GNU Lesser General Public License for details.

Field Summary
private static org.slf4j.Logger log
          The log stream
 
Constructor Summary
private Convert()
          We don't want anyone doing this ...
 
Method Summary
static String boolean2String(boolean data)
          Convert a boolean to a String
static String int2String(int data)
          Convert an int to a String
static String map2String(Map<? extends Object,? extends Object> commands)
          Convert a Map to a Sting
static String object2String(Object data)
          Convert an Object to a String
static boolean string2Boolean(String data)
          Convert a String to a boolean
static int string2Int(String data)
          Convert a String to an int
static PropertyMap string2Map(String data)
          Convert a String to a Map, without type checking
static Object string2Object(String data)
          Convert a String to an Object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.slf4j.Logger log
The log stream

Constructor Detail

Convert

private Convert()
We don't want anyone doing this ...

Method Detail

string2Boolean

public static boolean string2Boolean(String data)
Convert a String to a boolean

Parameters:
data - the thing to convert
Returns:
the converted data

boolean2String

public static String boolean2String(boolean data)
Convert a boolean to a String

Parameters:
data - the thing to convert
Returns:
the converted data

string2Int

public static int string2Int(String data)
Convert a String to an int

Parameters:
data - the thing to convert
Returns:
the converted data

int2String

public static String int2String(int data)
Convert an int to a String

Parameters:
data - the thing to convert
Returns:
the converted data

string2Object

public static Object string2Object(String data)
                            throws InstantiationException,
                                   ClassNotFoundException,
                                   IllegalAccessException
Convert a String to an Object

Parameters:
data - the thing to convert
Returns:
the converted data
Throws:
InstantiationException - if this data represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
ClassNotFoundException - if the class is not found
IllegalAccessException - if the class or its nullary constructor is not accessible.

object2String

public static String object2String(Object data)
Convert an Object to a String

Parameters:
data - the thing to convert
Returns:
the converted data

string2Map

public static PropertyMap string2Map(String data)
Convert a String to a Map, without type checking

Parameters:
data - the thing to convert
Returns:
the converted data

map2String

public static String map2String(Map<? extends Object,? extends Object> commands)
Convert a Map to a Sting

Parameters:
commands - the thing to convert
Returns:
the converted data

Copyright ยจ 2003-2015