Class StringToCollectionConverter
- java.lang.Object
-
- com.vaadin.v7.data.util.converter.StringToCollectionConverter
-
- All Implemented Interfaces:
Converter<String,Collection>
,Serializable
@Deprecated public class StringToCollectionConverter extends Object implements Converter<String,Collection>
Deprecated.As of 8.0, a lightweight lambda-based converter can be build withBinder
.forField(...).withConverter(...)
methods.A converter that converts fromString
toCollection
of tokens and back.Allows to break a string into tokens using delimiter. Each token can be converted to its own model using provided converter.
Default constructor uses
", "
as delimiter string andString
for token types. Other constructors allow to configure delimiter and token types.- Since:
- 7.5.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
StringToCollectionConverter.CollectionFactory
Deprecated.static class
StringToCollectionConverter.DefaultCollectionFactory
Deprecated.-
Nested classes/interfaces inherited from interface com.vaadin.v7.data.util.converter.Converter
Converter.ConversionException
-
-
Constructor Summary
Constructors Constructor Description StringToCollectionConverter()
Deprecated.Creates converter with", "
as delimiter andString
as token model type in collection.StringToCollectionConverter(Converter<String,?> tokenConverter, Class<?> tokenType)
Deprecated.Creates converter with giventokenConverter
for convert tokens and expectedtokenType
.StringToCollectionConverter(String delimiter)
Deprecated.Creates converter with givendelimiter
andString
as token model type in collection.StringToCollectionConverter(String delimiter, Converter<String,?> tokenConverter, Class<?> tokenClass)
Deprecated.Creates converter with giventokenConverter
for convert tokens and expectedtokenType
.StringToCollectionConverter(String delimiter, Converter<String,?> tokenConverter, Class<?> tokenClass, StringToCollectionConverter.CollectionFactory factory)
Deprecated.Creates converter with giventokenConverter
for convert tokens and expectedtokenType
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Collection
convertToModel(String value, Class<? extends Collection> targetType, Locale locale)
Deprecated.Converts the given value from target type to source type.String
convertToPresentation(Collection value, Class<? extends String> targetType, Locale locale)
Deprecated.Converts the given value from source type to target type.Class<Collection>
getModelType()
Deprecated.The source type of the converter.Class<String>
getPresentationType()
Deprecated.The target type of the converter.
-
-
-
Constructor Detail
-
StringToCollectionConverter
public StringToCollectionConverter()
Deprecated.Creates converter with", "
as delimiter andString
as token model type in collection.
-
StringToCollectionConverter
public StringToCollectionConverter(String delimiter)
Deprecated.Creates converter with givendelimiter
andString
as token model type in collection.- Parameters:
delimiter
- custom delimiter
-
StringToCollectionConverter
public StringToCollectionConverter(Converter<String,?> tokenConverter, Class<?> tokenType)
Deprecated.Creates converter with giventokenConverter
for convert tokens and expectedtokenType
.If
tokenConverter
is null then no conversation is done andString
is used as token type in resulting model collection.- Parameters:
tokenConverter
- converter for tokentokenType
- expected token model type
-
StringToCollectionConverter
public StringToCollectionConverter(String delimiter, Converter<String,?> tokenConverter, Class<?> tokenClass)
Deprecated.Creates converter with giventokenConverter
for convert tokens and expectedtokenType
.If
tokenConverter
is null then no conversation is done andString
is used as token type in resulting model collection.- Parameters:
tokenConverter
- converter for tokentokenClass
- expected token model typedelimiter
- delimiter in presentation string
-
StringToCollectionConverter
public StringToCollectionConverter(String delimiter, Converter<String,?> tokenConverter, Class<?> tokenClass, StringToCollectionConverter.CollectionFactory factory)
Deprecated.Creates converter with giventokenConverter
for convert tokens and expectedtokenType
.If
tokenConverter
is null then no conversation is done andString
is used as token type in resulting model collection.- Parameters:
tokenConverter
- converter for tokentokenClass
- expected token model typedelimiter
- delimiter in presentation stringfactory
- factory to create resulting collection
-
-
Method Detail
-
getModelType
public Class<Collection> getModelType()
Deprecated.Description copied from interface:Converter
The source type of the converter. Values of this type can be passed toConverter.convertToPresentation(Object, Class, Locale)
.- Specified by:
getModelType
in interfaceConverter<String,Collection>
- Returns:
- The source type
-
getPresentationType
public Class<String> getPresentationType()
Deprecated.Description copied from interface:Converter
The target type of the converter. Values of this type can be passed toConverter.convertToModel(Object, Class, Locale)
.- Specified by:
getPresentationType
in interfaceConverter<String,Collection>
- Returns:
- The target type
-
convertToModel
public Collection convertToModel(String value, Class<? extends Collection> targetType, Locale locale) throws Converter.ConversionException
Deprecated.Description copied from interface:Converter
Converts the given value from target type to source type.A converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale)
andConverter.convertToModel(Object, Class, Locale)
should return the original value.- Specified by:
convertToModel
in interfaceConverter<String,Collection>
- Parameters:
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.- Returns:
- The converted value compatible with the source type
- Throws:
Converter.ConversionException
- If the value could not be converted
-
convertToPresentation
public String convertToPresentation(Collection value, Class<? extends String> targetType, Locale locale) throws Converter.ConversionException
Deprecated.Description copied from interface:Converter
Converts the given value from source type to target type.A converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale)
andConverter.convertToModel(Object, Class, Locale)
should return the original value.- Specified by:
convertToPresentation
in interfaceConverter<String,Collection>
- Parameters:
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.- Returns:
- The converted value compatible with the source type
- Throws:
Converter.ConversionException
- If the value could not be converted
-
-