BoundType - The type that JAXB doesn't know how to handle. An adapter is written
to allow this type to be used as an in-memory representation through
the ValueType.ValueType - The type that JAXB knows how to handle out of the box.public abstract class SimpleXmlAdapter<ValueType,BoundType> extends XmlAdapter<ValueType,BoundType>
XmlAdapter subclasses with a bit less boilerplate code,
using Java 8 lambas instead of implementing the XmlAdapter.marshal(Object) and
XmlAdapterunmarshal(Object) methods.| Modifier and Type | Class and Description |
|---|---|
static interface |
SimpleXmlAdapter.Marshal<BoundType,ValueType> |
static interface |
SimpleXmlAdapter.Unmarshal<ValueType,BoundType> |
| Modifier | Constructor and Description |
|---|---|
protected |
SimpleXmlAdapter(SimpleXmlAdapter.Marshal<BoundType,ValueType> marshal)
Create an adapter which only supports marshalling, i.e.
|
protected |
SimpleXmlAdapter(SimpleXmlAdapter.Unmarshal<ValueType,BoundType> unmarshal)
Create an adapter which only supports unmarshalling, i.e.
|
protected |
SimpleXmlAdapter(SimpleXmlAdapter.Unmarshal<ValueType,BoundType> unmarshal,
SimpleXmlAdapter.Marshal<BoundType,ValueType> marshal)
Create an adapter for converting between a
ValueType natively supported by JAXB
and a custom BoundType. |
| Modifier and Type | Method and Description |
|---|---|
ValueType |
marshal(BoundType v) |
BoundType |
unmarshal(ValueType v) |
protected SimpleXmlAdapter(SimpleXmlAdapter.Marshal<BoundType,ValueType> marshal)
marshal - this function defines how to convert from your custom BoundType to the
ValueType which JAXB knows how to handle.protected SimpleXmlAdapter(SimpleXmlAdapter.Unmarshal<ValueType,BoundType> unmarshal)
unmarshal - this function defines how to convert from the ValueType
which JAXB knows how to handle into your custom BoundType.protected SimpleXmlAdapter(SimpleXmlAdapter.Unmarshal<ValueType,BoundType> unmarshal, SimpleXmlAdapter.Marshal<BoundType,ValueType> marshal)
ValueType natively supported by JAXB
and a custom BoundType.unmarshal - this function defines how to convert from the ValueType
which JAXB knows how to handle into your custom BoundType.marshal - this function defines how to convert from your custom BoundType to the
ValueType which JAXB knows how to handle.Copyright © 2019 Digipost. All rights reserved.