public class SwitchConverter<I,O>
extends java.lang.Object
implements org.srplib.conversion.Converter<I,O>
Input value is used as a key to configured map. If map contains no mapping for specified value then null is returned or an exception is thrown depending on strict property
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_NO_MATCH_MESSAGE_PATTERN |
| Constructor and Description |
|---|
SwitchConverter(java.util.Map<I,O> map)
Construct converter using specified map.
|
SwitchConverter(java.util.Map<I,O> map,
O defaultValue) |
| Modifier and Type | Method and Description |
|---|---|
O |
convert(I input) |
void |
setNoMatchMessagePattern(java.lang.String pattern)
Set message pattern to be used to construct error message when no matches is found.
|
public static final java.lang.String DEFAULT_NO_MATCH_MESSAGE_PATTERN
public SwitchConverter(java.util.Map<I,O> map)
map - Map input value to output value map
then IllegalArgumentException is thrown, if false then null is returned.