com.sun.jersey.api.json
Class JSONConfiguration.MappedBuilder

java.lang.Object
  extended by com.sun.jersey.api.json.JSONConfiguration.Builder
      extended by com.sun.jersey.api.json.JSONConfiguration.MappedBuilder
Enclosing class:
JSONConfiguration

public static class JSONConfiguration.MappedBuilder
extends JSONConfiguration.Builder

Builder class for constructing JSONConfiguration options for the JSONConfiguration.Notation.MAPPED convention.


Field Summary
 
Fields inherited from class com.sun.jersey.api.json.JSONConfiguration.Builder
arrays, attrsAsElems, humanReadableFormatting, jsonXml2JsonNs, namespaceSeparator, nonStrings, rootUnwrapping, usePrefixAtNaturalAttributes
 
Method Summary
 JSONConfiguration.MappedBuilder arrays(java.lang.String... arrays)
          Adds name(s) to JSON arrays configuration property.
 JSONConfiguration.MappedBuilder attributeAsElement(java.lang.String... attributeAsElements)
          Adds name(s) toJSON attributes as elements property.
 JSONConfiguration.MappedBuilder nonStrings(java.lang.String... nonStrings)
          Adds name(s) JSON non-string values property.
 JSONConfiguration.MappedBuilder nsSeparator(java.lang.Character separator)
          Setter for XML namespace separator.
 JSONConfiguration.MappedBuilder rootUnwrapping(boolean rootUnwrapping)
          Setter for XML root element unwrapping.
 JSONConfiguration.MappedBuilder xml2JsonNs(java.util.Map<java.lang.String,java.lang.String> jsonXml2JsonNs)
          Setter for XML to JSON namespace mapping.
 
Methods inherited from class com.sun.jersey.api.json.JSONConfiguration.Builder
build
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

arrays

public JSONConfiguration.MappedBuilder arrays(java.lang.String... arrays)
Adds name(s) to JSON arrays configuration property. This property is valid for the JSONConfiguration.Notation.MAPPED notation only.

The property value is a collection of strings representing JSON object names. Those objects will be declared as arrays in JSON document.

For example, consider that the property value is not set and the JSON document is { ..., "arr1":"single element", ... }. If the property value is set to contain "arr1" then the JSON document would become { ..., "arr1":["single element"], ... }.

The default value is an empty collection.

Parameters:
arrays - an array of strings representing JSON object names.
Returns:
the mapped builder.

attributeAsElement

public JSONConfiguration.MappedBuilder attributeAsElement(java.lang.String... attributeAsElements)
Adds name(s) toJSON attributes as elements property. This property is valid for the JSONConfiguration.Notation.MAPPED notation only.

The value is a collection of string values that are object names that correspond to XML attribute information items. The value of an object name in the JSON document that exists in the collection of object names will be declared as an element as not as an attribute if the object corresponds to an XML attribute information item.

For example, consider that the property value is not set and the JSON document is { ..., "@number":"12", ... }. If the property value is set to contain "number" then the JSON document would be { ..., "number":"12", ... }.

The default value is an empty collection.

Parameters:
attributeAsElements - an array of string values that are object names that correspond to XML attribute information items.
Returns:
the mapped builder.

nonStrings

public JSONConfiguration.MappedBuilder nonStrings(java.lang.String... nonStrings)
Adds name(s) JSON non-string values property. This property is valid for the JSONConfiguration.Notation.MAPPED notation only.

The value is collection of string values that are object names. The value of an object name in the JSON document that exists in the collection of object names will be declared as non-string value, which is not surrounded by double quotes.

For example, consider that the property value is not set and the JSON document is { ..., "anumber":"12", ... }. If the property value is set to contain "anumber" then the JSON document would be { ..., "anumber":12, ... }.

The default value is an empty collection.

Parameters:
nonStrings - an array of string values that are object names
Returns:
the mapped builder.

xml2JsonNs

public JSONConfiguration.MappedBuilder xml2JsonNs(java.util.Map<java.lang.String,java.lang.String> jsonXml2JsonNs)
Setter for XML to JSON namespace mapping. This property is valid for the JSONConfiguration.Notation.MAPPED_JETTISON and JSONConfiguration.Notation.MAPPED notations only.

The value is a map with zero or more key/value pairs, where the key is an XML namespace and the value is the prefix to use as the replacement for the XML namespace.

The default value is a map with zero key/value pairs.


nsSeparator

public JSONConfiguration.MappedBuilder nsSeparator(java.lang.Character separator)
Setter for XML namespace separator. This property is valid for the JSONConfiguration.Notation.MAPPED notation only.

The value is a character used to separate a namespace identifier from the name of a XML attribute/element in JSON.

The default value is dot character ('.').


rootUnwrapping

public JSONConfiguration.MappedBuilder rootUnwrapping(boolean rootUnwrapping)
Setter for XML root element unwrapping. This property is valid for the JSONConfiguration.Notation.MAPPED and JSONConfiguration.Notation.NATURAL notations only.

If set to true, JSON code corresponding to the XML root element will be stripped out

The default value is false.

Parameters:
rootUnwrapping - if set to true, JSON code corresponding to the XML root element will be stripped out.
Returns:
the mapped builder.


Copyright © 2011 Oracle Corporation. All Rights Reserved.