javax.json
Class JsonConfiguration

java.lang.Object
  extended by javax.json.JsonConfiguration

public class JsonConfiguration
extends Object

JSON configuration is a set features that is used to configure the behaviour of parsing and generation of JSON. The features can be added to the configuration by chaining the with methods.

For example, JSON can be written in a pretty manner as follows:

 JsonObject jsonObject = ...;
 JsonConfiguration config = new JsonConfiguration().withPrettyPrinting();
 JsonWriter jsonWriter = new JsonWriter(..., config);
 jsonWriter.writeObject(jsonObject);
 jsonWriter.close();
 

Author:
Jitendra Kotamraju

Constructor Summary
JsonConfiguration()
           
 
Method Summary
 Iterable<JsonFeature> getFeatures()
          Returns a Iterable for features in this configuration.
 JsonConfiguration with(JsonFeature feature)
          Adds a feature to this configuration
 JsonConfiguration withPrettyPrinting()
          Adds pretty printing feature to this configuration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonConfiguration

public JsonConfiguration()
Method Detail

with

public JsonConfiguration with(JsonFeature feature)
Adds a feature to this configuration

Returns:
this configuration

withPrettyPrinting

public JsonConfiguration withPrettyPrinting()
Adds pretty printing feature to this configuration

Returns:
this configuration

getFeatures

public Iterable<JsonFeature> getFeatures()
Returns a Iterable for features in this configuration.

Returns:
iterable for features in this configuration



Copyright © 2012 Oracle and/or its affiliates. All rights reserved.