I have a method with an template parameter:
public CustomClass getData(Class<? extends InterfaceA> item) {
}
I have ended up with one case that this can be called with an item that can be an inner anonymous class that adheres to the class expected but how can I know when I got this object inside my method?
If I do if(item.equals(ConcreteA.class)) where ConcreteA is the usual class that works it fails.
Also if I use class name I need to use something like:
item.getName().equals(“com.a.b.Utils$1”);
How can I check the instance in this case?
getClass()on item. I.e.if (item.equals.getClass()(ConcreteA.class)). Still, I don't understand your problem. Why is it important to check for class-equality? What do you want to achieve with this?