public class NullStringConversion extends Object implements Conversion<Object,Object>
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 revert(Object) will return the first String provided in this class constructor if the object is null.
Using the previous example, a call to revert(Object) will produce "N/A".
| Constructor and Description |
|---|
NullStringConversion(String... nullRepresentations)
Creates conversions from Strings to null.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
execute(Object input)
Converts an Object to null.
|
Object |
revert(Object input)
Converts a null input to a String representation.
|
public NullStringConversion(String... nullRepresentations)
The list of Strings that identify nulls are mandatory.
nullRepresentations - Strings that identify a true value. The first element will be returned when executing revert(Object)public Object execute(Object input)
execute in interface Conversion<Object,Object>input - an Object to be converted to null.public Object revert(Object input)
revert in interface Conversion<Object,Object>input - an Object that, if null, will be transformed to a String.Copyright © 2021 Univocity Software Pty Ltd. All rights reserved.