Package com.bc.ceres.binding.dom
Interface DomConverter
- All Known Implementing Classes:
BandDescriptorDomConverter
,DefaultDomConverter
,XStreamDomConverter
public interface DomConverter
A
DomConverter
provides a strategy to convert a value of a certain type from
an (XML) DOM to a Java value and vice versa. Its common use is to convert complex value types
from and to XML.- Since:
- 0.6
-
Method Summary
Modifier and TypeMethodDescriptionconvertDomToValue
(DomElement parentElement, Object value) Converts a DOM to a (complex) value of the type returned bygetValueType()
.void
convertValueToDom
(Object value, DomElement parentElement) Converts a (complex) value of the type returned bygetValueType()
to its DOM representation which may be further converted to XML.Class
<?> Gets the value type, which may be abstract.
-
Method Details
-
getValueType
Class<?> getValueType()Gets the value type, which may be abstract.- Returns:
- The value type.
-
convertDomToValue
Object convertDomToValue(DomElement parentElement, Object value) throws ConversionException, ValidationException Converts a DOM to a (complex) value of the type returned bygetValueType()
.- Parameters:
parentElement
- The parent DOM element.value
- The value which receives the DOM representation of the value ornull
. Ifvalue
isnull
, the method is responsible for the creation of a new instance and its configuration using the DOM.- Returns:
- The converted value, never
null
. - Throws:
ConversionException
- If the conversion fails.ValidationException
- If the converted value is invalid.
-
convertValueToDom
Converts a (complex) value of the type returned bygetValueType()
to its DOM representation which may be further converted to XML. The givenvalue
can be safely cast to the type returned bygetValueType()
.- Parameters:
value
- The value to be converted to the DOM. Nevernull
.parentElement
- The parent DOM element, which receives the DOM representation of the value.- Throws:
ConversionException
- If the conversion fails (e.g. not implemented).
-