Here is an improved version of my AnnotationWrapper class. This one will raise an exception if you try to instantiate a wrapper directly through its constructor, instead of through AnnotationWrapper.wrap().
The reason for this are explained in the Synopsis test. On Fri, Nov 15, 2019 at 6:25 PM Alain Désilets <alaindesile...@gmail.com> wrote: > FYI, attached is a ZIP file that contains my AnnotationWrapper solution to > this problem. It's a bit of a hack, but it has worked for me. > > The ZIP file contains the following classes: > > - MyAnnotation.java: subclass of Annotation > - MyAnnotationWrapper.java: The wrapper for MyAnnotation. > - MyOtherAnnotation.java: Subclass of MyAnnotation for which there is no > wrapper. > > The file TryWrappers is an app that shows how you can wrap annotations > into an appropriate wrapper. > > Alain > > On Fri, Nov 15, 2019 at 12:07 PM Richard Eckart de Castilho < > r...@apache.org> wrote: > >> On 15. Nov 2019, at 17:59, Marshall Schor <m...@schor.com> wrote: >> > >> > I'm wondering how to arrange things so that for JCas class "x.y.z.Foo", >> > >> > you could have an associated class or interface that could make use of >> the >> >> JCasGen could generate an interface "IMyAnnotation" which defines the >> accessors methods. >> >> The user could implement an interface "IMyAnnotationExtensions" which >> inherits from "IMyAnnotation" and defines additional (default) methods. >> >> The actual JCas class would have to implement both interfaces. >> >> -- Richard >> >> >>
<<attachment: wrappers.zip>>