Annotation Type Json.Value

Enclosing class:
Json

@Retention(RUNTIME) @Target(METHOD) public static @interface Json.Value
Mark a method on an Enum that provides the json value.

If the method returns an int type then it is mapped to json int, otherwise it is treated as providing json string values.



   public enum MyEnum {

     ONE("one value"),
     TWO("two value");

     final String val;
     MyEnum(String val) {
       this.val = val;
     }

     // method provides the values used to serialise to and from json

     @Json.Value
     public String value() {
       return val;
     }
   }