|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.media.json.JsonConfiguration
public class JsonConfiguration
An immutable configuration of JSON notation and options. JsonConfiguration
instance can 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. |
| 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. |
Collection<String> |
getArrays()
Returns JSON array names property This property is valid for the JsonConfiguration.Notation.MAPPED notation only. |
Collection<String> |
getAttributeAsElements()
Returns names of attributes, which will be handled as elements This property is valid for the JsonConfiguration.Notation.MAPPED notation only. |
Collection<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 |
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. |
Map<String,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. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
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 IllegalArgumentException
JsonConfiguration instance with humanReadableFormatting
set according to formatted parameter.
c - original instance of JsonConfiguration, can't be nullformatted -
JsonConfiguration with humanReadableFormatting set to formatted.
IllegalArgumentException - when provided JsonConfiguration is null.
public static JsonConfiguration createJSONConfigurationWithRootUnwrapping(JsonConfiguration c,
boolean rootUnwrapping)
throws 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.
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 Collection<String> getArrays()
JsonConfiguration.Notation.MAPPED notation only.
JsonConfiguration.MappedBuilder.arrays(java.lang.String...)public Collection<String> getAttributeAsElements()
JsonConfiguration.Notation.MAPPED notation only.
JsonConfiguration.MappedBuilder.attributeAsElement(java.lang.String...)public Map<String,String> getXml2JsonNs()
JsonConfiguration.Notation.MAPPED notation only.
JsonConfiguration.MappedBuilder.xml2JsonNs(java.util.Map)public Character getNsSeparator()
JsonConfiguration.Notation.MAPPED notation only.
JsonConfiguration.MappedBuilder.nsSeparator(java.lang.Character)public Collection<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 String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||