/* * Copyright 2000-2022 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.v7.data.util.converter; import java.io.Serializable; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Locale; /** * A converter that converts from {@link String} to {@link Collection} 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
* If {@code tokenConverter} is null then no conversation is done and
* {@link String} is used as token type in resulting model collection.
*
* @param tokenConverter
* converter for token
* @param tokenType
* expected token model type
*/
public StringToCollectionConverter(Converter
* If {@code tokenConverter} is null then no conversation is done and
* {@link String} is used as token type in resulting model collection.
*
* @param tokenConverter
* converter for token
* @param tokenClass
* expected token model type
* @param delimiter
* delimiter in presentation string
*/
public StringToCollectionConverter(String delimiter,
Converter
* If {@code tokenConverter} is null then no conversation is done and
* {@link String} is used as token type in resulting model collection.
*
* @param tokenConverter
* converter for token
* @param tokenClass
* expected token model type
* @param delimiter
* delimiter in presentation string
* @param factory
* factory to create resulting collection
*/
public StringToCollectionConverter(String delimiter,
Converter", "
as delimiter string and
* {@link String} for token types. Other constructors allow to configure
* delimiter and token types.
*
* @since 7.5.0
*
* @author Vaadin Ltd
*
* @deprecated As of 8.0, a lightweight lambda-based converter can be build with
* {@link com.vaadin.data.Binder
* Binder}{@code .forField(...).withConverter(...)} methods.
*/
@Deprecated
public class StringToCollectionConverter
implements Converter", "
as delimiter and {@link String}
* as token model type in collection.
*/
public StringToCollectionConverter() {
this(", ", null, String.class);
}
/**
* Creates converter with given {@code delimiter} and {@link String} as
* token model type in collection.
*
* @param delimiter
* custom delimiter
*/
public StringToCollectionConverter(String delimiter) {
this(delimiter, null, String.class);
}
/**
* Creates converter with given {@code tokenConverter} for convert tokens
* and expected {@code tokenType}.
*