T - the type of the parameter supported by this ParameterResolver@API(status=EXPERIMENTAL,
since="5.6")
public abstract class TypeBasedParameterResolver<T>
extends java.lang.Object
implements ParameterResolver
ParameterResolver adapter which resolves a parameter based on its exact type.| Modifier and Type | Field and Description |
|---|---|
private java.lang.reflect.Type |
supportedParameterType |
| Constructor and Description |
|---|
TypeBasedParameterResolver() |
| Modifier and Type | Method and Description |
|---|---|
private java.lang.reflect.Type |
enclosedTypeOfParameterResolver() |
private java.lang.reflect.ParameterizedType |
findTypeBasedParameterResolverSuperclass(java.lang.Class<?> clazz) |
private java.lang.reflect.Type |
getParameterType(ParameterContext parameterContext) |
abstract T |
resolveParameter(ParameterContext parameterContext,
ExtensionContext extensionContext)
Resolve an argument for the
Parameter in the supplied ParameterContext
for the supplied ExtensionContext. |
boolean |
supportsParameter(ParameterContext parameterContext,
ExtensionContext extensionContext)
Determine if this resolver supports resolution of an argument for the
Parameter in the supplied ParameterContext for the supplied
ExtensionContext. |
public final boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
ParameterResolverParameter in the supplied ParameterContext for the supplied
ExtensionContext.
The Method or Constructor
in which the parameter is declared can be retrieved via
ParameterContext.getDeclaringExecutable().
supportsParameter in interface ParameterResolverparameterContext - the context for the parameter for which an argument should
be resolved; never nullextensionContext - the extension context for the Executable
about to be invoked; never nulltrue if this resolver can resolve an argument for the parameterParameterResolver.resolveParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext),
ParameterContextpublic abstract T resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException
ParameterResolverParameter in the supplied ParameterContext
for the supplied ExtensionContext.
This method is only called by the framework if ParameterResolver.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext)
previously returned true for the same ParameterContext
and ExtensionContext.
The Method or Constructor
in which the parameter is declared can be retrieved via
ParameterContext.getDeclaringExecutable().
resolveParameter in interface ParameterResolverparameterContext - the context for the parameter for which an argument should
be resolved; never nullextensionContext - the extension context for the Executable
about to be invoked; never nullnull if the
parameter type is not a primitiveParameterResolutionExceptionParameterResolver.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext),
ParameterContextprivate java.lang.reflect.Type getParameterType(ParameterContext parameterContext)
private java.lang.reflect.Type enclosedTypeOfParameterResolver()
private java.lang.reflect.ParameterizedType findTypeBasedParameterResolverSuperclass(java.lang.Class<?> clazz)