TYPE
- Type of the data being converted.public class DesignToStringConverter<TYPE> extends Object implements Converter<String,TYPE>
DesignAttributeHandler
that deals with converting
various types to string.Modifier and Type | Field and Description |
---|---|
static String |
NULL_VALUE_REPRESENTATION
A string that corresponds to how a null value is stored.
|
Constructor and Description |
---|
DesignToStringConverter(Class<? extends TYPE> type)
Constructs the converter for a given type.
|
DesignToStringConverter(Class<? extends TYPE> type,
String staticMethodName)
Constructs the converter for a given type, giving the name of the public
static method that does the conversion from String.
|
Modifier and Type | Method and Description |
---|---|
Result<TYPE> |
convertToModel(String value,
ValueContext context)
Converts the given value from model type to presentation type.
|
String |
convertToPresentation(TYPE value,
ValueContext context)
Converts the given value from presentation type to model type.
|
public static final String NULL_VALUE_REPRESENTATION
public DesignToStringConverter(Class<? extends TYPE> type)
valueOf(String)
is present in the type to do the
conversion.type
- Type of values to convert.public DesignToStringConverter(Class<? extends TYPE> type, String staticMethodName)
type
- Type to convert.staticMethodName
- Method to call when converting from String to this type. This
must be public and static method that returns an object of
passed type.public Result<TYPE> convertToModel(String value, ValueContext context)
Converter
A converter can optionally use locale to do the conversion.
convertToModel
in interface Converter<String,TYPE>
value
- The value to convert. Can be nullcontext
- The value context for the conversion.public String convertToPresentation(TYPE value, ValueContext context)
Converter
A converter can optionally use locale to do the conversion.
convertToPresentation
in interface Converter<String,TYPE>
value
- The value to convert. Can be nullcontext
- The value context for the conversion.Copyright © 2020 Vaadin Ltd. All rights reserved.