camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan (JIRA)" <>
Subject [jira] Commented: (CAMEL-990) TypeConverter support with @Converter meta-annotation and not only @Converter
Date Tue, 21 Oct 2008 15:18:52 GMT


James Strachan commented on CAMEL-990:

BTW - its not really a big deal to use annotations from any particular framework in your code
as annotations are a soft dependency.

e.g. adding Camel annotations to your code doesn't add any direct dependency on camel. You
can then use your code totally fine without any camel jars on the classpath.

So there's not a huge need to 'hide' dependencies on Camel annotations - as you only need
them to compile your source code.

But using indirect annotations can be useful; e.g. you can have a foo.jar which defines a
@Foo annotation which builds itself with camel - then folks can just add foo.jar to their
classpath to get camel goodness without adding camel jars to the build. So you could introduce
a kinda macro annotation that includes various framework annotations on it (say spring and
camel and guice annotations :)

> TypeConverter support with @Converter meta-annotation and not only @Converter
> -----------------------------------------------------------------------------
>                 Key: CAMEL-990
>                 URL:
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Seb Auvray
>             Fix For: 1.5.0, 2.0.0, Future
>         Attachments: typeconverter-meta-annotation-support.patch
>   Original Estimate: 4 hours
>  Remaining Estimate: 4 hours
> Today TypeConverter detection is based on org.apache.camel.@Converter annotation.
> Allow user to override this by using meta-annotation. This can be useful to hide camel
dependencies, when extending the framework.
> ie, this can be done:
> package some.package.of.mine;
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ElementType.TYPE, ElementType.METHOD })
> @org.apache.camel.Converter
> public @interface OwnConverterAnnotation {
> }
> import some.package.of.mine.OwnConverterAnnotation;
> @OwnConverterAnnotation
> public class FileToXXXConverter {
>     @OwnConverterAnnotation 
>     public static XXX toWorkflowEntry(File file) throws IOException {
>         return new XXX();            
>     }
> }

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message