-
Notifications
You must be signed in to change notification settings - Fork 54
JAXB2 EnumValue Plugin
maffe edited this page Sep 3, 2019
·
3 revisions
JAXB2 EnumValue plugin makes enums implement the EnumValue<T>
interface. This allows generic access to the original enum values.
@XmlType(name = "issueJIIB38Type")
@XmlEnum
public enum IssueJIIB38Type
implements EnumValue<String>
{
@XmlEnumValue("a")
A("a"),
@XmlEnumValue("b")
B("b"),
@XmlEnumValue("c")
C("c"),
@XmlEnumValue("d")
D("d");
private final String value;
IssueJIIB38Type(String v) {
value = v;
}
public String value() {
return value;
}
public static IssueJIIB38Type fromValue(String v) {
for (IssueJIIB38Type c: IssueJIIB38Type.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
public String enumValue() {
return this.value();
}
}
- Add JAXB2 Basics to your build.
- Use the
-XenumValue
argument to activate the plugin.
-
JAXB2 Basics Plugins
- Using JAXB2 Basics Plugins
- JSR-305 Support
- SimpleEquals Plugin
- SimpleHashCode Plugin
- Equals Plugin
- HashCode Plugin
- ToString Plugin
- Copyable Plugin
- Mergeable Plugin
- Inheritance Plugin
- AutoInheritance Plugin
- Wildcard Plugin
- Setters Plugin
- Simplify Plugin
- EnumValue Plugin
- JAXBIndex Plugin
- FixJAXB1058 Plugin
- Sample Projects