Class JSONEnumConvertor

  • All Implemented Interfaces:
    JSON.Convertor

    public class JSONEnumConvertor
    extends java.lang.Object
    implements JSON.Convertor
    Convert an Enum to JSON. If fromJSON is true in the constructor, the JSON generated will be of the form {class="com.acme.TrafficLight",value="Green"} If fromJSON is false, then only the string value of the enum is generated.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean _fromJSON  
      private java.lang.reflect.Method _valueOf  
      private static Logger LOG  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object fromJSON​(java.util.Map map)  
      void toJSON​(java.lang.Object obj, JSON.Output out)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final Logger LOG
      • _fromJSON

        private boolean _fromJSON
      • _valueOf

        private java.lang.reflect.Method _valueOf
    • Constructor Detail

      • JSONEnumConvertor

        public JSONEnumConvertor()
      • JSONEnumConvertor

        public JSONEnumConvertor​(boolean fromJSON)