V
- The type of value to be convertedpublic abstract class ConverterWrapper<V> extends Object implements Converter<V>
Converter
that can be subclassed to wrap another converter.Modifier and Type | Field and Description |
---|---|
protected Converter<V> |
converter
Wrapped converter.
|
Constructor and Description |
---|
ConverterWrapper(Converter<V> converter)
Constructs a new
ConverterWrapper with the specified
converter. |
Modifier and Type | Method and Description |
---|---|
boolean |
appendMessageArguments(ValidationContext<?> context,
Map<String,Object> arguments)
The default behavior of this method is to return
Converter.appendMessageArguments(ValidationContext, Map) on the
wrapped converter. |
<T> V |
decode(String value,
ValidationContext<T> context)
The default behavior of this method is to return
Converter.decode(String, ValidationContext) on the wrapped
converter. |
<T> String |
encode(V value,
ValidationContext<T> context)
The default behavior of this method is to return
Converter.encode(Object, ValidationContext) on the wrapped
converter. |
Converter<V> |
getConverter()
Returns wrapped converter.
|
String |
getMessageTemplate(ValidationContext<?> context)
The default behavior of this method is to return
Converter.getMessageTemplate(ValidationContext) on the wrapped
converter. |
Class<V> |
getType()
The default behavior of this method is to return
Converter.getType() on the wrapped converter. |
public ConverterWrapper(Converter<V> converter)
ConverterWrapper
with the specified
converter.converter
- Converter to be wrapped.IllegalArgumentException
- if the specified converter is
null
.public final Converter<V> getConverter()
public Class<V> getType()
Converter.getType()
on the wrapped converter.getType
in interface Converter<V>
getType
in interface Validation<V>
Converter.getType()
public String getMessageTemplate(ValidationContext<?> context)
Converter.getMessageTemplate(ValidationContext)
on the wrapped
converter.getMessageTemplate
in interface Converter<V>
getMessageTemplate
in interface Validation<V>
context
- Validation context.Converter.getMessageTemplate(ValidationContext)
public boolean appendMessageArguments(ValidationContext<?> context, Map<String,Object> arguments)
Converter.appendMessageArguments(ValidationContext, Map)
on the
wrapped converter.appendMessageArguments
in interface Converter<V>
appendMessageArguments
in interface Validation<V>
context
- Validation context.arguments
- Arguments to be substituted into the error message
template.true
if error message template needs to be rendered;
false
otherwise.Converter.appendMessageArguments(ValidationContext, Map)
public <T> V decode(String value, ValidationContext<T> context)
Converter.decode(String, ValidationContext)
on the wrapped
converter.decode
in interface Converter<V>
T
- The type of validated entity.value
- String representation of value.context
- Validation context.Converter.decode(String, ValidationContext)
public <T> String encode(V value, ValidationContext<T> context)
Converter.encode(Object, ValidationContext)
on the wrapped
converter.encode
in interface Converter<V>
T
- The type of validated entity.value
- Value to be encoded.context
- Validation context.Converter.encode(Object, ValidationContext)
Copyright © 2011–2020 FoxLabs. All rights reserved.