I have written a java annotation that looks like this:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) // can I further limit this to only fields of type DomainObject?
public @interface Owns {
}
After briefly looking around I couldn't see if there was a way to further limit the usage of this annotation so that only fields of a specific type could be annotated. This annotation is custom to our domain and can only be used on instances of our base domain object class.
Does anyone know how to enforce this at compile time?
Thanks for any help!