org.eclipse.jetty.util.ajax

## Class JSONEnumConvertor

- java.lang.Object
- - org.eclipse.jetty.util.ajax.JSONEnumConvertor

- All Implemented Interfaces:
    JSON.Convertor

      public class JSONEnumConvertor
      extends 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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSONEnumConvertor()`
    `JSONEnumConvertor(boolean fromJSON)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `fromJSON(Map map)`
    `void` | `toJSON(Object obj, JSON.Output out)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JSONEnumConvertor

          public JSONEnumConvertor()

    - #### JSONEnumConvertor

          public JSONEnumConvertor(boolean fromJSON)

  - ### Method Detail

    - #### fromJSON

          public Object fromJSON(Map map)

      Specified by:
        `fromJSON` in interface `JSON.Convertor`

    - #### toJSON

          public void toJSON(Object obj,
                    JSON.Output out)

      Specified by:
        `toJSON` in interface `JSON.Convertor`

Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.