[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-dev
Subject:    cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs MatchingTask.java
From:       rubys () locus ! apache ! org
Date:       2000-02-29 2:59:58
[Download RAW message or body]

rubys       00/02/28 18:59:57

  Modified:    src/main/org/apache/tools/ant/taskdefs MatchingTask.java
  Log:
  Remove the portion of MatchingTask that duplicates logic present in
  the Available task.  This isn't Perl - we want only one clean way to
  do things here.
  
  Revision  Changes    Path
  1.5       +17 -13    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
  
  Index: MatchingTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MatchingTask.java	2000/02/24 18:26:49	1.4
  +++ MatchingTask.java	2000/02/29 02:59:57	1.5
  @@ -65,6 +65,7 @@
    *
    * @author Arnout J. Kuiper <a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a> 
    * @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">stefano@apache.org</a>
  + * @author Sam Ruby <a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>
    * @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
    */
   
  @@ -74,7 +75,18 @@
       protected Vector excludeList = new Vector();
       protected boolean useDefaultExcludes = true;
   
  -    // inner class to hold a name on list
  +    /**
  +     * provide access to properties from within the inner class
  +     */
  +    protected String getProperty(String name) { 
  +        return project.getProperty(name);
  +    }
  +
  +    /**
  +     * inner class to hold a name on list.  "If" and "Unless" attributes
  +     * may be used to invalidate the entry based on the existence of a 
  +     * property (typically set thru the use of the Available task).
  +     */
       public class NameEntry {
           private boolean valid = true;
           private String name;
  @@ -82,20 +94,12 @@
           public String getName() { return valid ? name : null; }
           public void setName(String name) { this.name = name; }
   
  -        public void setIfClassFound(String name) {
  -            try {
  -              Class.forName(name);
  -            } catch (ClassNotFoundException cnf) {
  -              valid = false;
  -            }
  +        public void setIf(String name) {
  +            if (getProperty(name) == null) valid = false;
           }
   
  -        public void setUnlessClassFound(String name) {
  -            try {
  -              Class.forName(name);
  -              valid = false;
  -            } catch (ClassNotFoundException cnf) {
  -            }
  +        public void setUnless(String name) {
  +            if (getProperty(name) != null) valid = false;
           }
       }
   
  
  
  

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic