users@jaxb.java.net

Re: Plugin for EJB 3.0 annotations

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 15 Aug 2005 14:38:06 -0700

I investigated this more carefully.

<xs:element name="name" type="xs:string">
   <xs:annotation><xs:appinfo>
     <ejb3:annotate className="javax.ejb.Entity"
       param="myparam" value="myvalue"/>
   </xs:appinfo></xs:annotation>
</xs:element>

This customization can be picked up from CPropertyInfo, because the
above element is mapped to a property. See the following code for an
example:

         for (ClassOutline co : outline.getClasses()) {
             dump(co.target.getCustomizations());

             for( CPropertyInfo p : co.target.getProperties() ) {
                 dump(p.getCustomizations());
             }
         }

     private void dump(CCustomizations cList) {
         for (CPluginCustomization c : cList) {
             Element e = c.element;
             System.out.println(e.getTagName());
             c.markAsAcknowledged();
         }
     }

getAllElements() returned an empty collection because there's no element
decl -> JAXBElement mapping in your schema. The "personDocument" element
is mapped to a class, and its representation is another ClassOutline.

P.S. In the future, consider using attachments. It's much easier for me
to test that way.



-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com