Package org.camunda.spin
Class Spin<T extends Spin<?>>
- java.lang.Object
-
- org.camunda.spin.Spin<T>
-
- Direct Known Subclasses:
SpinJsonNode,SpinXmlNode
public abstract class Spin<T extends Spin<?>> extends java.lang.Object- Author:
- Sebastian Menski, Daniel Meyer
-
-
Constructor Summary
Constructors Constructor Description Spin()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.StringgetDataFormatName()Provides the name of the dataformat used by this spin.static SpinJsonNodeJSON(java.lang.Object input)Creates a spin wrapper for a data input.abstract <C> CmapTo(java.lang.Class<C> type)Maps the wrapped object to an instance of a java class.abstract <C> CmapTo(java.lang.String type)Maps the wrapped object to a java object.static <T extends Spin<?>>
TS(java.lang.Object input)Creates a spin wrapper for a data input.static <T extends Spin<?>>
TS(java.lang.Object input, java.lang.String dataFormatName)Creates a spin wrapper for a data input of a given data format.static <T extends Spin<?>>
TS(java.lang.Object input, DataFormat<T> format)Creates a spin wrapper for a data input of a given data format.abstract java.lang.StringtoString()Returns the wrapped object as string representation.abstract java.lang.Objectunwrap()Return the wrapped object.abstract voidwriteToWriter(java.io.Writer writer)Writes the wrapped object to a existing writer.static SpinXmlElementXML(java.lang.Object input)Creates a spin wrapper for a data input.
-
-
-
Method Detail
-
S
public static <T extends Spin<?>> T S(java.lang.Object input, DataFormat<T> format)
Creates a spin wrapper for a data input of a given data format.- Parameters:
input- the input to wrapformat- the data format of the input- Returns:
- the spin wrapper for the input
- Throws:
java.lang.IllegalArgumentException- in case an argument of illegal type is provided (such as 'null')
-
S
public static <T extends Spin<?>> T S(java.lang.Object input, java.lang.String dataFormatName)
Creates a spin wrapper for a data input of a given data format.- Parameters:
input- the input to wrapdataFormatName- the data format name of the input- Returns:
- the spin wrapper for the input
- Throws:
java.lang.IllegalArgumentException- in case an argument of illegal type is provided (such as 'null')
-
S
public static <T extends Spin<?>> T S(java.lang.Object input)
Creates a spin wrapper for a data input. The data format of the input is auto detected.- Parameters:
input- the input to wrap- Returns:
- the spin wrapper for the input
- Throws:
java.lang.IllegalArgumentException- in case an argument of illegal type is provided (such as 'null')
-
XML
public static SpinXmlElement XML(java.lang.Object input)
Creates a spin wrapper for a data input. The data format of the input is assumed to be XML.- Parameters:
input- the input to wrap- Returns:
- the spin wrapper for the input
- Throws:
java.lang.IllegalArgumentException- in case an argument of illegal type is provided (such as 'null')
-
JSON
public static SpinJsonNode JSON(java.lang.Object input)
Creates a spin wrapper for a data input. The data format of the input is assumed to be JSON.- Parameters:
input- the input to wrap- Returns:
- the spin wrapper for the input
- Throws:
java.lang.IllegalArgumentException- in case an argument of illegal type is provided (such as 'null')
-
getDataFormatName
public abstract java.lang.String getDataFormatName()
Provides the name of the dataformat used by this spin.- Returns:
- the name of the dataformat used by this Spin.
-
unwrap
public abstract java.lang.Object unwrap()
Return the wrapped object. The return type of this method depends on the concrete data format.- Returns:
- the object wrapped by this wrapper.
-
toString
public abstract java.lang.String toString()
Returns the wrapped object as string representation.- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representation
-
writeToWriter
public abstract void writeToWriter(java.io.Writer writer)
Writes the wrapped object to a existing writer.- Parameters:
writer- the writer to write to
-
mapTo
public abstract <C> C mapTo(java.lang.Class<C> type)
Maps the wrapped object to an instance of a java class.- Parameters:
type- the java class to map to- Returns:
- the mapped object
-
mapTo
public abstract <C> C mapTo(java.lang.String type)
Maps the wrapped object to a java object. The object is determined based on the configuration string which is data format specific.- Parameters:
type- the class name to map to- Returns:
- the mapped object
-
-