Project

General

Profile

Download (923 Bytes) Statistics
| Branch: | Tag: | Revision:
1 30416098 Andreas Kohlbecker
/**
2
 * Copyright (C) 2009 EDIT
3 fa2b2dbb Andreas Kohlbecker
 * European Distributed Institute of Taxonomy
4 30416098 Andreas Kohlbecker
 * http://www.e-taxonomy.eu
5 fa2b2dbb Andreas Kohlbecker
 *
6 30416098 Andreas Kohlbecker
 * 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.
8
 */
9
10
package eu.etaxonomy.cdm.remote.editor;
11
12
import java.beans.PropertyEditorSupport;
13
import java.util.UUID;
14
15
public class UUIDPropertyEditor extends PropertyEditorSupport  {
16
17 fa2b2dbb Andreas Kohlbecker
    private String nullRepresentation;
18
19
    public UUIDPropertyEditor() {
20
        super();
21
    }
22
23
    public UUIDPropertyEditor(String nullRepresentation){
24
        super();
25
        this.nullRepresentation = nullRepresentation;
26
    }
27
28
	@Override
29
    public void setAsText(String text) {
30
	    if(nullRepresentation != null && nullRepresentation.equals(text)){
31
	        setValue(null);
32
	    } else {
33
			setValue(UUID.fromString(text));
34
	    }
35 30416098 Andreas Kohlbecker
	}
36
}