Top Description Fields Constructors Methods
org.junit.jupiter.params.converter

public abstract Class AnnotationBasedArgumentConverter<A extends Annotation>

extends Object
implements ArgumentConverter, AnnotationConsumer<A extends Annotation>
Class Inheritance
All Implemented Interfaces
org.junit.jupiter.params.support.AnnotationConsumer, java.util.function.Consumer, org.junit.jupiter.params.converter.ArgumentConverter
Known Direct Subclasses
org.junit.jupiter.params.converter.JavaTimeArgumentConverter
Annotations
@API
status:MAINTAINED
since:5.13.3
Static Imports
java.util.Objects.requireNonNull, org.apiguardian.api.API.Status.MAINTAINED

AnnotationBasedArgumentConverter is an abstract base class for ArgumentConverter implementations that also need to consume an annotation in order to perform the conversion.
Since
5.10
See Also
ArgumentConverter, AnnotationConsumer, SimpleArgumentConverter

Field Summary

Modifier and TypeField and Description
private @Nullable A

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
accept(A annotation)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.

public final @Nullable Object
public final @Nullable Object
protected abstract @Nullable Object

Returns:

the converted object; may be null but only if the target type is a reference type
convert
(@Nullable Object
the source object to convert; may be null
source
,
Class<?>
the target type the source object should be converted into; never null
targetType
,
A
the annotation to process; never null
annotation
)

Convert the supplied source object into the supplied targetType, based on metadata in the provided annotation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

annotationback to summary
private @Nullable A annotation

Constructor Detail

AnnotationBasedArgumentConverterback to summary
public AnnotationBasedArgumentConverter()

Method Detail

acceptback to summary
public final void accept(A annotation)

Implements java.util.function.Consumer.accept.

Doc from java.util.function.Consumer.accept.

Performs this operation on the given argument.

Annotations
@Override
convertback to summary
public final @Nullable Object convert(@Nullable Object source, ParameterContext context) throws ArgumentConversionException
Annotations
@Override
convertback to summary
public final @Nullable Object convert(@Nullable Object source, FieldContext context) throws ArgumentConversionException
Annotations
@Override
convertback to summary
protected abstract @Nullable Object convert(@Nullable Object source, Class<?> targetType, A annotation) throws ArgumentConversionException

Convert the supplied source object into the supplied targetType, based on metadata in the provided annotation.

Parameters
source:@Nullable Object

the source object to convert; may be null

targetType:Class<?>

the target type the source object should be converted into; never null

annotation:A

the annotation to process; never null

Returns:@Nullable Object

the converted object; may be null but only if the target type is a reference type

Exceptions
ArgumentConversionException:
in case an error occurs during the conversion