Package org.skriptlang.skript.util
Class ClassUtils
java.lang.Object
org.skriptlang.skript.util.ClassUtils
Utilities for interacting with classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic inthierarchyDistance(Class<?> a, Class<?> b) Calculates the distance between two classes in the inheritance hierarchy.static inthierarchyDistanceBetween(Class<?> a, Class<?> b) Calculates the distance between two classes in the inheritance hierarchy, in either direction.static booleanisNormalClass(Class<?> clazz) static booleanisRelatedTo(Class<?> a, Class<?> b) Checks if two classes are related in the inheritance hierarchy.
-
Constructor Details
-
ClassUtils
public ClassUtils()
-
-
Method Details
-
isNormalClass
- Parameters:
clazz- The class to check.- Returns:
- True if
clazzdoes not represent an annotation, array, primitive, interface, or abstract class.
-
hierarchyDistance
Calculates the distance between two classes in the inheritance hierarchy.- Parameters:
a- The superclass.b- The subclass.- Returns:
- The distance between class
aand classb. Ifais not a superclass ofb, returns -1. Ifaequalsb, returns 0.
-
hierarchyDistanceBetween
Calculates the distance between two classes in the inheritance hierarchy, in either direction.- Parameters:
a- The first class.b- The second class.- Returns:
- The distance between class
aand classb. If neither class is a superclass of the other, returns -1. If the classes are equal, returns 0.
-
isRelatedTo
Checks if two classes are related in the inheritance hierarchy.- Parameters:
a- The first class.b- The second class.- Returns:
- True if either class is a superclass of the other.
-