[forge-dev] Creating Qualifier with Forge

Daniel Sachse sachsedaniel at googlemail.com
Thu Dec 15 16:04:21 EST 2011


Hey guys,

atm I am working on FORGE-372 and I need to create a Qualifier into the target project.
I made a method on my own which looks the following:

   private JavaAnnotation createQualifier(String packageName, String interfaceName) {
       JavaAnnotation javaAnnotation = JavaParser.create(JavaAnnotation.class).setName(interfaceName).setPackage(packageName);

       javaAnnotation.addImport(Qualifier.class);
       javaAnnotation.addImport(Target.class);
       javaAnnotation.addImport(Retention.class);
       javaAnnotation.addImport(Documented.class);
       
       javaAnnotation.addAnnotation(Qualifier.class);
       javaAnnotation.addAnnotation(Target.class).setEnumValue(TYPE).setEnumValue(METHOD).setEnumValue(PARAMETER).setEnumValue(FIELD);
       javaAnnotation.addAnnotation(Retention.class).setEnumValue(RUNTIME);
       javaAnnotation.addAnnotation(Documented.class);

       return javaAnnotation;
   }

As soon as I try to save it with "javaSourceFacet.saveJavaSource(createQualifier(packageName, "Forge"));", Forge throws the following error: "seam-persistence install-managed-persistence-context] Unknown JavaSource type."

Anyone any idea?

BTW:
If this createQualifier annotation doesn't exist already somewhere else, I would suggest to move into the core somewhere, as soon as it is finished and tested. Unfortunately I can't see the output atm.

Regards,

Daniel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20111215/c7699f25/attachment.html 


More information about the forge-dev mailing list