forked from OpenFeign/feignx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenFeignGH-57] Introduce Annotation Processors
This change introduces the concept of an `AnnotationProcessor`. These components are used when processing an `AnnotationDrivenContract` Contracts can now be modularized whereas they are now collections of annotation processors instead of full fledged parsing components. By doing so, `AnnotationProcessors` can be shared between our current reflection based contract parsers and the upcoming compile time annotation processors.
- Loading branch information
Showing
18 changed files
with
554 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
core/src/main/java/feign/contract/AnnotationProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2019-2021 OpenFeign Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package feign.contract; | ||
|
||
import java.lang.annotation.Annotation; | ||
|
||
/** | ||
* Annotation Processor interface. Used by Annotation Driven Contracts to process annotated methods | ||
* and classes. These processors are designed to be used in both reflective and compile-time modes. | ||
* | ||
* @param <T> Supported annotation type. | ||
*/ | ||
public interface AnnotationProcessor<T extends Annotation> { | ||
|
||
/** | ||
* Evaluate and process the provided annotation, updating the provided builder. Implementations | ||
* are expected to update builder via side-effects. | ||
* | ||
* @param annotation to evaluate. | ||
* @param builder with the current method context. | ||
*/ | ||
void process(T annotation, TargetMethodDefinition.Builder builder); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.