public class DefaultDomConverter extends Object implements DomConverter
Constructor and Description |
---|
DefaultDomConverter(Class<?> valueType) |
DefaultDomConverter(Class<?> valueType,
PropertyDescriptorFactory propertyDescriptorFactory) |
DefaultDomConverter(Class<?> valueType,
PropertyDescriptorFactory propertyDescriptorFactory,
PropertySetDescriptor propertySetDescriptor) |
Modifier and Type | Method and Description |
---|---|
Object |
convertDomToValue(DomElement parentElement,
Object value)
Converts a DOM to a (complex) value of the type returned by
DomConverter.getValueType() . |
void |
convertValueToDom(Object value,
DomElement parentElement)
Converts a (complex) value of the type returned by
DomConverter.getValueType() to its
DOM representation which may be further converted to XML. |
protected DomConverter |
createChildDomConverter(Class<?> valueType,
PropertyDescriptorFactory propertyDescriptorFactory,
PropertySetDescriptor propertySetDescriptor)
Called to create a new DOM converter for a (child) property.
|
protected Object |
createValueInstance(Class<?> type) |
protected DomConverter |
findChildDomConverter(PropertyDescriptor descriptor)
Called to find a "local" DOM converter for a (child) property.
|
PropertyDescriptorFactory |
getPropertyDescriptorFactory() |
protected PropertySet |
getPropertySet(Object value) |
PropertySetDescriptor |
getPropertySetDescriptor() |
Class<?> |
getValueType()
Gets the value type, which may be abstract.
|
public DefaultDomConverter(Class<?> valueType)
public DefaultDomConverter(Class<?> valueType, PropertyDescriptorFactory propertyDescriptorFactory)
public DefaultDomConverter(Class<?> valueType, PropertyDescriptorFactory propertyDescriptorFactory, PropertySetDescriptor propertySetDescriptor)
public Class<?> getValueType()
getValueType
in interface DomConverter
public PropertyDescriptorFactory getPropertyDescriptorFactory()
public PropertySetDescriptor getPropertySetDescriptor()
public void convertValueToDom(Object value, DomElement parentElement) throws ConversionException
DomConverter.getValueType()
to its
DOM representation which may be further converted to XML. The given value
can be
safely cast to the type returned by DomConverter.getValueType()
.convertValueToDom
in interface DomConverter
value
- The value to be converted to the DOM. Never null
.parentElement
- The parent DOM element, which receives the DOM representation of the value.ConversionException
- If the conversion fails (e.g. not implemented).public Object convertDomToValue(DomElement parentElement, Object value) throws ConversionException, ValidationException
DomConverter.getValueType()
.convertDomToValue
in interface DomConverter
parentElement
- The parent DOM element.value
- The value which receives the DOM representation of the value or null
.
If value
is null
, the method is responsible for the creation of a new instance
and its configuration using the DOM.null
.ConversionException
- If the conversion fails.ValidationException
- If the converted value is invalid.protected PropertySet getPropertySet(Object value)
protected DomConverter createChildDomConverter(Class<?> valueType, PropertyDescriptorFactory propertyDescriptorFactory, PropertySetDescriptor propertySetDescriptor)
valueType
- The value typepropertyDescriptorFactory
- The property descriptor factory.propertySetDescriptor
- The property set descriptor.null
.protected DomConverter findChildDomConverter(PropertyDescriptor descriptor)
null
.descriptor
- The property descriptornull
.Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.