Package de.qytera.qtaf.core.reflection
Class ClassHelper
java.lang.Object
de.qytera.qtaf.core.reflection.ClassHelper
Utility class containing reflection methods dealing with Java classes.
-
Method Summary
Modifier and TypeMethodDescriptionfindSuitableMethods(Class<?> clazz, Object[] params, String methodName) Find all methods in a class that match a given list of parameters.getInterfaces(Object object) Return all interfaces of a given object.getSuperclasses(Object object) Return all superclasses of a given object.getSuperclasses(Object object, Class<?> stopAt) Return all superclasses of the given object until stopAt is reached.getSuperclassesAndInterfaces(Object object) Get all superclasses and all interfaces that an object implements.static booleanparametersSuitableForMethod(Method m, Object[] params) Check if a provided list of parameters can be used for a given method.
-
Method Details
-
getSuperclasses
Return all superclasses of the given object until stopAt is reached.- Parameters:
object- The object that should be inspectedstopAt- The final superclass at which the algorithm should stop- Returns:
- a set of superclasses of the given object
-
getSuperclasses
Return all superclasses of a given object.- Parameters:
object- The object that should be inspected- Returns:
- All superclasses of the object
-
getInterfaces
Return all interfaces of a given object.- Parameters:
object- the object to inspect- Returns:
- all interfaces of the object
-
getSuperclassesAndInterfaces
Get all superclasses and all interfaces that an object implements.- Parameters:
object- The inspected object- Returns:
- Set of all superclasses and implemented interfaces
-
parametersSuitableForMethod
Check if a provided list of parameters can be used for a given method.- Parameters:
m- The method that should be inspectedparams- The parameters that should be inspected- Returns:
- True if the provided parameters can be used for the provided method
-
findSuitableMethods
Find all methods in a class that match a given list of parameters. The parameters have to be provided in the order as they are passes to the method.- Parameters:
clazz- The class that should be inspectedparams- The parameters that should be provided to a methodmethodName- Optionally you can provide a method name here that the desired method should have, otherwise set this attribute to null- Returns:
- All method that can handle the provided list of parameters
-