|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jersey.api.json.JSONConfiguration
public class JSONConfiguration
An immutable configuration of JSON notation and options. JSONConfiguration could be used
for configuring the JSON notation on JSONJAXBContext
Nested Class Summary | |
---|---|
static class |
JSONConfiguration.Builder
Builder class for constructing JSONConfiguration options |
static class |
JSONConfiguration.MappedBuilder
Builder class for constructing JSONConfiguration options
for the JSONConfiguration.Notation.MAPPED convention. |
static class |
JSONConfiguration.MappedJettisonBuilder
Builder class for constructing JSONConfiguration options
for the JSONConfiguration.Notation.MAPPED_JETTISON convention. |
static class |
JSONConfiguration.NaturalBuilder
Builder class for constructing JSONConfiguration options
for the JSONConfiguration.Notation.NATURAL convention. |
static class |
JSONConfiguration.Notation
Enumeration of supported JSON notations. |
Field Summary | |
---|---|
static JSONConfiguration |
DEFAULT
The default JSONConfiguration uses JSONConfiguration.Notation.MAPPED notation with root unwrapping option set to true. |
static java.lang.String |
FEATURE_POJO_MAPPING
A ResourceConfig feature, which allows you to enable JSON/POJO mapping functionality in Jersey. |
Method Summary | |
---|---|
static JSONConfiguration.Builder |
badgerFish()
A static method for obtaining a builder of JSONConfiguration instance, which will use JSONConfiguration.Notation.BADGERFISH JSON notation. |
static JSONConfiguration.Builder |
copyBuilder(JSONConfiguration jc)
|
static JSONConfiguration |
createJSONConfigurationWithFormatted(JSONConfiguration c,
boolean formatted)
A static method for obtaining JSONConfiguration instance with humanReadableFormatting
set according to formatted parameter. |
static JSONConfiguration |
createJSONConfigurationWithRootUnwrapping(JSONConfiguration c,
boolean rootUnwrapping)
A static method for obtaining JSONConfiguration instance with rootUnwrapping
set according to formatted parameter. |
java.util.Collection<java.lang.String> |
getArrays()
Returns JSON array names property This property is valid for the JSONConfiguration.Notation.MAPPED notation only. |
java.util.Collection<java.lang.String> |
getAttributeAsElements()
Returns names of attributes, which will be handled as elements This property is valid for the JSONConfiguration.Notation.MAPPED notation only. |
java.util.Collection<java.lang.String> |
getNonStrings()
Returns names of JSON objects, which will be serialized out as non-strings, i.e. |
JSONConfiguration.Notation |
getNotation()
Returns JSON notation selected for this configuration |
java.lang.Character |
getNsSeparator()
Returns XML namespace separator, which is used when constructing JSON identifiers for XML elements/attributes in other than default namespace This property is valid for the JSONConfiguration.Notation.MAPPED notation only. |
java.util.Map<java.lang.String,java.lang.String> |
getXml2JsonNs()
Returns a map for XML to JSON namespace mapping This property is valid for the JSONConfiguration.Notation.MAPPED notation only. |
boolean |
isHumanReadableFormatting()
Says if the output JSON will be formatted with new-line characters and indentation so that it is easy to read for people. |
boolean |
isRootUnwrapping()
Says if the root element will be stripped off This property is valid for the JSONConfiguration.Notation.MAPPED
and JSONConfiguration.Notation.NATURAL notations. |
boolean |
isUsingPrefixesAtNaturalAttributes()
Says if the JSON names corresponding to XML attributes should use a '@' prefix. |
static JSONConfiguration.MappedBuilder |
mapped()
A static method for obtaining a builder of JSONConfiguration instance, which will use JSONConfiguration.Notation.MAPPED JSON notation. |
static JSONConfiguration.MappedJettisonBuilder |
mappedJettison()
A static method for obtaining a builder of JSONConfiguration instance, which will use JSONConfiguration.Notation.MAPPED_JETTISON JSON notation. |
static JSONConfiguration.NaturalBuilder |
natural()
A static method for obtaining a builder of JSONConfiguration instance, which will use JSONConfiguration.Notation.NATURAL JSON notation. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String FEATURE_POJO_MAPPING
public static final JSONConfiguration DEFAULT
JSONConfiguration.Notation.MAPPED
notation with root unwrapping option set to true.
Method Detail |
---|
public static JSONConfiguration createJSONConfigurationWithFormatted(JSONConfiguration c, boolean formatted) throws java.lang.IllegalArgumentException
JSONConfiguration
instance with humanReadableFormatting
set according to formatted parameter.
c
- original instance of JSONConfiguration
, can't be nullformatted
- whether the output should be formatted.
JSONConfiguration
with humanReadableFormatting set to formatted.
java.lang.IllegalArgumentException
- when provided JSONConfiguration is null.public static JSONConfiguration createJSONConfigurationWithRootUnwrapping(JSONConfiguration c, boolean rootUnwrapping) throws java.lang.IllegalArgumentException
JSONConfiguration
instance with rootUnwrapping
set according to formatted parameter.
c
- original instance of JSONConfiguration
, can't be nullrootUnwrapping
-
JSONConfiguration
with humanReadableFormatting set to formatted.
java.lang.IllegalArgumentException
- when provided JSONConfiguration is null.public static JSONConfiguration.NaturalBuilder natural()
JSONConfiguration
instance, which will use JSONConfiguration.Notation.NATURAL
JSON notation.
After getting the builder, you can set configuration options on it, and finally get an immutable JSONConfiguration
instance using the JSONConfiguration.Builder.build()
method.
public static JSONConfiguration.MappedBuilder mapped()
JSONConfiguration
instance, which will use JSONConfiguration.Notation.MAPPED
JSON notation.
After getting the builder, you can set configuration options on it and finally get an immutable JSONConfiguration
instance the using JSONConfiguration.Builder.build()
method.
public static JSONConfiguration.MappedJettisonBuilder mappedJettison()
JSONConfiguration
instance, which will use JSONConfiguration.Notation.MAPPED_JETTISON
JSON notation.
After getting the builder, you can set configuration options on it and finally get an immutable JSONConfiguration
instance using the JSONConfiguration.Builder.build()
method.
public static JSONConfiguration.Builder badgerFish()
JSONConfiguration
instance, which will use JSONConfiguration.Notation.BADGERFISH
JSON notation.
After getting the builder, you can set configuration options on it and finally get an immutable JSONConfiguration
instance using the JSONConfiguration.Builder.build()
method.
public static JSONConfiguration.Builder copyBuilder(JSONConfiguration jc)
public JSONConfiguration.Notation getNotation()
public java.util.Collection<java.lang.String> getArrays()
JSONConfiguration.Notation.MAPPED
notation only.
JSONConfiguration.MappedBuilder.arrays(java.lang.String...)
public java.util.Collection<java.lang.String> getAttributeAsElements()
JSONConfiguration.Notation.MAPPED
notation only.
JSONConfiguration.MappedBuilder.attributeAsElement(java.lang.String...)
public java.util.Map<java.lang.String,java.lang.String> getXml2JsonNs()
JSONConfiguration.Notation.MAPPED
notation only.
JSONConfiguration.MappedBuilder.xml2JsonNs(java.util.Map)
public java.lang.Character getNsSeparator()
JSONConfiguration.Notation.MAPPED
notation only.
JSONConfiguration.MappedBuilder.nsSeparator(java.lang.Character)
public java.util.Collection<java.lang.String> getNonStrings()
JSONConfiguration.Notation.MAPPED
notation only.
JSONConfiguration.MappedBuilder.nonStrings(java.lang.String...)
public boolean isRootUnwrapping()
JSONConfiguration.Notation.MAPPED
and JSONConfiguration.Notation.NATURAL
notations.
JSONConfiguration.MappedBuilder.rootUnwrapping(boolean)
public boolean isUsingPrefixesAtNaturalAttributes()
JSONConfiguration.Notation.NATURAL
notation only.
JSONConfiguration.NaturalBuilder.usePrefixesAtNaturalAttributes()
public boolean isHumanReadableFormatting()
JSONConfiguration.Notation.NATURAL
notation only.
JSONConfiguration.NaturalBuilder.humanReadableFormatting(boolean)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |