Endpoint Annotations

As of Camel 2.12 you can annotate Endpoint and Consumer classes so that their configuration documentation can be automatically generated by the camel-package-maven-plugin (rather like maven plugin goals get their parameters documented automatically).

The documentation is then included into the jar as org/apache/camel/component/scheme/scheme.html where scheme is the component name.

Supported annotations

Annotation

Description

@UriEndpoint

Specifies that an endpoint is annotated with @UriParam and/or @UriParams annotations. Also specifies the default scheme to use in the generated documentation and the associated Consumer class for this endpoint

@UriParam

Used to annotate a parameter value; usually specified via ?foo=bar syntax in the URI strings in Camel. Used currently only on field declarations but in the future could be used on setter methods too. If no name is specified then the name of the field/setter property is used.

@UriParams

Specifies that a field is a nested object of one or more configuration parameters; then the class of this field should be annotated with one or more @UriParam or @UriParams annotations

For example here is the TimerEndpoint, notice the use of these annotations and in its base classes.

Not only are the annotations useful for automatically generating the documentation; we can use them to refine the validation of the code during configuration and they can be useful for tool providers so they can more easily introspect the configuration options. See the ComponentConfiguration documentation on the tooling aspect.

Using the UriEndpointComponent base class

If you use the @UriEndpoint annotation on your Endpoint along with one or more @UriParam / @UriParams annotations on your class (or any base classes of your endpoint) its recommended that your Component class inherit from the UriEndpointComponent base class as that means your Component will automatically generate better metadata for the ComponentConfiguration API.

This will allow your component to work better inside tools which make use of the ComponentConfiguration API to generate nice forms and so forth.

© 2004-2014 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram