{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
public class ReflectiveMethod<T>
Helper class for making more performant reflection method invocations.
Lazy initializes and caches Method object to attempt to reduce reflection overhead.
Public constructors |
|
|---|---|
ReflectiveMethod(Creates a ReflectiveMethod. |
|
Public methods |
|
|---|---|
@NonNull T |
Invoke the instance method. |
@NonNull T |
invokeStatic(@NonNull Array<@NonNull Object> paramValues)Invoke th static method. |
public ReflectiveMethod(
@NonNull String className,
@NonNull String methodName,
@NonNull Array<@NonNull Class<@NonNull Object>> paramTypes
)
Creates a ReflectiveMethod.
@NonNull
public T invoke(@NonNull Object object, @NonNull Array<@NonNull Object> paramValues)
Invoke the instance method.
See invoke
| Parameters | |
|---|---|
@NonNull Object object |
the object the underlying method is invoked from |
@NonNull Array<@NonNull Object> paramValues |
the arguments used for the method call |
| Returns | |
|---|---|
T |
the return value of the method |
| Throws | |
|---|---|
androidx.test.platform.reflect.ReflectionException |
if call could not be completed |