Module org.seasar.doma.core
Package org.seasar.doma.jdbc.domain
Interface DomainConverter<DOMAIN,BASIC>
- Type Parameters:
DOMAIN- the type of the domain objectBASIC- the type of the basic value
- All Known Implementing Classes:
JdbcTypeProvider
public interface DomainConverter<DOMAIN,BASIC>
A converter interface for mapping between domain objects and their corresponding basic values.
The implementation class should be annotated with ExternalDomain.
@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);
}
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfromDomainToValue(DOMAIN domain) Converts a domain object into a basic value.fromValueToDomain(BASIC value) Converts a basic value into a domain object.
-
Method Details
-
fromDomainToValue
Converts a domain object into a basic value.- Parameters:
domain- the domain object; must not be null- Returns:
- the basic value; can be null
-
fromValueToDomain
Converts a basic value into a domain object.- Parameters:
value- the basic value; can be null- Returns:
- the domain object; can be null
-