Package org.junit.jupiter.api.extension
Interface ParameterContext
-
@API(status=STABLE, since="5.0") public interface ParameterContextParameterContextencapsulates the context in which anExecutablewill be invoked for a givenParameter.A
ParameterContextis used to support parameter resolution via aParameterResolver.- Since:
- 5.0
- See Also:
ParameterResolver,Parameter,Executable,Method,Constructor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.reflect.ExecutablegetDeclaringExecutable()Get theExecutable(i.e., theMethodorConstructor) that declares theParameterfor this context.intgetIndex()Get the index of theParameterfor this context within the parameter list of theExecutablethat declares the parameter.java.lang.reflect.ParametergetParameter()Get theParameterfor this context.java.util.Optional<java.lang.Object>getTarget()Get the target on which theExecutablethat declares theParameterfor this context will be invoked, if available.
-
-
-
Method Detail
-
getParameter
java.lang.reflect.Parameter getParameter()
Get theParameterfor this context.- Returns:
- the parameter; never
null - See Also:
getIndex()
-
getIndex
int getIndex()
Get the index of theParameterfor this context within the parameter list of theExecutablethat declares the parameter.- Returns:
- the index of the parameter
- See Also:
getParameter(),Executable.getParameters()
-
getDeclaringExecutable
default java.lang.reflect.Executable getDeclaringExecutable()
Get theExecutable(i.e., theMethodorConstructor) that declares theParameterfor this context.- Returns:
- the declaring
Executable; nevernull - See Also:
Parameter.getDeclaringExecutable()
-
getTarget
java.util.Optional<java.lang.Object> getTarget()
Get the target on which theExecutablethat declares theParameterfor this context will be invoked, if available.- Returns:
- an
Optionalcontaining the target on which theExecutablewill be invoked; nevernullbut will be empty if theExecutableis a constructor or astaticmethod.
-
-