Package org.glassfish.jersey.moxy.json
Class MoxyJsonConfig
- java.lang.Object
-
- org.glassfish.jersey.moxy.json.MoxyJsonConfig
-
public final class MoxyJsonConfig extends Object
Configuration class for MOXy JSON provider.- Author:
- Michal Gajdos
-
-
Constructor Summary
Constructors Constructor Description MoxyJsonConfig()Create a new configuration forMOXyJsonProviderand initialize default properties.MoxyJsonConfig(boolean initDefaultProperties)Create a new configuration forMOXyJsonProvider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAttributePrefix()Map<String,Object>getMarshallerProperties()Get marshaller properties.Map<String,String>getNamespacePrefixMapper()chargetNamespaceSeparator()Map<String,Object>getUnmarshallerProperties()Get unmarshaller properties.StringgetValueWrapper()booleanisFormattedOutput()booleanisIncludeRoot()booleanisMarshalEmptyCollections()MoxyJsonConfigmarshallerProperty(String name, Object value)Set the value of the property for usedMarshaller.MoxyJsonConfigproperty(String name, Object value)Set the value of the property for bothMarshaller/Unmarshaller.jakarta.ws.rs.ext.ContextResolver<MoxyJsonConfig>resolver()Create acontext resolverfor a current state of thisMoxyJsonConfig.MoxyJsonConfigsetAttributePrefix(String attributePrefix)MoxyJsonConfigsetFormattedOutput(boolean formattedOutput)MoxyJsonConfigsetIncludeRoot(boolean includeRoot)MoxyJsonConfigsetMarshalEmptyCollections(boolean marshalEmptyCollections)MoxyJsonConfigsetMarshallerProperties(Map<String,Object> marshallerProperties)Add properties from the given map to the existing marshaller properties.MoxyJsonConfigsetNamespacePrefixMapper(Map<String,String> namespacePrefixMapper)MoxyJsonConfigsetNamespaceSeparator(char namespaceSeparator)MoxyJsonConfigsetUnmarshallerProperties(Map<String,Object> unmarshallerProperties)Add properties from the given map to the existing unmarshaller properties.MoxyJsonConfigsetValueWrapper(String valueWrapper)MoxyJsonConfigunmarshallerProperty(String name, Object value)Set the value of the property for usedUnmarshaller.
-
-
-
Constructor Detail
-
MoxyJsonConfig
public MoxyJsonConfig()
Create a new configuration forMOXyJsonProviderand initialize default properties.- See Also:
MoxyJsonConfig(boolean)
-
MoxyJsonConfig
public MoxyJsonConfig(boolean initDefaultProperties)
Create a new configuration forMOXyJsonProvider. If theinitDefaultPropertiesis set totruethen the following values are set:Marshaller.JAXB_FORMATTED_OUTPUT-falseJAXBContextProperties.JSON_INCLUDE_ROOT-falseMarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS-trueJAXBContextProperties.JSON_NAMESPACE_SEPARATOR-Constants.DOT
- Parameters:
initDefaultProperties- flag to determine whether the default values of properties mentioned above should be set or not.
-
-
Method Detail
-
property
public MoxyJsonConfig property(String name, Object value)
Set the value of the property for bothMarshaller/Unmarshaller.- Parameters:
name- name of the property.value- value of the property.- Returns:
- a
MoxyJsonConfiginstance.
-
marshallerProperty
public MoxyJsonConfig marshallerProperty(String name, Object value)
Set the value of the property for usedMarshaller.- Parameters:
name- name of the property.value- value of the property.- Returns:
- a
MoxyJsonConfiginstance.
-
unmarshallerProperty
public MoxyJsonConfig unmarshallerProperty(String name, Object value)
Set the value of the property for usedUnmarshaller.- Parameters:
name- name of the property.value- value of the property.- Returns:
- a
MoxyJsonConfiginstance.
-
setMarshallerProperties
public MoxyJsonConfig setMarshallerProperties(Map<String,Object> marshallerProperties)
Add properties from the given map to the existing marshaller properties.- Parameters:
marshallerProperties- map of marshaller properties.- Returns:
- a
MoxyJsonConfiginstance.
-
setUnmarshallerProperties
public MoxyJsonConfig setUnmarshallerProperties(Map<String,Object> unmarshallerProperties)
Add properties from the given map to the existing unmarshaller properties.- Parameters:
unmarshallerProperties- map of unmarshaller properties.- Returns:
- a
MoxyJsonConfiginstance.
-
getMarshallerProperties
public Map<String,Object> getMarshallerProperties()
Get marshaller properties.- Returns:
- mutable map of marshaller properties.
-
getUnmarshallerProperties
public Map<String,Object> getUnmarshallerProperties()
Get unmarshaller properties.- Returns:
- mutable map of unmarshaller properties.
-
getAttributePrefix
public String getAttributePrefix()
- See Also:
MOXyJsonProvider.getAttributePrefix()
-
setAttributePrefix
public MoxyJsonConfig setAttributePrefix(String attributePrefix)
- See Also:
MOXyJsonProvider.setAttributePrefix(String)
-
isFormattedOutput
public boolean isFormattedOutput()
- See Also:
MOXyJsonProvider.isFormattedOutput()
-
setFormattedOutput
public MoxyJsonConfig setFormattedOutput(boolean formattedOutput)
- See Also:
MOXyJsonProvider.setFormattedOutput(boolean)
-
isIncludeRoot
public boolean isIncludeRoot()
- See Also:
MOXyJsonProvider.isIncludeRoot()
-
setIncludeRoot
public MoxyJsonConfig setIncludeRoot(boolean includeRoot)
- See Also:
MOXyJsonProvider.setIncludeRoot(boolean)
-
isMarshalEmptyCollections
public boolean isMarshalEmptyCollections()
- See Also:
MOXyJsonProvider.isMarshalEmptyCollections()
-
setMarshalEmptyCollections
public MoxyJsonConfig setMarshalEmptyCollections(boolean marshalEmptyCollections)
- See Also:
MOXyJsonProvider.setMarshalEmptyCollections(boolean)
-
getNamespacePrefixMapper
public Map<String,String> getNamespacePrefixMapper()
- See Also:
MOXyJsonProvider.getNamespacePrefixMapper()
-
setNamespacePrefixMapper
public MoxyJsonConfig setNamespacePrefixMapper(Map<String,String> namespacePrefixMapper)
- See Also:
MOXyJsonProvider.setNamespacePrefixMapper(java.util.Map)
-
getNamespaceSeparator
public char getNamespaceSeparator()
- See Also:
MOXyJsonProvider.getNamespaceSeparator()
-
setNamespaceSeparator
public MoxyJsonConfig setNamespaceSeparator(char namespaceSeparator)
- See Also:
MOXyJsonProvider.setNamespaceSeparator(char)
-
getValueWrapper
public String getValueWrapper()
- See Also:
MOXyJsonProvider.getValueWrapper()
-
setValueWrapper
public MoxyJsonConfig setValueWrapper(String valueWrapper)
- See Also:
MOXyJsonProvider.setValueWrapper(String)
-
resolver
public jakarta.ws.rs.ext.ContextResolver<MoxyJsonConfig> resolver()
Create acontext resolverfor a current state of thisMoxyJsonConfig.- Returns:
- context resolver for this config.
-
-