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
extends Object
> implements Converter
<List
<V
>, Set
<V
>> {
26 private static final long serialVersionUID
= -4453200532452354378L;
28 Class
<Set
<V
>> modelType
= (Class
<Set
<V
>>) new HashSet
<V
>(0).getClass();
30 Class
<List
<V
>> presentationType
= (Class
<List
<V
>>) new ArrayList
<V
>(0).getClass();
33 public Set
<V
> convertToModel(List
<V
> value
, Class
<?
extends Set
<V
>> targetType
, Locale locale
)
34 throws com
.vaadin
.data
.util
.converter
.Converter
.ConversionException
{
36 Set
<V
> set
= new HashSet
<>(value
.size());
44 public List
<V
> convertToPresentation(Set
<V
> value
, Class
<?
extends List
<V
>> targetType
, Locale locale
)
45 throws com
.vaadin
.data
.util
.converter
.Converter
.ConversionException
{
47 List
<V
> list
= new ArrayList
<V
>(value
.size());
55 public Class
<Set
<V
>> getModelType() {
60 public Class
<List
<V
>> getPresentationType() {
61 return presentationType
;