I have a Pojo class that is corresponding to a table in the database. The class Report.java has several fields:
class Report {
public Date createDate;
public String creator;
public String description;
public String id;
}
From the first requirement, I need to return the Report object using the id to search for it in the database. The response should only contains those 4 fields. But now they want to have another REST endpoint such that with the id, I need to return extra information in the response such as Date validUntil; I am thinking to use inheritance for this such as:
class ExtendedReport extends Report {
public Date validUntil;
}
I am not sure is this the best way to reduce boiler plate or I should do another way ?
Thank you.
Aucun commentaire:
Enregistrer un commentaire