1
2
3
4
5
6
7
8
9 package org.springframework.ws.samples.airline.schema;
10
11 import javax.xml.bind.annotation.XmlEnum;
12 import javax.xml.bind.annotation.XmlEnumValue;
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 @XmlEnum
32 public enum ServiceClass {
33
34 @XmlEnumValue("economy")
35 ECONOMY("economy"),
36 @XmlEnumValue("business")
37 BUSINESS("business"),
38 @XmlEnumValue("first")
39 FIRST("first");
40 private final String value;
41
42 ServiceClass(String v) {
43 value = v;
44 }
45
46 public String value() {
47 return value;
48 }
49
50 public static ServiceClass fromValue(String v) {
51 for (ServiceClass c: ServiceClass.values()) {
52 if (c.value.equals(v)) {
53 return c;
54 }
55 }
56 throw new IllegalArgumentException(v.toString());
57 }
58
59 }