1
|
package eu.etaxonomy.taxeditor.handler;
|
2
|
|
3
|
import java.util.UUID;
|
4
|
|
5
|
import org.eclipse.core.commands.AbstractParameterValueConverter;
|
6
|
import org.eclipse.core.commands.ParameterValueConversionException;
|
7
|
|
8
|
/**
|
9
|
* Converts {@link UUID}s to a string representation
|
10
|
* and vica versa.
|
11
|
*
|
12
|
* @author pplitzner
|
13
|
* @date Sep 15, 2015
|
14
|
*
|
15
|
*/
|
16
|
public class UuidsParameterTypeConverter extends AbstractParameterValueConverter {
|
17
|
|
18
|
public UuidsParameterTypeConverter() {
|
19
|
}
|
20
|
|
21
|
@Override
|
22
|
public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
|
23
|
return UUID.fromString(parameterValue);
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
public String convertToString(Object parameterValue) throws ParameterValueConversionException {
|
28
|
return parameterValue.toString();
|
29
|
}
|
30
|
|
31
|
}
|