I have a situation where a subclass (let's call it SubClass), during class initialization, calls a static method of the base class (let's call it BaseClass) and passes SubClass.class as a parameter to identify the specific class being initialized, or in Java:
public class SubClass extends BaseClass {
static { BaseClass.init(SubClass.class); }
...
}
Instead of BaseClass having the method:
protected static void init(Class<?> c) {
...
}
what I would like to do is have BaseClass call init automatically, such as:
public class BaseClass {
static { init(thisclass); }
...
}
So, the question is, does Java have some keyword, represented by thisclass above, that returns the class being initialized in a class initializer?