Class InheritanceDistanceCalculator
java.lang.Object
ch.tocco.nice2.toolbox.api.reflect.InheritanceDistanceCalculator
This simple helper calculates the depth of the inheritance tree.
Instantiation of this class will throw an IllegalArgumentException
if the given super class is not assignable from the given
sub class.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Calculates the distance between the two given classes.
-
Constructor Details
-
InheritanceDistanceCalculator
-
-
Method Details
-
calculateDistance
public int calculateDistance()Calculates the distance between the two given classes. For instance if the given subclass extends the given super class directly, the distance will be 1. If there is one class between the two given classes, the distance will be 2.- Returns:
- the distance between the two classes.
-