Class ReflectionUtils
- java.lang.Object
-
- org.protelis.lang.interpreter.util.ReflectionUtils
-
public final class ReflectionUtils extends java.lang.Object
Utilities that make easier to cope with Java Reflection.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
invokeFieldable(ExecutionContext context, java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Object target, java.lang.Object[] args)
Invokes a method.static java.lang.Object
invokeFieldable(ExecutionContext context, java.lang.reflect.Method toInvoke, java.lang.Object target, java.lang.Object[] args)
Invokes a method.
-
-
-
Method Detail
-
invokeFieldable
public static java.lang.Object invokeFieldable(ExecutionContext context, java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Object target, java.lang.Object[] args)
Invokes a method. If there are fields involved, field operations are applied- Parameters:
context
- the currentExecutionContext
clazz
- the class to search for a methodmethodName
- the name of the methodtarget
- the target object (can be null in case of static invocation)args
- the arguments for the method- Returns:
- the result of the method invocation
-
invokeFieldable
public static java.lang.Object invokeFieldable(@Nonnull ExecutionContext context, @Nonnull java.lang.reflect.Method toInvoke, @Nullable java.lang.Object target, @Nonnull java.lang.Object[] args)
Invokes a method. If there are fields involved, field operations are applied- Parameters:
context
- the currentExecutionContext
toInvoke
- the method to be invokedtarget
- the target object (can be null in case of static invocation)args
- the arguments for the method- Returns:
- the result of the method invocation
-
-