2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.vaadin
.util
.converter
;
11 import java
.util
.ArrayList
;
12 import java
.util
.HashSet
;
13 import java
.util
.List
;
14 import java
.util
.Locale
;
17 import com
.vaadin
.data
.util
.converter
.Converter
;
20 * @author a.kohlbecker
24 public final class SetToListConverter
<V
> implements Converter
<List
<V
>, Set
<V
>> {
26 private static final long serialVersionUID
= -4453200532452354378L;
29 public Set
<V
> convertToModel(List
<V
> value
, Class
<?
extends Set
<V
>> targetType
, Locale locale
)
30 throws com
.vaadin
.data
.util
.converter
.Converter
.ConversionException
{
32 Set
<V
> set
= new HashSet
<>(value
.size());
40 public List
<V
> convertToPresentation(Set
<V
> value
, Class
<?
extends List
<V
>> targetType
, Locale locale
)
41 throws com
.vaadin
.data
.util
.converter
.Converter
.ConversionException
{
43 List
<V
> list
= new ArrayList
<V
>(value
.size());
51 public Class
<Set
<V
>> getModelType() {
52 return ((Class
)Set
.class);
56 public Class
<List
<V
>> getPresentationType() {
57 return ((Class
)List
.class);