@API(status=EXPERIMENTAL,
since="5.10")
public abstract class AnnotationBasedArgumentConverter<A extends java.lang.annotation.Annotation>
extends java.lang.Object
implements ArgumentConverter, AnnotationConsumer<A>
AnnotationBasedArgumentConverter is an abstract base class for
ArgumentConverter implementations that also need to consume an
annotation in order to perform the conversion.ArgumentConverter,
AnnotationConsumer,
SimpleArgumentConverter| Modifier and Type | Field and Description |
|---|---|
private A |
annotation |
| Constructor and Description |
|---|
AnnotationBasedArgumentConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(A annotation) |
protected abstract java.lang.Object |
convert(java.lang.Object source,
java.lang.Class<?> targetType,
A annotation)
Convert the supplied
source object into the supplied targetType,
based on metadata in the provided annotation. |
java.lang.Object |
convert(java.lang.Object source,
ParameterContext context)
Convert the supplied
source object according to the supplied
context. |
private A extends java.lang.annotation.Annotation annotation
public final void accept(A annotation)
accept in interface java.util.function.Consumer<A extends java.lang.annotation.Annotation>public final java.lang.Object convert(java.lang.Object source,
ParameterContext context)
throws ArgumentConversionException
ArgumentConvertersource object according to the supplied
context.convert in interface ArgumentConvertersource - the source object to convert; may be nullcontext - the parameter context where the converted object will be
used; never nullnull but only if the target
type is a reference typeArgumentConversionException - if an error occurs during the
conversionprotected abstract java.lang.Object convert(java.lang.Object source,
java.lang.Class<?> targetType,
A annotation)
throws ArgumentConversionException
source object into the supplied targetType,
based on metadata in the provided annotation.source - the source object to convert; may be nulltargetType - the target type the source object should be converted
into; never nullannotation - the annotation to process; never nullnull but only if the target
type is a reference typeArgumentConversionException - in case an error occurs during the
conversion