M - the model typeT - the target typepublic interface Converter<M,T>
Note that it is not required to preserve data through the conversion. Meaning, a value object that goes through a round trip of conversion will not necessary result in the original value.
It is generally recommended that converters convert null to null.
Classes implementing this interface are strongly encouraged to also override equals and hashCode as converters are likely to be used in various collections by the g9 framework.
| Modifier and Type | Method and Description |
|---|---|
T |
fromModel(M value,
ConvertContext context)
Convert a value object from domain to target.
|
M |
toModel(T value,
ConvertContext context)
Convert a value object from some representation to domain value type.
|
T fromModel(M value, ConvertContext context) throws ConvertException
value - The value object to convertcontext - The conversion contextConvertException - If conversion can not be performedM toModel(T value, ConvertContext context) throws ConvertException
value - The value to convertcontext - The conversion contextConvertException - If conversion can not be performedCopyright © 2006–2018 Esito AS. All rights reserved.