org.apache.synapse.commons.staxon.core.json

## Class JsonXMLConfigImpl

- java.lang.Object
- - org.apache.synapse.commons.staxon.core.json.JsonXMLConfigImpl

- All Implemented Interfaces:
    Cloneable, JsonXMLConfig

      public class JsonXMLConfigImpl
      extends Object
      implements JsonXMLConfig, Cloneable

  Simple JSON XML configuration.

  Initially, values are set according to `JsonXMLConfig.DEFAULT`.

  See Also:
    `JsonXMLConfig`

- - ### Field Summary

    - ### Fields inherited from interface org.apache.synapse.commons.staxon.core.json.JsonXMLConfig

      `DEFAULT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsonXMLConfigImpl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected JsonXMLConfigImpl` | `clone()`
    `String` | `getCustomRegex()` Format output ignoring scientific numbers
    `String` | `getCustomReplaceRegex()`
    `String` | `getCustomReplaceSequence()`
    `char` | `getNamespaceSeparator()` Namespace prefix separator.
    `QName` | `getVirtualRoot()` JSON documents may have have multiple root properties.
    `boolean` | `isAutoArray()` Trigger arrays automatically?
    `boolean` | `isAutoPrimitive()` Convert element text to number/boolean/null primitives automatically?
    `boolean` | `isMultiplePI()` Whether to use the `JsonXMLStreamConstants.MULTIPLE_PI_TARGET` processing instruction to indicate an array start.
    `boolean` | `isNamespaceDeclarations()` Whether to write namespace declarations.
    `boolean` | `isPrettyPrint()` Format output for better readability?
    `boolean` | `isReadWriteXmlNil()`
    `boolean` | `isRepairingNamespaces()` Repair namespaces when writing
    `boolean` | `isWriteNullForEmptyElements()` Used in XML->JSON conversion.
    `void` | `setAutoArray(boolean autoArray)`
    `void` | `setAutoPrimitive(boolean autoPrimitive)`
    `void` | `setCustomRegex(String customRegex)`
    `void` | `setCustomReplaceRegex(String customReplaceRegex)`
    `void` | `setCustomReplaceSequence(String customReplaceSequence)`
    `void` | `setMultiplePI(boolean multiplePI)`
    `void` | `setNamespaceDeclarations(boolean namespaceDeclarations)`
    `void` | `setNamespaceSeparator(char namespaceSeparator)`
    `void` | `setPrettyPrint(boolean prettyPrint)`
    `void` | `setReadWriteXmlNil(boolean readWriteXmlNil)`
    `void` | `setRepairingNamespaces(boolean repairingNamespaces)`
    `void` | `setVirtualRoot(QName virtualRoot)`
    `void` | `setWriteNullForEmptyElement(boolean writeNullForEmptyElement)`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JsonXMLConfigImpl

          public JsonXMLConfigImpl()

  - ### Method Detail

    - #### clone

          protected JsonXMLConfigImpl clone()

      Overrides:
        `clone` in class `Object`

    - #### isAutoArray

          public boolean isAutoArray()

      Description copied from interface: `JsonXMLConfig`

      Trigger arrays automatically?

      Specified by:
        `isAutoArray` in interface `JsonXMLConfig`
      Returns:
        auto array flag
      See Also:
        `JsonXMLOutputFactory.PROP_AUTO_ARRAY`

    - #### setAutoArray

          public void setAutoArray(boolean autoArray)

    - #### isAutoPrimitive

          public boolean isAutoPrimitive()

      Description copied from interface: `JsonXMLConfig`

      Convert element text to number/boolean/null primitives automatically?

      Specified by:
        `isAutoPrimitive` in interface `JsonXMLConfig`
      Returns:
        auto primitive flag
      See Also:
        `JsonXMLOutputFactory.PROP_AUTO_ARRAY`

    - #### setAutoPrimitive

          public void setAutoPrimitive(boolean autoPrimitive)

    - #### isMultiplePI

          public boolean isMultiplePI()

      Description copied from interface: `JsonXMLConfig`

      Whether to use the `JsonXMLStreamConstants.MULTIPLE_PI_TARGET` processing instruction to indicate an array start. If `true`, a PI is used to inform the writer to begin an array, passing the name of following multiple elements as data. The writer will close arrays automatically.

      If `true`, this reader will insert a PI with the field name as PI data.

      Note that the element given in the PI may occur zero times, indicating an "empty array".

      Specified by:
        `isMultiplePI` in interface `JsonXMLConfig`
      Returns:
        multiple PI flag
      See Also:
        `JsonXMLInputFactory.PROP_MULTIPLE_PI`, `JsonXMLOutputFactory.PROP_MULTIPLE_PI`

    - #### setMultiplePI

          public void setMultiplePI(boolean multiplePI)

    - #### isNamespaceDeclarations

          public boolean isNamespaceDeclarations()

      Description copied from interface: `JsonXMLConfig`

      Whether to write namespace declarations.

      Specified by:
        `isNamespaceDeclarations` in interface `JsonXMLConfig`
      Returns:
        namespace declarations flag
      See Also:
        `JsonXMLOutputFactory.PROP_NAMESPACE_DECLARATIONS`

    - #### setNamespaceDeclarations

          public void setNamespaceDeclarations(boolean namespaceDeclarations)

    - #### getNamespaceSeparator

          public char getNamespaceSeparator()

      Description copied from interface: `JsonXMLConfig`

      Namespace prefix separator.

      Specified by:
        `getNamespaceSeparator` in interface `JsonXMLConfig`
      Returns:
        namespace separator
      See Also:
        `JsonXMLInputFactory.PROP_NAMESPACE_SEPARATOR`, `JsonXMLOutputFactory.PROP_NAMESPACE_SEPARATOR`

    - #### setNamespaceSeparator

          public void setNamespaceSeparator(char namespaceSeparator)

    - #### isPrettyPrint

          public boolean isPrettyPrint()

      Description copied from interface: `JsonXMLConfig`

      Format output for better readability?

      Specified by:
        `isPrettyPrint` in interface `JsonXMLConfig`
      Returns:
        pretty print flag
      See Also:
        `JsonXMLOutputFactory.PROP_PRETTY_PRINT`

    - #### setPrettyPrint

          public void setPrettyPrint(boolean prettyPrint)

    - #### getVirtualRoot

          public QName getVirtualRoot()

      Description copied from interface: `JsonXMLConfig`

      JSON documents may have have multiple root properties. However, XML requires a single root element. This property specifies the root as a "virtual" element, which will be removed from the stream when writing and added to the stream when reading.

      Specified by:
        `getVirtualRoot` in interface `JsonXMLConfig`
      Returns:
        virtual root
      See Also:
        `JsonXMLInputFactory.PROP_VIRTUAL_ROOT`, `JsonXMLOutputFactory.PROP_VIRTUAL_ROOT`

    - #### setVirtualRoot

          public void setVirtualRoot(QName virtualRoot)

    - #### isRepairingNamespaces

          public boolean isRepairingNamespaces()

      Description copied from interface: `JsonXMLConfig`

      Repair namespaces when writing

      Specified by:
        `isRepairingNamespaces` in interface `JsonXMLConfig`
      Returns:
        namespace-repairing flag
      See Also:
        `XMLOutputFactory.IS_REPAIRING_NAMESPACES`

    - #### setRepairingNamespaces

          public void setRepairingNamespaces(boolean repairingNamespaces)

    - #### getCustomRegex

          public String getCustomRegex()

      Description copied from interface: `JsonXMLConfig`

      Format output ignoring scientific numbers

      Specified by:
        `getCustomRegex` in interface `JsonXMLConfig`
      Returns:
        autoprimitive enabled with scientific Number Ignore flag
      See Also:
        `JsonXMLOutputFactory.PROP_CUSTOM_REGEX`

    - #### setCustomRegex

          public void setCustomRegex(String customRegex)

    - #### getCustomReplaceRegex

          public String getCustomReplaceRegex()

      Specified by:
        `getCustomReplaceRegex` in interface `JsonXMLConfig`

    - #### setCustomReplaceRegex

          public void setCustomReplaceRegex(String customReplaceRegex)

    - #### getCustomReplaceSequence

          public String getCustomReplaceSequence()

      Specified by:
        `getCustomReplaceSequence` in interface `JsonXMLConfig`

    - #### setCustomReplaceSequence

          public void setCustomReplaceSequence(String customReplaceSequence)

    - #### setReadWriteXmlNil

          public void setReadWriteXmlNil(boolean readWriteXmlNil)

    - #### setWriteNullForEmptyElement

          public void setWriteNullForEmptyElement(boolean writeNullForEmptyElement)

    - #### isReadWriteXmlNil

          public boolean isReadWriteXmlNil()

      Specified by:
        `isReadWriteXmlNil` in interface `JsonXMLConfig`

    - #### isWriteNullForEmptyElements

          public boolean isWriteNullForEmptyElements()

      Description copied from interface: `JsonXMLConfig`
      Used in XML->JSON conversion. Decides whether to set null or "" for an empty XML element without nil attribute
      Specified by:
        `isWriteNullForEmptyElements` in interface `JsonXMLConfig`
      Returns:
        true if null is written, false if "" is written

Copyright © 2005–2019 Apache Software Foundation. All rights reserved.