Class JSONPojoConvertor

java.lang.Object
org.eclipse.jetty.util.ajax.JSONPojoConvertor
All Implemented Interfaces:
JSON.Convertor

public class JSONPojoConvertor extends Object implements JSON.Convertor
Converts POJOs to JSON and vice versa. The key difference: - returns the actual object from Convertor.fromJSON (JSONObjectConverter returns a Map) - the getters/setters are resolved at initialization (JSONObjectConverter resolves it at runtime) - correctly sets the number fields
  • Field Details

  • Constructor Details

    • JSONPojoConvertor

      public JSONPojoConvertor(Class<?> pojoClass)
      Parameters:
      pojoClass - The class to convert
    • JSONPojoConvertor

      public JSONPojoConvertor(Class<?> pojoClass, String[] excluded)
      Parameters:
      pojoClass - The class to convert
      excluded - The fields to exclude
    • JSONPojoConvertor

      public JSONPojoConvertor(Class<?> pojoClass, Set<String> excluded)
      Parameters:
      pojoClass - The class to convert
      excluded - The fields to exclude
    • JSONPojoConvertor

      public JSONPojoConvertor(Class<?> pojoClass, Set<String> excluded, boolean fromJSON)
      Parameters:
      pojoClass - The class to convert
      excluded - The fields to exclude
      fromJSON - If true, add a class field to the JSON
    • JSONPojoConvertor

      public JSONPojoConvertor(Class<?> pojoClass, boolean fromJSON)
      Parameters:
      pojoClass - The class to convert
      fromJSON - If true, add a class field to the JSON
  • Method Details