This class supports multiple representations of null values. For example, you can define conversions from different Strings such as "N/A, ?, -" to null.
The reverse conversion from a null to String (in NullStringConversion#revert(Object) will return the first String provided in this class constructor if the object is null.
Using the previous example, a call to NullStringConversion#revert(Object) will produce "N/A".
| Access | Constructor and Description |
|---|---|
| public | NullStringConversion(String...
Strings that identify a true value. The first element will be returned when executing nullRepresentations)NullStringConversion#revert(Object)Creates conversions from Strings to null. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: null if the string representation of the object matches any one of the Strings provided in the constructor of this class. Otherwise, the original object will be returned.an Object to be converted to null. input)Implements com. |
| public Object | Returns: If the input is null, the string representation for null objects. Otherwise, the original object will be returned.an Object that, if null, will be transformed to a String. input)Implements com. |
| defaultNullString | back to summary |
|---|---|
| private final String defaultNullString | |
| nullStrings | back to summary |
|---|---|
| private final Set<String> nullStrings | |
| NullStringConversion | back to summary |
|---|---|
| public NullStringConversion(String... nullRepresentations) Creates conversions from Strings to null. The list of Strings that identify nulls are mandatory.
| |
| execute | back to summary |
|---|---|
| public Object execute(Object input) Implements com. Converts an Object to null. The string representation of the object will be used to match the string elements provided in the constructor. | |
| revert | back to summary |
|---|---|
| public Object revert(Object input) Implements com. Converts a null input to a String representation. The String returned will be the first element provided in the constructor of this class. | |