User: ara_e_w 
  Date: 02/10/08 08:56:26

  Modified:    modules/xdoclet/src/xdoclet/modules/maven
                        MavenpluginTagsHandler.java
  Log:
  better maven plugin, and bigger! It generates a huge 760KB jelly file 8-)
  
  Revision  Changes    Path
  1.2       +55 -1     
xdoclet/modules/xdoclet/src/xdoclet/modules/maven/MavenpluginTagsHandler.java
  
  Index: MavenpluginTagsHandler.java
  ===================================================================
  RCS file: 
/cvsroot/xdoclet/xdoclet/modules/xdoclet/src/xdoclet/modules/maven/MavenpluginTagsHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- MavenpluginTagsHandler.java       3 Oct 2002 20:47:39 -0000       1.1
  +++ MavenpluginTagsHandler.java       8 Oct 2002 15:56:26 -0000       1.2
  @@ -7,14 +7,17 @@
   import java.util.Iterator;
   import java.util.List;
   import xjavadoc.MethodIterator;
  +import xjavadoc.ParameterIterator;
   import xjavadoc.XClass;
   import xjavadoc.XCollections;
   import xjavadoc.XMethod;
  +import xjavadoc.XParameter;
   
   import xdoclet.XDocletException;
   import xdoclet.modules.doc.AntdocSubTask;
   import xdoclet.modules.doc.AntdocTagsHandler;
   import xdoclet.tagshandler.MethodTagsHandler;
  +import xdoclet.tagshandler.TypeTagsHandler;
   
   /**
    * This tag handler is used to generate xdoclet Maven plugin.
  @@ -22,12 +25,19 @@
    * @author               Ara Abrahamian
    * @created              21 September 2002
    * @xdoclet.taghandler   namespace="Mavenplugin"
  - * @version              $Revision: 1.1 $
  + * @version              $Revision: 1.2 $
    */
   public class MavenpluginTagsHandler extends AntdocTagsHandler
   {
       private List    tasks;
   
  +    private static boolean isNestedElementParameter(XParameter parameter)
  +    {
  +        return 
TypeTagsHandler.isPrimitiveType(parameter.getType().getQualifiedName()) == false &&
  +            parameter.getType().getQualifiedName().startsWith("xjavadoc") == false 
&&
  +            parameter.getType().getQualifiedName().startsWith("java") == false;
  +    }
  +
       public List getTasks()
       {
           return tasks;
  @@ -79,6 +89,32 @@
               generate(template);
       }
   
  +    public void ifIsANestedElement(String template) throws XDocletException
  +    {
  +        ifIsANestedElement_Impl(template, true);
  +    }
  +
  +    public String nestedElementName() throws XDocletException
  +    {
  +        return getCurrentMethod().getName().substring(3);
  +    }
  +
  +    public String nestedElementType() throws XDocletException
  +    {
  +        for (ParameterIterator i = 
XCollections.parameterIterator(getCurrentMethod().getParameters()); i.hasNext(); ) {
  +            XParameter parameter = i.next();
  +
  +            return parameter.getType().getQualifiedName();
  +        }
  +
  +        return "";
  +    }
  +
  +    public void ifIsNotANestedElement(String template) throws XDocletException
  +    {
  +        ifIsANestedElement_Impl(template, false);
  +    }
  +
       private void ifIsASubTask_Impl(String template, boolean condition) throws 
XDocletException
       {
           if (subElement.isDynamicSubElement() == condition)
  @@ -89,5 +125,23 @@
       {
           if (subElement.getXClass().isA("org.apache.tools.ant.types.FileSet") == 
condition)
               generate(template);
  +    }
  +
  +    private void ifIsANestedElement_Impl(String template, boolean condition) throws 
XDocletException
  +    {
  +        if ((getCurrentMethod().getName().startsWith("set") || 
getCurrentMethod().getName().startsWith("add")) && 
getCurrentMethod().getParameters().size() == 1) {
  +
  +            for (ParameterIterator i = 
XCollections.parameterIterator(getCurrentMethod().getParameters()); i.hasNext(); ) {
  +                XParameter parameter = i.next();
  +
  +                if (isNestedElementParameter(parameter) == condition) {
  +//                    System.out.println(">>" + getCurrentClass().getName());
  +//                    System.out.println(">>>>" + getCurrentMethod().getName());
  +//                    System.out.println(">>>>>>" + 
parameter.getType().getQualifiedName());
  +
  +                    generate(template);
  +                }
  +            }
  +        }
       }
   }
  
  
  


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to