01: package web.examples;
02:
03: import org.jreform.InputDataType;
04:
05: /**
06: * This class is an example of a custom InputDataType.
07: *
08: * It converts a string value into an instance of EmploymentStatus enum.
09: */
10: public class EmploymentStatusDataType implements
11: InputDataType<EmploymentStatus> {
12: public Class<EmploymentStatus> getInputDataClass() {
13: return EmploymentStatus.class;
14: }
15:
16: public EmploymentStatus parseValue(String value) {
17: try {
18: return EmploymentStatus.getByID(Integer.parseInt(value));
19: } catch (Exception ex) {
20: return null;
21: }
22: }
23:
24: }
|