InheritanceUtils
- public class org.apache.commons.lang3.reflect.InheritanceUtils[source]
Utility methods focusing on inheritance.
- Since:
3.2
Constructors
Deprecated. |
- @Deprecated public InheritanceUtils()[source]
Deprecated: TODO Make private in 4.0.
InheritanceUtilsinstances should NOT be constructed in standard programming. Instead, the class should be used asMethodUtils.getAccessibleMethod(method).This constructor is
publicto permit tools that require a JavaBean instance to operate.
Methods
Returns the number of inheritance hops between two classes. |
- public static int distance(Class<?> child, Class<?> parent)[source]
Returns the number of inheritance hops between two classes.
- Parameters:
child – The child class, may be
nullparent – The parent class, may be
null
- Returns:
The number of generations between the child and parent; 0 if the same class; -1 if the classes are not related as child and parent (includes where either class is null)
- Since:
3.2