Entity, Value Object and Data Transfer Object
- Entity: Entity objects are uniquely identified by the ID and not by the attributes.
- Value Object: Value object is associated with entity. It is used to describe some entity attributes.
- Data Transfer Object (DTO): In web applications, DTO are used to transfer data between the layers (UI and back end).
Entity
public record TaxableEntity ( int id, String name, int age, char sex,
String location, TaxParamVO taxVO ) {
}
Value Object
public record TaxParamVO (double basic, double da, double hra,
double cess, double allowance, double deduction,
double surcharge) {
}
DTO
public record TaxDTO ( int id, String name, int age, char sex, String location,
double basic, double da, double hra, double cess,
double allowance, double deduction, double surcharge ) {
}
Comments
Post a Comment