Given an interface like:
public interface MetaController<T extends SendableMotorController> extends SendableMotorController {
T getController();
}
where T can itself be MetaController<U> (where U is not T), I need a method that can traverse this chain and return the class that is at the bottom of the chain (i.e., not something implementing MetaController).
Knowing Java's type system limitations, it likely can't return a different class it determines at runtime, but could perhaps be able to do it with an auxiliary object like so:
public class Box<T> {
private T obj;
public T get() {
return obj;
}
}
Given an interface like:
where
Tcan itself beMetaController<U>(whereUis notT), I need a method that can traverse this chain and return the class that is at the bottom of the chain (i.e., not something implementingMetaController).Knowing Java's type system limitations, it likely can't return a different class it determines at runtime, but could perhaps be able to do it with an auxiliary object like so: