User: vharcq  
  Date: 02/05/14 13:41:29

  Modified:    core/src/xdoclet Tag: MODULE_REFACTORING_BRANCH
                        TemplateSubTask.java
  Log:
  Use multiple addOfType() instead of a comma separated setOfType()
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.41.2.9  +34 -23    xdoclet/core/src/xdoclet/TemplateSubTask.java
  
  Index: TemplateSubTask.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/TemplateSubTask.java,v
  retrieving revision 1.41.2.8
  retrieving revision 1.41.2.9
  diff -u -w -r1.41.2.8 -r1.41.2.9
  --- TemplateSubTask.java      13 May 2002 22:30:52 -0000      1.41.2.8
  +++ TemplateSubTask.java      14 May 2002 20:41:29 -0000      1.41.2.9
  @@ -9,6 +9,8 @@
   import java.net.URL;
   import java.text.MessageFormat;
   import java.util.ArrayList;
  +import java.util.Iterator;
  +import java.util.List;
   
   import org.apache.commons.logging.Log;
   
  @@ -32,7 +34,7 @@
    * @author            Ara Abrahamian ([EMAIL PROTECTED])
    * @created           Sep 25, 2001
    * @xdoclet:subtask   name="template" parent="xdoclet.DocletTask"
  - * @version           $Revision: 1.41.2.8 $
  + * @version           $Revision: 1.41.2.9 $
    */
   public class TemplateSubTask extends SubTask
   {
  @@ -57,15 +59,15 @@
   
       /**
        * Applicable only to per class output generation. Specify full qualified class 
name from which classes should be
  -     * derived. Output generation is performed only for classes of one of the types 
defined in this property, it's a
  -     * comma-separated list. You can control the extent in which the type search 
occures by using 'extent' property.
  +     * derived. Output generation is performed only for classes of one of the types 
defined in this list. You can
  +     * control the extent in which the type search occures by using 'extent' 
property.
        *
        * @see   #setOfType(java.lang.String)
        * @see   #getOfType()
        * @see   #setExtent(TemplateSubTask.ExtentTypes)
        * @see   #getExtent()
        */
  -    private String  ofType = null;
  +    private List    ofType = new ArrayList();
   
       /**
        * You can control the extent in which the type search occures. Valid values 
are: <i>concrete-type</i> , <i>
  @@ -195,9 +197,9 @@
        *
        * @return   The OfType value
        */
  -    public String getOfType()
  +    public String[] getOfType()
       {
  -        return ofType;
  +        return (String[]) ofType.toArray(new String[ofType.size()]);
       }
   
       /**
  @@ -343,16 +345,6 @@
       }
   
       /**
  -     * Sets the OfType attribute of the TemplateSubTask object
  -     *
  -     * @param ofType  The new OfType value
  -     */
  -    public void setOfType(String ofType)
  -    {
  -        this.ofType = ofType;
  -    }
  -
  -    /**
        * Sets the Extent attribute of the TemplateSubTask object
        *
        * @param extent  The new Extent value
  @@ -382,6 +374,16 @@
           this.generationManager = gM;
       }
   
  +    /**
  +     * Sets the OfType attribute of the TemplateSubTask object
  +     *
  +     * @param ofType  The new OfType value
  +     */
  +    public void addOfType(String ofType)
  +    {
  +        this.ofType.add(ofType);
  +    }
  +
       public GenerationManager createGenerationManager()
       {
           generationManager = new GenerationManager(this);
  @@ -408,7 +410,9 @@
           setPrefixWithPackageStructure(src.isPrefixWithPackageStructure());
           setDestinationFile(src.getDestinationFile());
           setTemplateURL(src.getTemplateURL());
  -        setOfType(src.getOfType());
  +        for (int i = 0; i < src.getOfType().length; i++) {
  +            addOfType(src.getOfType()[i]);
  +        }
           setExtentValue(src.getExtent());
           setHavingClassTag(src.getHavingClassTag());
       }
  @@ -613,14 +617,21 @@
               return false;
           }
   
  -        if (getOfType() != null) {
  -            if (TypeTagsHandler.isOfType(clazz, getOfType(), 
TypeTagsHandler.extractExtentType(getExtent())) == false) {
  +        Iterator it = ofType.iterator();
  +        boolean match = false;
  +
  +        while (it.hasNext()) {
  +            String type = (String) it.next();
  +
  +            if (TypeTagsHandler.isOfType(clazz, type, 
TypeTagsHandler.extractExtentType(getExtent())) == true) {
                   if (log.isDebugEnabled()) {
  -                    log.debug("Reject class '" + clazz.qualifiedName() + "' because 
it is not of type '" + getOfType() + "'.");
  +                    log.debug("Accept class '" + clazz.qualifiedName() + "' because 
it is of type '" + type + "'.");
                   }
  -                return false;
  +                match = true;
               }
           }
  +        if (!match)
  +            return false;
   
           if (getHavingClassTag() != null) {
               if (!clazz.doc().hasTag(getHavingClassTag(), false)) {
  
  
  

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to