|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.data.util.converter.StringToBooleanConverter
public class StringToBooleanConverter
A converter that converts from String to Boolean and back. The String representation is given by
Boolean.toString() or provided in constructor StringToBooleanConverter(String, String).
Leading and trailing white spaces are ignored when converting from a String.
For language-dependent representation, subclasses should overwrite getFalseString(Locale) and getTrueString(Locale)
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.vaadin.data.util.converter.Converter |
|---|
Converter.ConversionException |
| Constructor Summary | |
|---|---|
StringToBooleanConverter()
Creates converter with default string representations - "true" and "false" |
|
StringToBooleanConverter(java.lang.String trueString,
java.lang.String falseString)
Creates converter with custom string representation. |
|
| Method Summary | |
|---|---|
java.lang.Boolean |
convertToModel(java.lang.String value,
java.lang.Class<? extends java.lang.Boolean> targetType,
java.util.Locale locale)
Converts the given value from target type to source type. |
java.lang.String |
convertToPresentation(java.lang.Boolean value,
java.lang.Class<? extends java.lang.String> targetType,
java.util.Locale locale)
Converts the given value from source type to target type. |
protected java.lang.String |
getFalseString()
Gets the string representation for false. |
protected java.lang.String |
getFalseString(java.util.Locale locale)
Gets the locale-depended string representation for false. |
java.lang.Class<java.lang.Boolean> |
getModelType()
The source type of the converter. |
java.lang.Class<java.lang.String> |
getPresentationType()
The target type of the converter. |
protected java.lang.String |
getTrueString()
Gets the string representation for true. |
protected java.lang.String |
getTrueString(java.util.Locale locale)
Gets the locale-depended string representation for true. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringToBooleanConverter()
public StringToBooleanConverter(java.lang.String trueString,
java.lang.String falseString)
falseString - string representation for falsetrueString - string representation for true| Method Detail |
|---|
public java.lang.Boolean convertToModel(java.lang.String value,
java.lang.Class<? extends java.lang.Boolean> targetType,
java.util.Locale locale)
throws Converter.ConversionException
ConverterA 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,java.lang.Boolean>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 convertedprotected java.lang.String getTrueString()
protected java.lang.String getFalseString()
public java.lang.String convertToPresentation(java.lang.Boolean value,
java.lang.Class<? extends java.lang.String> targetType,
java.util.Locale locale)
throws Converter.ConversionException
ConverterA 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,java.lang.Boolean>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 convertedprotected java.lang.String getFalseString(java.util.Locale locale)
getFalseString()
locale - to be used
protected java.lang.String getTrueString(java.util.Locale locale)
getTrueString()
locale - to be used
public java.lang.Class<java.lang.Boolean> getModelType()
ConverterConverter.convertToPresentation(Object, Class, Locale).
getModelType in interface Converter<java.lang.String,java.lang.Boolean>public java.lang.Class<java.lang.String> getPresentationType()
ConverterConverter.convertToModel(Object, Class, Locale).
getPresentationType in interface Converter<java.lang.String,java.lang.Boolean>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||