First, a little background. I am exploring the possibility of implementing Ruby ActiveRecord in Java as cleanly and concisely as possible. To do this, I will need to allow the following method call:
Person person = Person.find("name", "Mike");
To solve something like:
ActiveRecord.find(Person.class, "name", "Mike");
It is assumed that Person extends ActiveRecord, which will have a static search method with two parameters (column, value). This method should know that it was called through Person.find, and not another domain class, such as Car.find, and call the find (Class, String, Object) method to perform the actual operation.
The problem I'm facing is figuring out through which child class of the ActiveRecord the static search method is called (two parameters). The following is a simple example:
public class A {
public static void testMethod() {
}
}
public class B extends A { }
public class C extends A { }
public class Runner {
public static void main(String[] args) {
A.testMethod();
B.testMethod();
C.testMethod();
}
}
, , - aspectJ. testMethod() , . , ( VM args) .
?
java - groovy/ruby /python?
- ActiveRecord.find Person.save ?