Project

General

Profile

Download (711 Bytes) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.cdm.remote.editor;
2

    
3
import java.beans.PropertyEditorSupport;
4

    
5
import eu.etaxonomy.cdm.remote.dto.oaipmh.SetSpec;
6

    
7
public class SetSpecEditor extends PropertyEditorSupport {
8
	
9
	public void setAsText(String text) {
10
		if(text == null) {
11
			throw new IllegalArgumentException("null is not an acceptable set spec");
12
		} else {
13
			SetSpec setSpec = SetSpec.bySpec(text);
14
			if(setSpec != null){
15
				setValue(setSpec);
16
			} else {				
17
				throw new IllegalArgumentException(text + " is not an acceptable set spec");
18
			}
19
		}
20
	}
21
	
22
	public String getAsText() {
23
		if(getValue() == null) {
24
			return null;
25
		} else {
26
		    return ((SetSpec)getValue()).getSpec();
27
		}
28
	}
29
}
(14-14/19)