|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.ui.declarative.converters.DesignToStringConverter<TYPE>
TYPE
- Type of the data being converted.public class DesignToStringConverter<TYPE>
Utility class for DesignAttributeHandler
that deals with converting
various types to string.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.vaadin.data.util.converter.Converter |
---|
Converter.ConversionException |
Field Summary | |
---|---|
static java.lang.String |
NULL_VALUE_REPRESENTATION
A string that corresponds to how a null value is stored. |
Constructor Summary | |
---|---|
DesignToStringConverter(java.lang.Class<? extends TYPE> type)
Constructs the converter for a given type. |
|
DesignToStringConverter(java.lang.Class<? extends TYPE> type,
java.lang.String staticMethodName)
Constructs the converter for a given type, giving the name of the public static method that does the conversion from String. |
Method Summary | |
---|---|
TYPE |
convertToModel(java.lang.String value,
java.lang.Class<? extends TYPE> targetType,
java.util.Locale locale)
Converts the given value from target type to source type. |
java.lang.String |
convertToPresentation(TYPE value,
java.lang.Class<? extends java.lang.String> targetType,
java.util.Locale locale)
Converts the given value from source type to target type. |
java.lang.Class<TYPE> |
getModelType()
The source type of the converter. |
java.lang.Class<java.lang.String> |
getPresentationType()
The target type of the converter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NULL_VALUE_REPRESENTATION
Constructor Detail |
---|
public DesignToStringConverter(java.lang.Class<? extends TYPE> type)
valueOf(String)
is present in the type to do the
conversion.
type
- Type of values to convert.public DesignToStringConverter(java.lang.Class<? extends TYPE> type, java.lang.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.Method Detail |
---|
public TYPE convertToModel(java.lang.String value, java.lang.Class<? extends TYPE> targetType, java.util.Locale locale) throws Converter.ConversionException
Converter
A converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale)
and
Converter.convertToModel(Object, Class, Locale)
should return the original
value.
convertToModel
in interface Converter<java.lang.String,TYPE>
value
- The value to convert, compatible with the target type. Can be
nulltargetType
- The requested type of the return valuelocale
- The locale to use for conversion. Can be null.
Converter.ConversionException
- If the value could not be convertedpublic java.lang.String convertToPresentation(TYPE value, java.lang.Class<? extends java.lang.String> targetType, java.util.Locale locale) throws Converter.ConversionException
Converter
A converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale)
and
Converter.convertToModel(Object, Class, Locale)
should return the original
value.
convertToPresentation
in interface Converter<java.lang.String,TYPE>
value
- The value to convert, compatible with the target type. Can be
nulltargetType
- The requested type of the return valuelocale
- The locale to use for conversion. Can be null.
Converter.ConversionException
- If the value could not be convertedpublic java.lang.Class<TYPE> getModelType()
Converter
Converter.convertToPresentation(Object, Class, Locale)
.
getModelType
in interface Converter<java.lang.String,TYPE>
public java.lang.Class<java.lang.String> getPresentationType()
Converter
Converter.convertToModel(Object, Class, Locale)
.
getPresentationType
in interface Converter<java.lang.String,TYPE>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |