-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathXmlEnumValue.java
More file actions
39 lines (36 loc) · 790 Bytes
/
XmlEnumValue.java
File metadata and controls
39 lines (36 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package xmlparser.annotations;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Changes an enum value to some other value. Example:
* <pre>
* {@code
* class Pojo {
* MyEnum value;
* }
*
* enum MyEnum {
* one,
* \@XmlEnumValue("123")
* two
* }
* }
* </pre>
* The above POJO with 'value' set to 'one' will serialize into
* <pre>
* {@code
* <pojo><value>one</value></pojo>
* }
* </pre>
* The same POJO with 'value' set to 'two' will serialize into
* <pre>
* {@code
* <pojo><value>123</value></pojo>
* }
* </pre>
* This annotation is also respected during deserialization.
*/
@Retention(RUNTIME)
public @interface XmlEnumValue {
String value();
}