| java.lang.Object org.apache.commons.betwixt.strategy.ObjectStringConverter
All known Subclasses: org.apache.commons.betwixt.strategy.ConvertUtilsObjectStringConverter,
ObjectStringConverter | public class ObjectStringConverter implements Serializable(Code) | | Strategy class for string <-> object conversions.
Implementations of this interface are used by Betwixt to perform
string <-> object conversions.
This performs only the most basic conversions.
Most applications will use a subclass.
It is strongly recommended that (in order to support round tripping)
that objectToString and stringToObject
are inverse functions.
In other words, given the same flavour, context and type the applying
objectToString to the result of stringToObject should be equal to the
original input.
author: Robert Burrell Donkin since: 0.5 |
Method Summary | |
public String | objectToString(Object object, Class type, String flavour, Context context) Converts an object to a string representation. | public String | objectToString(Object object, Class type, Context context) Converts an object to a string representation. | public Object | stringToObject(String value, Class type, String flavour, Context context) Converts a string representation to an object. | public Object | stringToObject(String value, Class type, Context context) Converts a string representation to an object. |
FLAVOUR_OPTION_NAME | final public static String FLAVOUR_OPTION_NAME(Code) | | Standard name for option giving flavour
|
objectToString | public String objectToString(Object object, Class type, String flavour, Context context)(Code) | | Converts an object to a string representation.
This basic implementation returns object.toString()
or an empty string if the given object is null.
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 Parameters: context - the context, not nullObjectStringConverter.objectToString(Object,Class,Context)Context.getOptions a String representation, not null |
objectToString | public String objectToString(Object object, Class type, Context context)(Code) | | Converts an object to a string representation.
This basic implementation returns object.toString()
or an empty string if the given object is null.
since: 0.7 Parameters: object - the object to be converted, possibly null Parameters: type - the property class of the object, not null Parameters: context - the context, not null a String representation, not null |
stringToObject | public Object stringToObject(String value, Class type, String flavour, Context context)(Code) | | Converts a string representation to an object.
It is acceptable for an implementation to return the string if it cannot convert
the string to the given class type.
This basic implementation just returns a string.
Parameters: value - the String to be converted Parameters: type - the property class to be returned (if possible), not null Parameters: flavour - a string allow symantic differences in formatting to be communicated Parameters: context - the context, not nullObjectStringConverter.stringToObject(String,Class,Context)Context.getOptions an Object converted from the String, not null |
stringToObject | public Object stringToObject(String value, Class type, Context context)(Code) | | Converts a string representation to an object.
It is acceptable for an implementation to return the string if it cannot convert
the string to the given class type.
This basic implementation just returns a string.
since: 0.7 Parameters: value - the String to be converted Parameters: type - the property class to be returned (if possible), not null Parameters: context - the context, not null an Object converted from the String, not null |
|
|