Suppose I have a POJO User,which I add some static method to do the CRUD operation:
public class User { private String name; private int age; // getter and setter omitted // public static void add(User user) { // add person } public static int delete(Object id) { // delete person return 1; } } Since I have other entities like User,so I want to make the add and delete method abstracted,something like this;
public class?interface Entity<T>{ static add(T t); static delete(Object id); } public class User extends Entity<User>{ @override static add(User user){ // add ... } .... } Is this possible?