I’m developing ORM in Java. I want to do this.
class Model {
public static Model find(Object id) {
}
}
class User extends Model;
class Post extends Model;
User user = User.find(15);
Post post = Post.find(1325);
How can I do this, or similar things. I don’t want to pass Class object to find method.
You should not do this. A super class can never know how it’s extended.
Use generics instead: