|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.conversions.NullConversion<String,T>
com.univocity.parsers.conversions.ObjectConversion<T>
T - The object type resulting from conversions of String values.public abstract class ObjectConversion<T>
Default implementation for conversions from an input String to Objects of a given type T
Extending classes must implement a proper String to T conversion in fromString(String)
This abstract class provides default results for conversions when the input is null.
It also provides a default implementation of revert(Object) that returns the result of input.toString()
| Constructor Summary | |
|---|---|
ObjectConversion()
Creates a Conversion from String to an Object with default values to return when the input is null. |
|
ObjectConversion(T valueIfStringIsNull,
String valueIfObjectIsNull)
Creates a Conversion from String to an Object with default values to return when the input is null. |
|
| Method Summary | |
|---|---|
T |
execute(String input)
Converts the given String to an instance of T |
protected T |
fromInput(String input)
Creates an instance of T from a String representation. |
protected abstract T |
fromString(String input)
Creates an instance of T from a String representation. |
String |
getValueIfObjectIsNull()
returns default String value to be returned when an input of type T is null. |
T |
getValueIfStringIsNull()
returns a default value of type T to be returned when the input String is null. |
String |
revert(T input)
Converts a value of type T back to a String |
void |
setValueIfObjectIsNull(String valueIfObjectIsNull)
returns default value of type T which should be returned when the input String is null. |
void |
setValueIfStringIsNull(T valueIfStringIsNull)
defines a default value of type T which should be returned when the input String is null. |
protected String |
undo(T input)
Converts a value of type O back to I. |
| Methods inherited from class com.univocity.parsers.conversions.NullConversion |
|---|
getValueOnNullInput, getValueOnNullOutput, setValueOnNullInput, setValueOnNullOutput |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ObjectConversion()
public ObjectConversion(T valueIfStringIsNull,
String valueIfObjectIsNull)
valueIfStringIsNull - default value of type T to be returned when the input String is null. Used when execute(String) is invoked.valueIfObjectIsNull - default String value to be returned when an input of type T is null. Used when revert(Object) is invoked.| Method Detail |
|---|
public T execute(String input)
execute in interface Conversion<String,T>execute in class NullConversion<String,T>input - the input String to be converted to an object of type T
getValueIfStringIsNull() if the input String is null.protected final T fromInput(String input)
fromInput in class NullConversion<String,T>input - The String to be converted to T
protected abstract T fromString(String input)
input - The String to be converted to T
public String revert(T input)
This is a general implementation that simply returns the result of input.toString()
revert in interface Conversion<String,T>revert in class NullConversion<String,T>input - the input of type T to be converted to a String
getValueIfObjectIsNull() if the input object is null.protected final String undo(T input)
NullConversion
undo in class NullConversion<String,T>input - the input object to be converted to I
public T getValueIfStringIsNull()
execute(String) is invoked.
public String getValueIfObjectIsNull()
revert(Object) is invoked.
public void setValueIfStringIsNull(T valueIfStringIsNull)
execute(String) is invoked.
valueIfStringIsNull - the default value of type T when converting from a null inputpublic void setValueIfObjectIsNull(String valueIfObjectIsNull)
revert(Object) is invoked.
valueIfObjectIsNull - a default value of type T when converting from a null input
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||