Class Reflection.AssignabilityChecker
- java.lang.Object
-
- hudson.plugins.project_inheritance.util.Reflection.AssignabilityChecker
-
- Enclosing class:
- Reflection
protected static class Reflection.AssignabilityChecker extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected ConcurrentHashMap<Class<?>,ConcurrentHashMap<Class<?>,Boolean>>
classAssignabilityMap
This map stores for a class name, which other class names have been found to be assignable to it.
-
Constructor Summary
Constructors Constructor Description AssignabilityChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isAssignableFrom(Class<?> clazz, Class<?> other)
Checks if the 'clazz' class is assignable from the 'other' class.
-
-
-
Field Detail
-
classAssignabilityMap
protected final ConcurrentHashMap<Class<?>,ConcurrentHashMap<Class<?>,Boolean>> classAssignabilityMap
This map stores for a class name, which other class names have been found to be assignable to it.In more detail:
- For a given class name (outer), you get back a map.
- Each entry is a tuple of another class name (inner) and a boolean that states whether or not you can assign the inner class to the outer class.
-
-
Method Detail
-
isAssignableFrom
public boolean isAssignableFrom(Class<?> clazz, Class<?> other)
Checks if the 'clazz' class is assignable from the 'other' class.Identical to clazz.isAssignableFrom(other), but might use caching to speed up resolution. This is useful if Java 5 (or earlier) is used, as these use a much slower implementation than Java 6+.
TODO: Disable caching as soon as Java 5 has been deprecated for Jenkins
- Parameters:
clazz
- the class to which 'other' must be assignable (left-hand value)other
- the class which must be assignable to 'clazz' (right-hand value)- Returns:
- true, if 'other' is a subtype of 'clazz.
-
-