Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetaController traversing #14

Open
ariscript opened this issue Apr 1, 2023 · 0 comments
Open

MetaController traversing #14

ariscript opened this issue Apr 1, 2023 · 0 comments

Comments

@ariscript
Copy link
Member

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;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant