Basically I want to check if a class is instance of the provided interface.
I have a method with this signature:
public ICard draw(Class<? extends ICardType> type)
Then I tried to do this but it is marked as an error;
if (deck.get(i) instanceof type)
NetBeans gives this as the error:
cannot find symbol
symbol: class type
location: class simple.marauroa.client.extension.cardgame.impl.DefaultDeck
I even tried this from one of the other questions:
deck.get(i).isAssignableFrom(type)
I saw questions like: Checking programmatically if a .class file extends particular class and How to check instanceof on an argument that is a Class object? but they didn’t fit my scenario.
Any hints or ideas? I know I’m doing a dumb mistake somewhere.
I think you just want
From the documentation: