Interfaces and Generics for a Service
Interfaces and Generics for a Java Service
Model
public interface ModelObject {
public String getName();
public void setName(final String name);
}
@Entity
public class ModelObjectEntity implements ModelObject {
// Class prepared for persistence
public Integer getId() {
return id;
}
}
public class ModelObjectAdditionalField implements ModelObject {
// Implements the interface, but adds a field
public Integer getDate() {
return date;
}
}Service
Usage
Last updated