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 Details

    • MoxyJsonConfig

      public MoxyJsonConfig()
      Create a new configuration for MOXyJsonProvider and initialize default properties.
      See Also:
    • MoxyJsonConfig

      public MoxyJsonConfig(boolean initDefaultProperties)
      Create a new configuration for MOXyJsonProvider. If the initDefaultProperties is set to true then the following values are set:
      • Marshaller.JAXB_FORMATTED_OUTPUT - false
      • JAXBContextProperties.JSON_INCLUDE_ROOT - false
      • MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS - true
      • JAXBContextProperties.JSON_NAMESPACE_SEPARATOR - Constants.DOT
      Parameters:
      initDefaultProperties - flag to determine whether the default values of properties mentioned above should be set or not.
  • Method Details

    • property

      public MoxyJsonConfig property(String name, Object value)
      Set the value of the property for both Marshaller / Unmarshaller.
      Parameters:
      name - name of the property.
      value - value of the property.
      Returns:
      a MoxyJsonConfig instance.
    • marshallerProperty

      public MoxyJsonConfig marshallerProperty(String name, Object value)
      Set the value of the property for used Marshaller.
      Parameters:
      name - name of the property.
      value - value of the property.
      Returns:
      a MoxyJsonConfig instance.
    • unmarshallerProperty

      public MoxyJsonConfig unmarshallerProperty(String name, Object value)
      Set the value of the property for used Unmarshaller.
      Parameters:
      name - name of the property.
      value - value of the property.
      Returns:
      a MoxyJsonConfig instance.
    • 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 MoxyJsonConfig instance.
    • 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 MoxyJsonConfig instance.
    • 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 ContextResolver<MoxyJsonConfig> resolver()
      Create a context resolver for a current state of this MoxyJsonConfig.
      Returns:
      context resolver for this config.