Extending classes must implement a proper String to T conversion in ObjectConversion#fromString(String)
This abstract class provides default results for conversions when the input is null.
It also provides a default implementation of ObjectConversion#revert(Object) that returns the result of input.toString()
| Access | Constructor and Description |
|---|---|
| public | ObjectConversion()
Creates a Conversion from String to an Object with default values to return when the input is null. |
| public | ObjectConversion(T
default value of type T to be returned when the input String is null. Used when valueIfStringIsNull, String ObjectConversion#execute(String) is invoked.default String value to be returned when an input of type T is null. Used when valueIfObjectIsNull)ObjectConversion#revert(Object) is invoked.Creates a Conversion from String to an Object with default values to return when the input is null. |
| Modifier and Type | Method and Description |
|---|---|
| public T | Returns: the conversion result, or the value ofObjectConversion#getValueIfStringIsNull() if the input String is null.the input String to be converted to an object of type T input)Overrides com. Implements com. |
| protected final T | Returns: an instance of T, converted from the String input.The String to be converted to T input)Implements abstract com. |
| protected abstract T | Returns: an instance of T, converted from the String input.The String to be converted to T input)Creates an instance of T from a String representation. |
| public String | Returns: the default String value used when converting from a null inputreturns default String value to be returned when an input of type T is null. |
| public T | Returns: the default value of type T used when converting from a null inputreturns a default value of type T to be returned when the input String is null. |
| public String | Returns: the conversion result, or the value ofObjectConversion#getValueIfObjectIsNull() if the input object is null.the input of type T to be converted to a String input)Overrides com. Implements com. This is a general implementation that simply returns the result of input.toString() |
| public void | setValueIfObjectIsNull(String
a default value of type T when converting from a null input valueIfObjectIsNull)returns default value of type T which should be returned when the input String is null. |
| public void | setValueIfStringIsNull(T
the default value of type T when converting from a null input valueIfStringIsNull)defines a default value of type T which should be returned when the input String is null. |
| protected final String | undo(T
the input object to be converted to I input)Implements abstract com. |
| ObjectConversion | back to summary |
|---|---|
| public ObjectConversion() Creates a Conversion from String to an Object with default values to return when the input is null. The default constructor assumes the output of a conversion should be null when input is null | |
| ObjectConversion | back to summary |
|---|---|
| public ObjectConversion(T valueIfStringIsNull, String valueIfObjectIsNull) Creates a Conversion from String to an Object with default values to return when the input is null.
| |
| execute | back to summary |
|---|---|
| public T execute(String input) Overrides com. Implements com. Converts the given String to an instance of T
| |
| fromInput | back to summary |
|---|---|
| protected final T fromInput(String input) Implements abstract com. Creates an instance of T from a String representation.
| |
| fromString | back to summary |
|---|---|
| protected abstract T fromString(String input) Creates an instance of T from a String representation.
| |
| getValueIfObjectIsNull | back to summary |
|---|---|
| public String getValueIfObjectIsNull() returns default String value to be returned when an input of type T is null. Used when
| |
| getValueIfStringIsNull | back to summary |
|---|---|
| public T getValueIfStringIsNull() returns a default value of type T to be returned when the input String is null. Used when
| |
| revert | back to summary |
|---|---|
| public String revert(T input) Overrides com. Implements com. Converts a value of type T back to a String This is a general implementation that simply returns the result of input.toString()
| |
| setValueIfObjectIsNull | back to summary |
|---|---|
| public void setValueIfObjectIsNull(String valueIfObjectIsNull) returns default value of type T which should be returned when the input String is null. Used when
| |
| setValueIfStringIsNull | back to summary |
|---|---|
| public void setValueIfStringIsNull(T valueIfStringIsNull) defines a default value of type T which should be returned when the input String is null. Used when
| |
| undo | back to summary |
|---|---|
| protected final String undo(T input) Implements abstract com. Doc from com. Converts a value of type O back to I. | |