Interface MemberInvoker
- All Known Implementing Classes:
DefaultMemberInvoker
public interface MemberInvoker
Abstraction for invoking a
Member
(e.g. Method
,
Constructor
, or Field
) reflectively.
This interface provides a uniform API to invoke members on a target object with zero or more parameters.
See DefaultMemberInvoker
for the main implementation which uses high-performance invocation strategies using
method handles and lambdas as opposed to traditional Java reflection resulting in near-native invocation performance.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Object
Invokes the member with no parameters.invoke
(Object target, int parameterCount, IntFunction<?> parameterProvider) Invokes the member with the provided number of parameters using a parameter provider.default Object
Invokes the member with a single parameter.default Object
Invokes the member with a variable number of parameters.
-
Method Details
-
invoke
Invokes the member with no parameters.- Parameters:
target
- the target object or null for static members- Returns:
- the result of the invocation (or null for void-returning methods)
-
invoke
Invokes the member with a single parameter.- Parameters:
target
- the target objectparam
- the single parameter- Returns:
- the invocation result
-
invoke
Invokes the member with a variable number of parameters.- Parameters:
target
- the target object or null for static membersparams
- the parameters to pass- Returns:
- the result of the invocation
-
invoke
Invokes the member with the provided number of parameters using a parameter provider.- Parameters:
target
- the target objectparameterCount
- the number of parameters to useparameterProvider
- a function to supply parameters by index- Returns:
- the invocation result
-
getMember
Member getMember()- Returns:
- the underlying reflective member
-