de.intarsys.tools.string
Class Converter
java.lang.Object
de.intarsys.tools.string.Converter
public class Converter
- extends Object
Simple string conversion utilities;
|
Method Summary |
static boolean |
asBoolean(String booleanString)
|
static boolean |
asBoolean(String booleanString,
boolean defaultValue)
|
static boolean |
asBooleanChecked(String booleanString,
boolean defaultValue)
|
static byte[] |
asBytes(String str)
|
static double |
asDouble(String str)
|
static double |
asDouble(String str,
double defaultValue)
|
static double |
asDoubleChecked(String str,
double defaultValue)
|
static File |
asFile(String pValue)
|
static float |
asFloat(String str)
|
static float |
asFloat(String str,
float defaultValue)
|
static float[] |
asFloatArray(String value)
|
static float |
asFloatChecked(String str,
float defaultValue)
|
static int[] |
asIntArray(String value)
|
static int |
asInteger(String str)
|
static int |
asInteger(String str,
int defaultValue)
|
static int |
asIntegerChecked(String str,
int defaultValue)
|
static List<String> |
asList(String string)
|
static long |
asLong(String str)
|
static long |
asLong(String str,
long defaultValue)
|
static long |
asLongChecked(String str,
long defaultValue)
|
static Map<String,String> |
asMap(String string)
Read a Map from string. |
static Map<String,Boolean> |
asMapBoolean(String string)
|
static String |
asString(String str,
String defaultValue)
|
static String[] |
asStringArray(String value)
|
static Boolean |
asThreeState(String booleanString)
|
static Boolean |
asThreeState(String booleanString,
Boolean defaultValue)
|
ELEMENT_SEPARATOR
public static final String ELEMENT_SEPARATOR
- See Also:
- Constant Field Values
KEY_VALUE_SEPARATOR
public static final String KEY_VALUE_SEPARATOR
- See Also:
- Constant Field Values
asBoolean
public static boolean asBoolean(String booleanString)
throws ConverterException
- Throws:
ConverterException
asBoolean
public static boolean asBoolean(String booleanString,
boolean defaultValue)
asBooleanChecked
public static boolean asBooleanChecked(String booleanString,
boolean defaultValue)
throws ConverterException
- Throws:
ConverterException
asBytes
public static byte[] asBytes(String str)
throws ConverterException
- Throws:
ConverterException
asDouble
public static double asDouble(String str)
throws ConverterException
- Throws:
ConverterException
asDouble
public static double asDouble(String str,
double defaultValue)
asDoubleChecked
public static double asDoubleChecked(String str,
double defaultValue)
throws ConverterException
- Throws:
ConverterException
asFile
public static File asFile(String pValue)
throws ConverterException
- Throws:
ConverterException
asFloat
public static float asFloat(String str)
throws ConverterException
- Throws:
ConverterException
asFloat
public static float asFloat(String str,
float defaultValue)
asFloatArray
public static float[] asFloatArray(String value)
asFloatChecked
public static float asFloatChecked(String str,
float defaultValue)
throws ConverterException
- Throws:
ConverterException
asIntArray
public static int[] asIntArray(String value)
asInteger
public static int asInteger(String str)
throws ConverterException
- Throws:
ConverterException
asInteger
public static int asInteger(String str,
int defaultValue)
asIntegerChecked
public static int asIntegerChecked(String str,
int defaultValue)
throws ConverterException
- Throws:
ConverterException
asList
public static List<String> asList(String string)
asLong
public static long asLong(String str)
throws ConverterException
- Throws:
ConverterException
asLong
public static long asLong(String str,
long defaultValue)
asLongChecked
public static long asLongChecked(String str,
long defaultValue)
throws ConverterException
- Throws:
ConverterException
asMap
public static Map<String,String> asMap(String string)
- Read a
Map from string.
string ::= entry [ ';' entry ]*
entry ::= key [ '=' value ]
key ::= id [ '.' id ]
- Parameters:
string -
- Returns:
- The parsed
Map
asMapBoolean
public static Map<String,Boolean> asMapBoolean(String string)
asString
public static String asString(String str,
String defaultValue)
asStringArray
public static String[] asStringArray(String value)
asThreeState
public static Boolean asThreeState(String booleanString)
throws ConverterException
- Throws:
ConverterException
asThreeState
public static Boolean asThreeState(String booleanString,
Boolean defaultValue)
Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.