package curam.inheritance; import curam.inheritance.Animal; import curam.inheritance.struct.AnimalDtls; import curam.util.persistence.helper.SingleTableEntityImpl; abstract class AnimalImpl extends SingleTableEntityImpl<AnimalDtls> implements Animal { protected AnimalImpl() { } public String getName() { return getDtls().name; } public void setName(final String value) { getDtls().name = value; } }
abstract class AnimalImpl extends SingleTableEntityImpl<AnimalDtls> implements Animal {
The implementation class extends the standard class SingleTableEntityImpl, parameterized with the Dtls struct from the single database table (AnimalDtls).
The class is package-protected and marked abstract. In this example the subclasses will be placed in the same code-package; if you require some of your subclasses to be in a different package, you will need to mark your abstract implementation class public.
protected AnimalImpl() { }
The getters and setters make use of the SingleTableEntityImpl.getDtls to retrieve the Dtls struct for the single row (in this example an AnimalDtls struct).