public class DomXmlDataFormat extends Object implements DataFormat
Modifier and Type | Field and Description |
---|---|
protected DocumentBuilderFactory |
documentBuilderFactory
the DocumentBuilderFactory used by the reader
|
protected static DomXmlLogger |
LOG |
protected String |
name |
protected TransformerFactory |
transformerFactory
the TransformerFactory instance used by the writer
|
Constructor and Description |
---|
DomXmlDataFormat(String name) |
DomXmlDataFormat(String name,
DocumentBuilderFactory documentBuilderFactory) |
DomXmlDataFormat(String name,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory) |
Modifier and Type | Method and Description |
---|---|
boolean |
canMap(Object value)
Returns true if this data format can map the provided Java Object.
|
protected Marshaller |
createMarshaller(Class<?>... types) |
protected Unmarshaller |
createUnmarshaller(Class<?>... types) |
static DocumentBuilderFactory |
defaultDocumentBuilderFactory() |
static TransformerFactory |
defaultTransformerFactory() |
String |
getCanonicalTypeName(Object value)
Returns a data-format-specific canonical type name.
|
protected JAXBContext |
getContext(Class<?>... types) |
protected DocumentBuilder |
getDocumentBuilder() |
DocumentBuilderFactory |
getDocumentBuilderFactory() |
String |
getName()
Returns the data format name.
|
protected Transformer |
getTransformer() |
TransformerFactory |
getTransformerFactory() |
static Class<?> |
loadClass(String classname,
DataFormat dataFormat) |
Element |
readAsElement(String value) |
<T> T |
readValue(String value,
Class<T> cls)
Reads the internal representation of a data format to a java object of the
desired class.
|
<T> T |
readValue(String value,
String typeIdentifier)
Reads the internal representation of a data format to a java object of the
desired class.
|
protected Element |
writeAsElement(Object value) |
protected void |
writeResult(StreamResult streamResult,
Object input) |
String |
writeValue(Object value)
Writes a java object to a data format's internal data representation.
|
protected static final DomXmlLogger LOG
protected String name
protected DocumentBuilderFactory documentBuilderFactory
protected TransformerFactory transformerFactory
public DomXmlDataFormat(String name)
public DomXmlDataFormat(String name, DocumentBuilderFactory documentBuilderFactory)
public DomXmlDataFormat(String name, DocumentBuilderFactory documentBuilderFactory, TransformerFactory transformerFactory)
public String getName()
DataFormat
getName
in interface DataFormat
public DocumentBuilderFactory getDocumentBuilderFactory()
public TransformerFactory getTransformerFactory()
public boolean canMap(Object value)
DataFormat
canMap
in interface DataFormat
public String writeValue(Object value)
DataFormat
writeValue
in interface DataFormat
value
- object that is written into internal data representationpublic <T> T readValue(String value, String typeIdentifier)
DataFormat
readValue
in interface DataFormat
value
- the object to be readtypeIdentifier
- the class to map the object topublic <T> T readValue(String value, Class<T> cls)
DataFormat
readValue
in interface DataFormat
value
- the object to be readcls
- a data-format-specific type identifier that describes
the class to map topublic String getCanonicalTypeName(Object value)
DataFormat
getCanonicalTypeName
in interface DataFormat
protected void writeResult(StreamResult streamResult, Object input)
protected Transformer getTransformer()
protected DocumentBuilder getDocumentBuilder()
protected JAXBContext getContext(Class<?>... types)
protected Marshaller createMarshaller(Class<?>... types)
protected Unmarshaller createUnmarshaller(Class<?>... types)
public static TransformerFactory defaultTransformerFactory()
public static DocumentBuilderFactory defaultDocumentBuilderFactory()
public static Class<?> loadClass(String classname, DataFormat dataFormat)
Copyright © 2022. All rights reserved.