package curam.inheritance; import curam.inheritance.Cat; import curam.inheritance.struct.CatDtls; public class CatImpl extends AnimalImpl<CatDtls> implements Cat { protected CatImpl() { } public int getNumberOfLivesRemaining() { return getDtls().numberOfLivesRemaining; } public void setNumberOfLivesRemaining(final int value) { getDtls().numberOfLivesRemaining = value; } public String getName() { return getDtls().name; } public void setName(String value) { getDtls().name = value; } public void speak() { System.out.println("Miaow! My name is " + getName() + " and I have " + getNumberOfLivesRemaining() + " lives remaining"); } public void crossFieldValidation() { // none required } public void crossEntityValidation() { // none required } public void mandatoryFieldValidation() { // none required } public void setNewInstanceDefaults() { // none required } }
public class CatImpl extends AnimalImpl<CatDtls> implements Cat {
protected CatImpl() { }
The class has a protected constructor, as is the norm for the implementation classes.
The getters and setters make use of the regular SingleTableEntityImpl.getDtls method to access the CatDtls row data.
public void speak() { System.out.println("Miaow! My name is " + getName() + " and I have " + getNumberOfLivesRemaining() + " lives remaining"); }
This class must provide an implementation of the Animal.speak method.