Top Description Constructors Methods
org.apache.commons.lang3.reflect

public Class InheritanceUtils

extends Object
Class Inheritance
Imports
org.apache.commons.lang3.BooleanUtils

Utility methods focusing on inheritance.
Since
3.2

Constructor Summary

AccessConstructor and Description
public
InheritanceUtils()
Deprecated TODO Make private in 4.0.

InheritanceUtils instances should NOT be constructed in standard programming.

Method Summary

Modifier and TypeMethod and Description
public static int

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)
distance
(final Class<?>
the child class, may be null
child
,
final Class<?>
the parent class, may be null
parent
)

Returns the number of inheritance hops between two classes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

InheritanceUtilsback to summary
public InheritanceUtils()

Deprecated

TODO Make private in 4.0.

InheritanceUtils instances should NOT be constructed in standard programming. Instead, the class should be used as MethodUtils.getAccessibleMethod(method).

This constructor is public to permit tools that require a JavaBean instance to operate.

Annotations
@Deprecated

Method Detail

distanceback to summary
public static int distance(final Class<?> child, final Class<?> parent)

Returns the number of inheritance hops between two classes.

Parameters
child:Class<?>

the child class, may be null

parent:Class<?>

the parent class, may be null

Returns:int

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