Package org.barfuin.gradle.taskinfo.util
Class ReflectUtil
java.lang.Object
org.barfuin.gradle.taskinfo.util.ReflectUtil
Utility methods to access Gradle properties on objects reflectively.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectcallMethodIfPresent(Object pObject, String pMethodName, Object... pParameters) Call the given method on the given object if it exists and return the result.static voidcallScheduledNodesVistor(Object pObject, BiConsumer<List<org.gradle.execution.plan.Node>, Set<org.gradle.execution.plan.Node>> pVisitor) static ObjectgetExecutionPlan(TaskExecutionGraph pTaskGraph) static booleanstatic booleanisInstanceOf(String pSuperFqcn, Object pObject) Tries to load the class determined bypSuperFqcn, and on success, determines if the given object is an instance of it.static Class<?>loadClassIfPossible(String pFqcn) static Objectstatic Object
-
Method Details
-
readField
-
readField
-
hasField
-
getExecutionPlan
-
callMethodIfPresent
@CheckForNull public static Object callMethodIfPresent(@Nullable Object pObject, @Nonnull String pMethodName, @Nullable Object... pParameters) Call the given method on the given object if it exists and return the result.- Parameters:
pObject- an objectpMethodName- the name of a parameterless methodpParameters- the parameters to pass to the called method, ornull/ left out for none- Returns:
- the method's return value. A result of
nullmay mean that the method did not exist, or its return value wasnull, or its return type wasvoid.
-
callScheduledNodesVistor
-
loadClassIfPossible
-
isInstanceOf
Tries to load the class determined bypSuperFqcn, and on success, determines if the given object is an instance of it.- Parameters:
pSuperFqcn- fully qualified class name of the potential superclasspObject- any object- Returns:
trueifpSuperFqcncould be loaded andpObjectis an instance of it;falseif either is not the case
-