public class JavaStringConversions extends Object
java.lang.Class and java.io.File.
A single instance of this object will be associated with each converter.
| Constructor and Description |
|---|
JavaStringConversions(boolean useXsdFormat) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isConvertableToString(Class<?> klass)
Determines whether the objects of the specified class have a simple string
representation.
|
boolean |
isConvertableToString(Object obj)
Determines whether the passed object has a simple string representation.
|
Object |
parse(String value,
Class<?> klass)
Parses the passed string as a Java primitive object of the specified
type.
|
String |
stringify(Object value)
Converts a Java primitive object to a string representation.
|
public JavaStringConversions(boolean useXsdFormat)
useXsdFormat - If true, conversions will use the
format defined in the XML Schema specification
(if any). If false, or there is no
specification, will use toString()
for stringification, and parse appropriately.public boolean isConvertableToString(Object obj)
public boolean isConvertableToString(Class<?> klass)
public String stringify(Object value)
null if passed null.value - The object to convert.ConversionException - if the passed object does not have a string
representation (ie, is not a primitive value).public Object parse(String value, Class<?> klass)
TypeUtils.class2type(java.lang.Class<?>) for the passed class. Returns null
if passed null.value - String representation.klass - Desired class for resulting object.ConversionException - if unable to parse.