Class DomXmlDataFormat
- java.lang.Object
-
- org.camunda.bpm.client.variable.impl.format.xml.DomXmlDataFormat
-
- All Implemented Interfaces:
DataFormat
public class DomXmlDataFormat extends java.lang.Object implements DataFormat
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.xml.parsers.DocumentBuilderFactorydocumentBuilderFactorythe DocumentBuilderFactory used by the readerprotected static DomXmlLoggerLOGprotected java.lang.Stringnameprotected javax.xml.transform.TransformerFactorytransformerFactorythe TransformerFactory instance used by the writer
-
Constructor Summary
Constructors Constructor Description DomXmlDataFormat(java.lang.String name)DomXmlDataFormat(java.lang.String name, javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)DomXmlDataFormat(java.lang.String name, javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory, javax.xml.transform.TransformerFactory transformerFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanMap(java.lang.Object value)Returns true if this data format can map the provided Java Object.protected javax.xml.bind.MarshallercreateMarshaller(java.lang.Class<?>... types)protected javax.xml.bind.UnmarshallercreateUnmarshaller(java.lang.Class<?>... types)static javax.xml.parsers.DocumentBuilderFactorydefaultDocumentBuilderFactory()static javax.xml.transform.TransformerFactorydefaultTransformerFactory()java.lang.StringgetCanonicalTypeName(java.lang.Object value)Returns a data-format-specific canonical type name.protected javax.xml.bind.JAXBContextgetContext(java.lang.Class<?>... types)protected javax.xml.parsers.DocumentBuildergetDocumentBuilder()javax.xml.parsers.DocumentBuilderFactorygetDocumentBuilderFactory()java.lang.StringgetName()Returns the data format name.protected javax.xml.transform.TransformergetTransformer()javax.xml.transform.TransformerFactorygetTransformerFactory()static java.lang.Class<?>loadClass(java.lang.String classname, DataFormat dataFormat)org.w3c.dom.ElementreadAsElement(java.lang.String value)<T> TreadValue(java.lang.String value, java.lang.Class<T> cls)Reads the internal representation of a data format to a java object of the desired class.<T> TreadValue(java.lang.String value, java.lang.String typeIdentifier)Reads the internal representation of a data format to a java object of the desired class.protected org.w3c.dom.ElementwriteAsElement(java.lang.Object value)protected voidwriteResult(javax.xml.transform.stream.StreamResult streamResult, java.lang.Object input)java.lang.StringwriteValue(java.lang.Object value)Writes a java object to a data format's internal data representation.
-
-
-
Field Detail
-
LOG
protected static final DomXmlLogger LOG
-
name
protected java.lang.String name
-
documentBuilderFactory
protected javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory
the DocumentBuilderFactory used by the reader
-
transformerFactory
protected javax.xml.transform.TransformerFactory transformerFactory
the TransformerFactory instance used by the writer
-
-
Constructor Detail
-
DomXmlDataFormat
public DomXmlDataFormat(java.lang.String name)
-
DomXmlDataFormat
public DomXmlDataFormat(java.lang.String name, javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)
-
DomXmlDataFormat
public DomXmlDataFormat(java.lang.String name, javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory, javax.xml.transform.TransformerFactory transformerFactory)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:DataFormatReturns the data format name.- Specified by:
getNamein interfaceDataFormat
-
getDocumentBuilderFactory
public javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
-
getTransformerFactory
public javax.xml.transform.TransformerFactory getTransformerFactory()
-
canMap
public boolean canMap(java.lang.Object value)
Description copied from interface:DataFormatReturns true if this data format can map the provided Java Object.- Specified by:
canMapin interfaceDataFormat- Returns:
- true if this object can be mapped.
-
writeValue
public java.lang.String writeValue(java.lang.Object value)
Description copied from interface:DataFormatWrites a java object to a data format's internal data representation.- Specified by:
writeValuein interfaceDataFormat- Parameters:
value- object that is written into internal data representation- Returns:
- the data format's internal representation of that object
-
readValue
public <T> T readValue(java.lang.String value, java.lang.String typeIdentifier)Description copied from interface:DataFormatReads the internal representation of a data format to a java object of the desired class.- Specified by:
readValuein interfaceDataFormat- Parameters:
value- the object to be readtypeIdentifier- the class to map the object to- Returns:
- a java object of the specified class that was populated with the input parameter
-
readValue
public <T> T readValue(java.lang.String value, java.lang.Class<T> cls)Description copied from interface:DataFormatReads the internal representation of a data format to a java object of the desired class.- Specified by:
readValuein interfaceDataFormat- Parameters:
value- the object to be readcls- a data-format-specific type identifier that describes the class to map to- Returns:
- a java object of the specified class that was populated with the input parameter
-
getCanonicalTypeName
public java.lang.String getCanonicalTypeName(java.lang.Object value)
Description copied from interface:DataFormatReturns a data-format-specific canonical type name.- Specified by:
getCanonicalTypeNamein interfaceDataFormat
-
writeResult
protected void writeResult(javax.xml.transform.stream.StreamResult streamResult, java.lang.Object input)
-
writeAsElement
protected org.w3c.dom.Element writeAsElement(java.lang.Object value)
-
getTransformer
protected javax.xml.transform.Transformer getTransformer()
-
readAsElement
public org.w3c.dom.Element readAsElement(java.lang.String value)
-
getDocumentBuilder
protected javax.xml.parsers.DocumentBuilder getDocumentBuilder()
-
getContext
protected javax.xml.bind.JAXBContext getContext(java.lang.Class<?>... types)
-
createMarshaller
protected javax.xml.bind.Marshaller createMarshaller(java.lang.Class<?>... types)
-
createUnmarshaller
protected javax.xml.bind.Unmarshaller createUnmarshaller(java.lang.Class<?>... types)
-
defaultTransformerFactory
public static javax.xml.transform.TransformerFactory defaultTransformerFactory()
-
defaultDocumentBuilderFactory
public static javax.xml.parsers.DocumentBuilderFactory defaultDocumentBuilderFactory()
-
loadClass
public static java.lang.Class<?> loadClass(java.lang.String classname, DataFormat dataFormat)
-
-