// I would like to create a variable of Class type and assign a pattern into it like that:
Class clazz = HashMap<Long,HashMap<String, Semaphore>>.class; // does not work!
// I need it in order to be able later use it in .isInstance() expression, like:
if (clazz.isInstance(myVariable)) {
// do something
}
, because the usual "instanceof" does not work either on pattern types.
With a simple types (non-pattern types) it works:
Class clazz = Long.class; // this works fine
How can I achieve what I want that is to assign a pattern and not a simple type? If it is not allowed in Java, is there another proper way to test if the variable is an instance of a type defined as a pattern?