org.glassfish.jersey.jettison
Class JettisonConfig

java.lang.Object
  extended by org.glassfish.jersey.jettison.JettisonConfig

public class JettisonConfig
extends Object

An immutable configuration of JSON notation and options. JettisonConfig instance can be used for configuring the JSON notation on JettisonJaxbContext.

Author:
Jakub Podlesak (jakub.podlesak at oracle.com)

Nested Class Summary
static class JettisonConfig.Builder
          Builder class for constructing JettisonConfig options
static class JettisonConfig.MappedJettisonBuilder
          Builder class for constructing JettisonConfig options for the JettisonConfig.Notation.MAPPED_JETTISON convention.
static class JettisonConfig.Notation
          Enumeration of supported JSON notations.
 
Field Summary
static JettisonConfig DEFAULT
          The default JettisonConfig uses JettisonConfig.Notation.MAPPED_JETTISON notation with root unwrapping option set to true.
 
Method Summary
static JettisonConfig.Builder badgerFish()
          A static method for obtaining a builder of JettisonConfig instance, which will use JettisonConfig.Notation.BADGERFISH JSON notation.
static JettisonConfig.Builder copyBuilder(JettisonConfig jc)
           
static JettisonConfig createJSONConfiguration(JettisonConfig c)
          A static method for obtaining JettisonConfig instance with humanReadableFormatting set according to formatted parameter.
 List<String> getArrayElements()
          Returns a list of elements to be treated as arrays.
 JettisonConfig.Notation getNotation()
          Returns JSON notation selected for this configuration
 Map<String,String> getXml2JsonNs()
          Returns a map for XML to JSON namespace mapping This property is valid for the JettisonConfig.Notation.MAPPED_JETTISON notation only.
static JettisonConfig.MappedJettisonBuilder mappedJettison()
          A static method for obtaining a builder of JettisonConfig instance, which will use JettisonConfig.Notation.MAPPED_JETTISON JSON notation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final JettisonConfig DEFAULT
The default JettisonConfig uses JettisonConfig.Notation.MAPPED_JETTISON notation with root unwrapping option set to true.

Method Detail

createJSONConfiguration

public static JettisonConfig createJSONConfiguration(JettisonConfig c)
                                              throws IllegalArgumentException
A static method for obtaining JettisonConfig instance with humanReadableFormatting set according to formatted parameter.

Parameters:
c - original instance of JettisonConfig, can't be null
Returns:
copy of provided JettisonConfig with humanReadableFormatting set to formatted.
Throws:
IllegalArgumentException - when provided JettisonConfig is null.

mappedJettison

public static JettisonConfig.MappedJettisonBuilder mappedJettison()
A static method for obtaining a builder of JettisonConfig instance, which will use JettisonConfig.Notation.MAPPED_JETTISON JSON notation. After getting the builder, you can set configuration options on it and finally get an immutable JettisonConfig instance using the JettisonConfig.Builder.build() method.

Returns:
a builder for JettisonConfig instance

badgerFish

public static JettisonConfig.Builder badgerFish()
A static method for obtaining a builder of JettisonConfig instance, which will use JettisonConfig.Notation.BADGERFISH JSON notation. After getting the builder, you can set configuration options on it and finally get an immutable JettisonConfig instance using the JettisonConfig.Builder.build() method.

Returns:
a builder for JettisonConfig instance

copyBuilder

public static JettisonConfig.Builder copyBuilder(JettisonConfig jc)

getNotation

public JettisonConfig.Notation getNotation()
Returns JSON notation selected for this configuration

Returns:
JSON notation

getXml2JsonNs

public Map<String,String> getXml2JsonNs()
Returns a map for XML to JSON namespace mapping This property is valid for the JettisonConfig.Notation.MAPPED_JETTISON notation only.

Returns:
a map for XML to JSON namespace mapping.
See Also:
JettisonConfig.MappedJettisonBuilder.xml2JsonNs(java.util.Map)

getArrayElements

public List<String> getArrayElements()
Returns a list of elements to be treated as arrays. I.e. these elements will be serialized as arrays even if only a single element is included. This property is valid for the JettisonConfig.Notation.MAPPED_JETTISON notation only.

Returns:
a list of elements representing arrays.
See Also:
JettisonConfig.MappedJettisonBuilder.serializeAsArray(java.util.List)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.