Module org.junit.jupiter.api
Package org.junit.jupiter.api.extension
Interface ReflectiveInvocationContext<T extends Executable>
@API(status=EXPERIMENTAL,
since="5.5")
public interface ReflectiveInvocationContext<T extends Executable>
ReflectiveInvocationContext
encapsulates the context of
a reflective invocation of an executable (method or constructor).
This interface is not intended to be implemented by clients.
- Since:
- 5.5
-
Method Summary
Modifier and TypeMethodDescriptionGet the arguments of the executable in this invocation context.Get the method or constructor of this invocation context.Get the target object of this invocation context, if available.Class<?>
Get the target class of this invocation context.
-
Method Details
-
getTargetClass
Class<?> getTargetClass()Get the target class of this invocation context.If this invocation context represents an instance method, this method returns the class of the object the method will be invoked on, not the class it is declared in. Otherwise, if this invocation represents a static method or constructor, this method returns the class the method or constructor is declared in.
- Returns:
- the target class of this invocation context; never
null
-
getExecutable
T getExecutable()Get the method or constructor of this invocation context.- Returns:
- the executable of this invocation context; never
null
-
getArguments
Get the arguments of the executable in this invocation context.- Returns:
- the arguments of the executable in this invocation context;
immutable and never
null
-
getTarget
Get the target object of this invocation context, if available.If this invocation context represents an instance method, this method returns the object the method will be invoked on. Otherwise, if this invocation context represents a static method or constructor, this method returns
empty()
.- Returns:
- the target of the executable of this invocation context; never
null
but potentially empty
-