Class ReflectionUtils
java.lang.Object
me.unurled.srcore.utils.ReflectionUtils
The ReflectionUtils class is a class that is used to reflect classes and methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @NotNull Class
<T> Get a class from a pathstatic <T> @Nullable Class
<T> getClassOrNull
(@NotNull String path) Get a class from a pathstatic @NotNull Field
Get a method from a classstatic <T> T
getFieldValue
(@NotNull Field field, @Nullable Object obj) Get a field from a classstatic @Nullable Method
getMethodOrNull
(@NotNull Class<?> clazz, boolean declared, @NotNull String name, @NotNull Class<?> @NotNull ... parameterTypes) Get a method from a classstatic <T> T
invokeMethod
(@NotNull Method method, @Nullable Object obj, @Nullable Object @Nullable ... args) Invoke a method
-
Method Details
-
getClass
-
getClassOrNull
-
getMethodOrNull
@Nullable public static @Nullable Method getMethodOrNull(@NotNull @NotNull Class<?> clazz, boolean declared, @NotNull @NotNull String name, @NotNull @NotNull Class<?> @NotNull ... parameterTypes) Get a method from a class- Parameters:
clazz
- The classdeclared
- If the method is declaredname
- The name of the methodparameterTypes
- The parameter types of the method- Returns:
- The method
-
getField
-
getFieldValue
-
invokeMethod
-