Module io.ebean.api

Class JsonWriteOptions

java.lang.Object
io.ebean.text.json.JsonWriteOptions

public class JsonWriteOptions extends Object
Provides options for customising the JSON write process.

You can explicitly state which properties to include in the JSON output for the root level and each path.

  • Field Details

  • Constructor Details

    • JsonWriteOptions

      public JsonWriteOptions()
  • Method Details

    • parsePath

      public static JsonWriteOptions parsePath(String pathProperties)
      Parse and return a PathProperties from nested string format like (a,b,c(d,e),f(g)) where "c" is a path containing "d" and "e" and "f" is a path containing "g" and the root path contains "a","b","c" and "f".
      See Also:
    • pathProperties

      public static JsonWriteOptions pathProperties(FetchPath pathProperties)
      Construct JsonWriteOptions with the given pathProperties.
    • setPathProperties

      public void setPathProperties(FetchPath pathProperties)
      Set the Map of properties to include by path.
    • getPathProperties

      public FetchPath getPathProperties()
      Return the properties to include by path.
    • getInclude

      public JsonConfig.Include getInclude()
      Return the include mode for this request.
    • setInclude

      public void setInclude(JsonConfig.Include include)
      Set the include mode for this request.
    • setRootPathVisitor

      public JsonWriteOptions setRootPathVisitor(JsonWriteBeanVisitor<?> visitor)
      Register a JsonWriteBeanVisitor for the root level.
    • setPathVisitor

      public JsonWriteOptions setPathVisitor(String path, JsonWriteBeanVisitor<?> visitor)
      Register a JsonWriteBeanVisitor for the given path.
    • getVisitorMap

      public Map<String,JsonWriteBeanVisitor<?>> getVisitorMap()
      Return the Map of registered JsonWriteBeanVisitor's by path.
    • getObjectMapper

      public Object getObjectMapper()
      Return the jackson object mapper to use.

      If null the ObjectMapper from DatabaseConfig will be used.

    • setObjectMapper

      public void setObjectMapper(Object objectMapper)
      Set the jackson object mapper to use.

      If null the ObjectMapper from DatabaseConfig will be used.