public abstract class DeclarativeContract extends Contract.BaseContract
Contract base implementation that works by declaring witch annotations should be
processed and how each annotation modifies MethodMetadata| Modifier and Type | Class and Description |
|---|---|
static interface |
DeclarativeContract.AnnotationProcessor<E extends Annotation> |
static interface |
DeclarativeContract.ParameterAnnotationProcessor<E extends Annotation> |
Contract.BaseContract, Contract.Default| Constructor and Description |
|---|
DeclarativeContract() |
| Modifier and Type | Method and Description |
|---|---|
List<MethodMetadata> |
parseAndValidateMetadata(Class<?> targetType)
Called to parse the methods in the class that are linked to HTTP requests.
|
protected void |
processAnnotationOnClass(MethodMetadata data,
Class<?> targetType)
Called by parseAndValidateMetadata twice, first on the declaring class, then on the target type
(unless they are the same).
|
protected void |
processAnnotationOnMethod(MethodMetadata data,
Annotation annotation,
Method method) |
protected boolean |
processAnnotationsOnParameter(MethodMetadata data,
Annotation[] annotations,
int paramIndex) |
protected <E extends Annotation> |
registerClassAnnotation(Class<E> annotationType,
DeclarativeContract.AnnotationProcessor<E> processor)
Called while class annotations are being processed
|
protected <E extends Annotation> |
registerClassAnnotation(Predicate<E> predicate,
DeclarativeContract.AnnotationProcessor<E> processor)
Called while class annotations are being processed
|
protected <E extends Annotation> |
registerMethodAnnotation(Class<E> annotationType,
DeclarativeContract.AnnotationProcessor<E> processor)
Called while method annotations are being processed
|
protected <E extends Annotation> |
registerMethodAnnotation(Predicate<E> predicate,
DeclarativeContract.AnnotationProcessor<E> processor)
Called while method annotations are being processed
|
protected <E extends Annotation> |
registerParameterAnnotation(Class<E> annotation,
DeclarativeContract.ParameterAnnotationProcessor<E> processor)
Called while method parameter annotations are being processed
|
nameParam, parseAndValidateMetadata, parseAndValidateMetadatapublic final List<MethodMetadata> parseAndValidateMetadata(Class<?> targetType)
ContractparseAndValidateMetadata in interface ContractparseAndValidateMetadata in class Contract.BaseContracttargetType - type of the Feign interface.Contract.BaseContract.parseAndValidateMetadata(Class)protected final void processAnnotationOnClass(MethodMetadata data, Class<?> targetType)
processAnnotationOnClass in class Contract.BaseContractdata - metadata collected so far relating to the current java method.clz - the class to processprotected final void processAnnotationOnMethod(MethodMetadata data, Annotation annotation, Method method)
processAnnotationOnMethod in class Contract.BaseContractdata - metadata collected so far relating to the current java method.annotation - annotations present on the current method annotation.method - method currently being processed.protected final boolean processAnnotationsOnParameter(MethodMetadata data, Annotation[] annotations, int paramIndex)
processAnnotationsOnParameter in class Contract.BaseContractdata - metadata collected so far relating to the current java method.annotations - annotations present on the current parameter annotation.paramIndex - if you find a name in annotations, call
Contract.BaseContract.nameParam(MethodMetadata, String, int) with this as the last parameter.Contract.BaseContract.nameParam(MethodMetadata, String, int) after finding an
http-relevant annotation.protected <E extends Annotation> void registerClassAnnotation(Class<E> annotationType, DeclarativeContract.AnnotationProcessor<E> processor)
annotationType - to be processedprocessor - function that defines the annotations modifies MethodMetadataprotected <E extends Annotation> void registerClassAnnotation(Predicate<E> predicate, DeclarativeContract.AnnotationProcessor<E> processor)
predicate - to check if the annotation should be processed or notprocessor - function that defines the annotations modifies MethodMetadataprotected <E extends Annotation> void registerMethodAnnotation(Class<E> annotationType, DeclarativeContract.AnnotationProcessor<E> processor)
annotationType - to be processedprocessor - function that defines the annotations modifies MethodMetadataprotected <E extends Annotation> void registerMethodAnnotation(Predicate<E> predicate, DeclarativeContract.AnnotationProcessor<E> processor)
predicate - to check if the annotation should be processed or notprocessor - function that defines the annotations modifies MethodMetadataprotected <E extends Annotation> void registerParameterAnnotation(Class<E> annotation, DeclarativeContract.ParameterAnnotationProcessor<E> processor)
annotation - to be processedprocessor - function that defines the annotations modifies MethodMetadataCopyright © 2012–2021 OpenFeign. All rights reserved.