annotation

Java Annotations

 

For the Jackrabbit OCM framework, we want to define the object mapping with the java annotations. This is certainly a great feature but the java annotations have some limitations. For example, it is not possible to define a default null value.

Here is an example which doesn't work :

 

@Retention(RetentionPolicy.RUNTIME)

public @interface Field

{

String fieldName();

String fieldType() default "";

Class Converter default null; // Generates compile error

}

 

I would like to define a null value for my converter class reference. I'm wondering what is the best solution for this kind of problem ? Any kind of suggestion is welcome !

Following this blog entry, it seems that it is not possible, why ?

Syndicate content