java.lang.Object | |
↳ | org.apache.commons.betwixt.strategy.ObjectStringConverter |
Known Direct Subclasses |
Known Indirect Subclasses |
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.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | FLAVOUR_OPTION_NAME | Standard name for option giving flavour |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Converts an object to a string representation.
| |||||||||||
This method is deprecated.
0.7 use
objectToString(Object, Class, Context) instead.
The preferred way to support flavours is by setting the
org.apache.commons.betwixt.FLAVOUR option.
This can then be retrieved by calling getOptions() | |||||||||||
This method is deprecated.
0.7 use
stringToObject(String, Class, Context) instead.
The preferred way to support flavours is by setting the
org.apache.commons.betwixt.FLAVOUR option.
This can then be retrieved by calling getOptions() | |||||||||||
Converts a string representation to an object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Standard name for option giving flavour
Converts an object to a string representation. This basic implementation returns object.toString() or an empty string if the given object is null.
object | the object to be converted, possibly null |
---|---|
type | the property class of the object, not null |
context | the context, not null |
This method is deprecated.
0.7 use objectToString(Object, Class, Context)
instead.
The preferred way to support flavours is by setting the
org.apache.commons.betwixt.FLAVOUR
option.
This can then be retrieved by calling getOptions()
Converts an object to a string representation. This basic implementation returns object.toString() or an empty string if the given object is null.
object | the object to be converted, possibly null |
---|---|
type | the property class of the object, not null |
flavour | a string allow symantic differences in formatting to be communicated |
context | the context, not null |
This method is deprecated.
0.7 use stringToObject(String, Class, Context)
instead.
The preferred way to support flavours is by setting the
org.apache.commons.betwixt.FLAVOUR
option.
This can then be retrieved by calling getOptions()
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.
value | the String to be converted |
---|---|
type | the property class to be returned (if possible), not null |
flavour | a string allow symantic differences in formatting to be communicated |
context | the context, not null |
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.
value | the String to be converted |
---|---|
type | the property class to be returned (if possible), not null |
context | the context, not null |