| java.lang.Object org.apache.commons.betwixt.strategy.ObjectStringConverter org.apache.commons.betwixt.strategy.ConvertUtilsObjectStringConverter org.apache.commons.betwixt.strategy.DefaultObjectStringConverter
DefaultObjectStringConverter | public class DefaultObjectStringConverter extends ConvertUtilsObjectStringConverter (Code) | | Default string <-> object conversion strategy.
This delegates to ConvertUtils except when the type
is assignable from java.util.Date
but not from java.sql.Date .
In this case, the format used is (in SimpleDateFormat terms)
EEE MMM dd HH:mm:ss zzz yyyy .
This is the same as the output of the toString method on java.util.Date.
This should preserve the existing symantic behaviour whilst allowing round tripping of dates
(given the default settings).
author: Robert Burrell Donkin since: 0.5 |
Method Summary | |
protected void | handleException(Exception e) Allow subclasses to use a different exception handling strategy. | public String | objectToString(Object object, Class type, String flavour, Context context) Converts an object to a string representation using ConvertUtils.
If the object is a java.util.Date and the type is java.util.Date
but not java.sql.Date
then SimpleDateFormat formatting to
EEE MMM dd HH:mm:ss zzz yyyy
will be used. | public Object | stringToObject(String value, Class type, String flavour, Context context) Converts an object to a string representation using ConvertUtils. |
handleException | protected void handleException(Exception e)(Code) | | Allow subclasses to use a different exception handling strategy.
This class throws a org.apache.commons.beanutils.ConversionException
when conversion fails.
Parameters: e - the Exception to be handled throws: org.apache.commons.beanutils.ConversionException - when conversion fails |
objectToString | public String objectToString(Object object, Class type, String flavour, Context context)(Code) | | Converts an object to a string representation using ConvertUtils.
If the object is a java.util.Date and the type is java.util.Date
but not java.sql.Date
then SimpleDateFormat formatting to
EEE MMM dd HH:mm:ss zzz yyyy
will be used.
(This is the same as java.util.Date toString would return.)
Parameters: object - the object to be converted, possibly null Parameters: type - the property class of the object, not null Parameters: flavour - a string allow symantic differences in formatting to be communicated (ignored) Parameters: context - convert against this context not null a String representation, not null |
stringToObject | public Object stringToObject(String value, Class type, String flavour, Context context)(Code) | | Converts an object to a string representation using ConvertUtils.
Parameters: value - the String to be converted, not null Parameters: type - the property class to be returned (if possible), not null Parameters: flavour - a string allow symantic differences in formatting to be communicated (ignored) Parameters: context - not null an Object converted from the String, not null |
Fields inherited from org.apache.commons.betwixt.strategy.ObjectStringConverter | final public static String FLAVOUR_OPTION_NAME(Code)(Java Doc)
|
Methods inherited from org.apache.commons.betwixt.strategy.ObjectStringConverter | public String objectToString(Object object, Class type, String flavour, Context context)(Code)(Java Doc) public String objectToString(Object object, Class type, Context context)(Code)(Java Doc) public Object stringToObject(String value, Class type, String flavour, Context context)(Code)(Java Doc) public Object stringToObject(String value, Class type, Context context)(Code)(Java Doc)
|
|
|