Class JsonTransformationDriverImpl

java.lang.Object
com.adaptris.core.transform.json.JsonTransformationDriverImpl
All Implemented Interfaces:
TransformationDriver
Direct Known Subclasses:
JsonlibTransformationDriver

public abstract class JsonTransformationDriverImpl extends Object implements TransformationDriver
Transformation Driver using the net.sf.json package.
  • Constructor Details

    • JsonTransformationDriverImpl

      public JsonTransformationDriverImpl()
  • Method Details

    • transform

      public String transform(String input, TransformationDirection direction) throws ServiceException
      Perform transformation..
      Specified by:
      transform in interface TransformationDriver
      Parameters:
      input - The data to transform.
      direction - The direction of the transformation.
      Returns:
      The transformed data.
      Throws:
      ServiceException - Thrown if there is a problem with the transformation.
    • xmlToJSON

      protected String xmlToJSON(String input) throws ServiceException
      Convert XML to JSON.
      Parameters:
      input - The XML to convert.
      Returns:
      The converted JSON.
      Throws:
      ServiceException - Thrown if there was a problem converting from XML to JSON.
    • parse

      protected abstract net.sf.json.JSON parse(String input) throws net.sf.json.JSONException
      Parse the string to JSON.
      Parameters:
      input - The string to parse.
      Returns:
      The JSON.
      Throws:
      net.sf.json.JSONException - Thrown if the string could not be parsed to JSON.
    • getArrayName

      public String getArrayName()
      Get the array name.
      Returns:
      The array name.
    • setArrayName

      public void setArrayName(String arrayName)
      Set the array name.
      Parameters:
      arrayName - The array name.
    • getElementName

      public String getElementName()
      Get the element name.
      Returns:
      The element name.
    • setElementName

      public void setElementName(String elementName)
      Set the element name.
      Parameters:
      elementName - The element name.
    • getObjectName

      public String getObjectName()
      Get the object name.
      Returns:
      The object name.
    • objectName

      public String objectName()
      Get the object name, or default value if null.
      Returns:
      The object name, or default value.
    • setObjectName

      public void setObjectName(String objectName)
      Set the object name.
      Parameters:
      objectName - The object name.
    • getRootName

      public String getRootName()
      Get the root name.
      Returns:
      The root name.
    • setRootName

      public void setRootName(String rootName)
      Set the root name.
      Parameters:
      rootName - The root name.
    • getForceTopLevelObject

      public Boolean getForceTopLevelObject()
      Whether force top level is set. (Use object as value may not have been defined in configuration, hence null.)
      Returns:
      True if force top level is set.
    • setForceTopLevelObject

      public void setForceTopLevelObject(Boolean forceTopLevelObject)
      Set whether to force top level object.
      Parameters:
      forceTopLevelObject - Whether to force top level object.
    • getSkipWhitespace

      public Boolean getSkipWhitespace()
      Whether skip whitespace is set. (Use object as value may not have been defined in configuration, hence null.)
      Returns:
      True if skip whitespace is set.
    • setSkipWhitespace

      public void setSkipWhitespace(Boolean skipWhitespace)
      Set whether to skip whitespace.
      Parameters:
      skipWhitespace - Whether to skip whitespace.
    • getTrimSpaces

      public Boolean getTrimSpaces()
      Whether trim whitespace is set. (Use object as value may not have been defined in configuration, hence null.)
      Returns:
      True if trim whitespace is set.
    • setTrimSpaces

      public void setTrimSpaces(Boolean trimSpaces)
      Set whether to trim whitespace.
      Parameters:
      trimSpaces - Whether to trim whitespace.
    • getTypeHintsCompatibility

      public Boolean getTypeHintsCompatibility()
      Whether type hints compatibility is set. (Use object as value may not have been defined in configuration, hence null.)
      Returns:
      True if type hints compatibility is set.
    • setTypeHintsCompatibility

      public void setTypeHintsCompatibility(Boolean typeHintsCompatibility)
      Set whether type hints compatibility is enabled.
      Parameters:
      typeHintsCompatibility - Whether type hints compatibility is enabled.
    • getTypeHintsEnabled

      public Boolean getTypeHintsEnabled()
      Whether type hints is enabled. (Use object as value may not have been defined in configuration, hence null.)
      Returns:
      True if type hints is enabled.
    • setTypeHintsEnabled

      public void setTypeHintsEnabled(Boolean typeHintsEnabled)
      Set whether type hints is enabled.
      Parameters:
      typeHintsEnabled - Whether type hints is enabled.