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=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.- Since:
- 5.6
-
Constructor Summary
Constructors Constructor Description TypeBasedParameterResolver() -
Method Summary
Modifier and Type Method Description abstract TresolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)Resolve an argument for theParameterin the suppliedParameterContextfor the suppliedExtensionContext.booleansupportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)Determine if this resolver supports resolution of an argument for theParameterin the suppliedParameterContextfor the suppliedExtensionContext.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
TypeBasedParameterResolver
public TypeBasedParameterResolver()
-
-
Method Details
-
supportsParameter
public final boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext)Description copied from interface:ParameterResolverDetermine if this resolver supports resolution of an argument for theParameterin the suppliedParameterContextfor the suppliedExtensionContext.The
MethodorConstructorin which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable().- Specified by:
supportsParameterin interfaceParameterResolver- Parameters:
parameterContext- the context for the parameter for which an argument should be resolved; nevernullextensionContext- the extension context for theExecutableabout to be invoked; nevernull- Returns:
trueif this resolver can resolve an argument for the parameter- See Also:
ParameterResolver.resolveParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext),ParameterContext
-
resolveParameter
public abstract T resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionExceptionDescription copied from interface:ParameterResolverResolve an argument for theParameterin the suppliedParameterContextfor 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 returnedtruefor the sameParameterContextandExtensionContext.The
MethodorConstructorin which the parameter is declared can be retrieved viaParameterContext.getDeclaringExecutable().- Specified by:
resolveParameterin interfaceParameterResolver- Parameters:
parameterContext- the context for the parameter for which an argument should be resolved; nevernullextensionContext- the extension context for theExecutableabout to be invoked; nevernull- Returns:
- the resolved argument for the parameter; may only be
nullif the parameter type is not a primitive - Throws:
ParameterResolutionException- See Also:
ParameterResolver.supportsParameter(org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.ExtensionContext),ParameterContext
-