Package com.adaptris.core.transform.json
Class JsonTransformationDriverImpl
- java.lang.Object
-
- com.adaptris.core.transform.json.JsonTransformationDriverImpl
-
- All Implemented Interfaces:
TransformationDriver
- Direct Known Subclasses:
JsonlibTransformationDriver
public abstract class JsonTransformationDriverImpl extends java.lang.Object implements TransformationDriver
Transformation Driver using thenet.sf.json
package.
-
-
Constructor Summary
Constructors Constructor Description JsonTransformationDriverImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
getArrayName()
Get the array name.java.lang.String
getElementName()
Get the element name.java.lang.Boolean
getForceTopLevelObject()
Whether force top level is set.java.lang.String
getObjectName()
Get the object name.java.lang.String
getRootName()
Get the root name.java.lang.Boolean
getSkipWhitespace()
Whether skip whitespace is set.java.lang.Boolean
getTrimSpaces()
Whether trim whitespace is set.java.lang.Boolean
getTypeHintsCompatibility()
Whether type hints compatibility is set.java.lang.Boolean
getTypeHintsEnabled()
Whether type hints is enabled.java.lang.String
objectName()
Get the object name, or default value if null.protected abstract net.sf.json.JSON
parse(java.lang.String input)
Parse the string to JSON.void
setArrayName(java.lang.String arrayName)
Set the array name.void
setElementName(java.lang.String elementName)
Set the element name.void
setForceTopLevelObject(java.lang.Boolean forceTopLevelObject)
Set whether to force top level object.void
setObjectName(java.lang.String objectName)
Set the object name.void
setRootName(java.lang.String rootName)
Set the root name.void
setSkipWhitespace(java.lang.Boolean skipWhitespace)
Set whether to skip whitespace.void
setTrimSpaces(java.lang.Boolean trimSpaces)
Set whether to trim whitespace.void
setTypeHintsCompatibility(java.lang.Boolean typeHintsCompatibility)
Set whether type hints compatibility is enabled.void
setTypeHintsEnabled(java.lang.Boolean typeHintsEnabled)
Set whether type hints is enabled.java.lang.String
transform(java.lang.String input, TransformationDirection direction)
Perform transformation.protected java.lang.String
xmlToJSON(java.lang.String input)
Convert XML to JSON.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.transform.json.TransformationDriver
transform
-
-
-
-
Method Detail
-
transform
public java.lang.String transform(java.lang.String input, TransformationDirection direction) throws ServiceException
Perform transformation..- Specified by:
transform
in interfaceTransformationDriver
- 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 java.lang.String xmlToJSON(java.lang.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(java.lang.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 java.lang.String getArrayName()
Get the array name.- Returns:
- The array name.
-
setArrayName
public void setArrayName(java.lang.String arrayName)
Set the array name.- Parameters:
arrayName
- The array name.
-
getElementName
public java.lang.String getElementName()
Get the element name.- Returns:
- The element name.
-
setElementName
public void setElementName(java.lang.String elementName)
Set the element name.- Parameters:
elementName
- The element name.
-
getObjectName
public java.lang.String getObjectName()
Get the object name.- Returns:
- The object name.
-
objectName
public java.lang.String objectName()
Get the object name, or default value if null.- Returns:
- The object name, or default value.
-
setObjectName
public void setObjectName(java.lang.String objectName)
Set the object name.- Parameters:
objectName
- The object name.
-
getRootName
public java.lang.String getRootName()
Get the root name.- Returns:
- The root name.
-
setRootName
public void setRootName(java.lang.String rootName)
Set the root name.- Parameters:
rootName
- The root name.
-
getForceTopLevelObject
public java.lang.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(java.lang.Boolean forceTopLevelObject)
Set whether to force top level object.- Parameters:
forceTopLevelObject
- Whether to force top level object.
-
getSkipWhitespace
public java.lang.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(java.lang.Boolean skipWhitespace)
Set whether to skip whitespace.- Parameters:
skipWhitespace
- Whether to skip whitespace.
-
getTrimSpaces
public java.lang.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(java.lang.Boolean trimSpaces)
Set whether to trim whitespace.- Parameters:
trimSpaces
- Whether to trim whitespace.
-
getTypeHintsCompatibility
public java.lang.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(java.lang.Boolean typeHintsCompatibility)
Set whether type hints compatibility is enabled.- Parameters:
typeHintsCompatibility
- Whether type hints compatibility is enabled.
-
getTypeHintsEnabled
public java.lang.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(java.lang.Boolean typeHintsEnabled)
Set whether type hints is enabled.- Parameters:
typeHintsEnabled
- Whether type hints is enabled.
-
-