Wednesday, March 30, 2005

@Inherited won't work with Interface (JDK 1.5)

In my early code of SQLWarp, I created the annotation ConnectionInfo to be annotated on an interface, and I need it for an interface, not a class.

public @interface ConnectionInfo {
public String driver();
public String url();
public String userID() default "";
public String password() default "";

The JDK doc says that @Inherited won't work with an Interface, so this is my work around to get annotation from the class that implements the interface which is annotated by @ConnectionInfo.

ConnectionInfo c = (ConnectionInfo)obj

No comments: