Module org.junit.jupiter.api
Class TypeBasedParameterResolver<T>
java.lang.Object
org.junit.jupiter.api.extension.support.TypeBasedParameterResolver<T>
- Type Parameters:
T
- the type of the parameter supported by thisParameterResolver
- All Implemented Interfaces:
Extension
,ParameterResolver
@API(status=STABLE,
since="5.10")
public abstract class TypeBasedParameterResolver<T>
extends Object
implements ParameterResolver
ParameterResolver
adapter which resolves a parameter based on its exact type.- Since:
- 5.6
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract T
resolveParameter
(ParameterContext parameterContext, ExtensionContext extensionContext) Resolve an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.final boolean
supportsParameter
(ParameterContext parameterContext, ExtensionContext extensionContext) Determine if this resolver supports resolution of an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.
-
Constructor Details
-
TypeBasedParameterResolver
public TypeBasedParameterResolver()
-
-
Method Details
-
supportsParameter
public final boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) Description copied from interface:ParameterResolver
Determine if this resolver supports resolution of an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.The
Method
orConstructor
in which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable()
.- Specified by:
supportsParameter
in interfaceParameterResolver
- Parameters:
parameterContext
- the context for the parameter for which an argument should be resolved; nevernull
extensionContext
- the extension context for theExecutable
about to be invoked; nevernull
- Returns:
true
if this resolver can resolve an argument for the parameter- See Also:
-
resolveParameter
public abstract T resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException Description copied from interface:ParameterResolver
Resolve an argument for theParameter
in the suppliedParameterContext
for the suppliedExtensionContext
.This method is only called by the framework if
ParameterResolver.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext)
previously returnedtrue
for the sameParameterContext
andExtensionContext
.The
Method
orConstructor
in which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable()
.- Specified by:
resolveParameter
in interfaceParameterResolver
- Parameters:
parameterContext
- the context for the parameter for which an argument should be resolved; nevernull
extensionContext
- the extension context for theExecutable
about to be invoked; nevernull
- Returns:
- the resolved argument for the parameter; may only be
null
if the parameter type is not a primitive - Throws:
ParameterResolutionException
- See Also:
-