Package org.apache.commons.lang3.reflect
Class InheritanceUtils
- java.lang.Object
-
- org.apache.commons.lang3.reflect.InheritanceUtils
-
public class InheritanceUtils extends java.lang.Object
Utility methods focusing on inheritance.
- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description InheritanceUtils()
InheritanceUtils
instances should NOT be constructed in standard programming.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
distance(java.lang.Class<?> child, java.lang.Class<?> parent)
Returns the number of inheritance hops between two classes.
-
-
-
Constructor Detail
-
InheritanceUtils
public InheritanceUtils()
InheritanceUtils
instances should NOT be constructed in standard programming. Instead, the class should be used asMethodUtils.getAccessibleMethod(method)
.This constructor is
public
to permit tools that require a JavaBean instance to operate.
-
-
Method Detail
-
distance
public static int distance(java.lang.Class<?> child, java.lang.Class<?> parent)
Returns the number of inheritance hops between two classes.
- Parameters:
child
- the child class, may benull
parent
- the parent class, may benull
- 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
-
-