Indicates that an arbitrary class should be handled as if it was a
Domain annotated
class.
The annotated class must implement DomainConverter.
In the example below, the SalaryConverter class handles the Salary class as a Domain
annotated class:
@ExternalDomain
public class SalaryConverter implements DomainConverter<Salary, BigDecimal> {
public BigDecimal fromDomainToValue(Salary domain) {
return domain.getValue();
}
public Salary fromValueToDomain(BigDecimal value) {
if (value == null) {
return null;
}
return new Salary(value);
}
}
The annotated instance is required to be thread safe.
- See Also: