Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] XML attribute mapping to Java 5 Enum

I want to convert a attribute value to a Java 5 enum.

Can someone explain to me how this can be done?

For example I want convert type="minimum" into a ValueType.MINIMUM.

<Value type="minimum" value="-25"/>

public enum ValueType {

   MAXIMUM("Maximum"), MINIMUM("Minimum"), NOMINAL("Nominal");

   private final String description;

   private CharacteristicValueType(String description) {
       this.description = description;

   public String value() {
       return description;

   public String toString() {
       return description;


Back to the top