public class JSONEnumConvertor extends java.lang.Object implements JSON.Convertor
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.Modifier and Type | Field and Description |
---|---|
private boolean |
_fromJSON |
private java.lang.reflect.Method |
_valueOf |
private static Logger |
LOG |
Constructor and Description |
---|
JSONEnumConvertor() |
JSONEnumConvertor(boolean fromJSON) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
fromJSON(java.util.Map map) |
void |
toJSON(java.lang.Object obj,
JSON.Output out) |
private static final Logger LOG
private boolean _fromJSON
private java.lang.reflect.Method _valueOf
public JSONEnumConvertor()
public JSONEnumConvertor(boolean fromJSON)
public java.lang.Object fromJSON(java.util.Map map)
fromJSON
in interface JSON.Convertor
public void toJSON(java.lang.Object obj, JSON.Output out)
toJSON
in interface JSON.Convertor