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 [joe at eireneh dot com]
See Also:
for license details. The copyright to this program is held by it's authors.

Field Summary
private static 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 class2String(Class data)
          Convert a Class to a String
static String int2String(int data)
          Convert an int to a String
static String map2String(Map commands)
          Convert a Hashtable 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 Class string2Class(String data)
          Convert a String to a Class
static Map string2Hashtable(String data, Class superclass)
          Convert a String to a Hashtable, with type checking
static int string2Int(String data)
          Convert a String to an int
static Map string2Map(String data)
          Convert a String to a Hashtable, without type checking
static Object string2Object(String data)
          Convert a String to an Object
static String[] string2StringArray(String value, String separator)
          Convert a String to a StringArray
static String stringArray2String(String[] value, String separator)
          Convert a StringArray to a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final 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
ClassNotFoundException
IllegalAccessException

object2String

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

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

string2Class

public static Class string2Class(String data)
                          throws ClassNotFoundException
Convert a String to a Class

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

class2String

public static String class2String(Class data)
Convert a Class to a String

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

string2Hashtable

public static Map string2Hashtable(String data,
                                   Class superclass)
Convert a String to a Hashtable, with type checking

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

string2Map

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

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

map2String

public static String map2String(Map commands)
Convert a Hashtable to a Sting

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

string2StringArray

public static String[] string2StringArray(String value,
                                          String separator)
Convert a String to a StringArray

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

stringArray2String

public static String stringArray2String(String[] value,
                                        String separator)
Convert a StringArray to a String

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

Copyright ยจ 2003-2005