merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk
[cdmlib.git] / cdmlib-remote / src / main / java / eu / etaxonomy / cdm / remote / editor / UUIDListPropertyEditor.java
1 package eu.etaxonomy.cdm.remote.editor;
2
3 import java.beans.PropertyEditorSupport;
4 import java.util.ArrayList;
5 import java.util.List;
6 import java.util.UUID;
7
8 /**
9 * @author f.revilla
10 * @date 09.06.2010
11 */
12
13 public class UUIDListPropertyEditor extends PropertyEditorSupport {
14
15 public void setAsText(String text) {
16 String separator = ",";
17 List<UUID> uuidList = new ArrayList<UUID>();
18 if (text.contains(",")){
19 //set the value for more than one UUID
20 String[] uuidStringList = text.split(separator);
21 for (String element : uuidStringList) {
22 uuidList.add(UUID.fromString(element));
23 }
24 }else{//set the value of the single UUID
25 uuidList.add(UUID.fromString(text));
26 }
27 setValue(uuidList);
28 }
29
30 }