essobedo opened a new pull request #7190:
URL: https://github.com/apache/camel/pull/7190


   Fix for https://issues.apache.org/jira/browse/CAMEL-16628
   
   ## Motivation
   
   Like we have for endpoint options with @UriParam, we should have a new SPI 
annotation to markup headers that consumer/producers support.
   
   ## Modifications
   
   This PR adds a new element called `headers` to the annotation `@Metadata` to 
provide the list of all the constants corresponding to the name of the headers 
supported by the consumers/producers. This element can only be set in the 
`@Metadata` annotation added to the endpoint class. 
   
   In the example below, the endpoint `FooEndpoint` indicates that it supports 
only one header whose name is `Constants.FILE_NAME`.
   
   ```
   @Metadata(headers = Constants.FILE_NAME)
   public class FooEndpoint extends Endpoint {
       // Rest of the class
   }
   ```
   
   The metadata of a given header are retrieved from the annotation `@Metadata` 
added to the constant.
   
   In the example below, the header `Constants.FILE_NAME` specify a 
description, a default value and a java type.
   ```
   public final class Constants {
   
       @Metadata(description = "Some description of CamelFileName", 
defaultValue = "Some default value", javaType = "java.lang.String")
       public static final String FILE_NAME = "CamelFileName";
       // Rest of the class
   }
   ```
   
   This PR adds a new asciidoctor template called 
`component-endpoint-headers.adoc` that can be called from a doc file with:
   ```
   // component headers: START
   include::partial$component-endpoint-headers.adoc[]
   // component headers: END
   ```
   
   ## Result
   
   
![image](https://user-images.githubusercontent.com/1618116/157900947-35c43982-7500-4018-8db6-54612ae923e8.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to