Class JsonEnumType

  • All Implemented Interfaces:
    Cloneable, IJsonParentType, IJsonType

    public class JsonEnumType
    extends JsonStructureType
    Transform JSON Schema enum to Java enum:
     "enum": ["blue", "green", 5, 4.0]
    
     enum Foo implements IBindingType {
       blue("blue"),
       green("green"),
       _5(5),
       _4_0(4.0);
    
       private final Object _value;
    
       Foo(Object value) {
         _value = value;
       }
    
       @Override
       public Object toBindingValue() {
         return _value;
       }
     }
     
    When calling myObj.setFoo(MyObj.Foo.blue) the JSON manifold marshals the value corresponding with the Java enum const so that the JSON bindings always contains JSON values. Similarly upon calling myObj.getFoo() the value returned to Java code is always the Foo enum const corresponding with the underlying bindings value.