ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-ant/proposal/embed/src/java/org/apache/tools/ant PropertyHelper.java
Date Fri, 11 Oct 2002 18:01:33 GMT
costin      2002/10/11 11:01:33

  Modified:    proposal/embed/src/java/org/apache/tools/ant
                        PropertyHelper.java
  Log:
  Few small changes and comments.
  
  I would like to extend it a bit more in the future - to support
  properties like "${property}" without a string conversion.
  
  In other workds, if a dynamic property is used ( which return an
  object ), the object should be used as such in the introspection.
  That would greatly simplify tasks and allow more flexibility.
  
  Revision  Changes    Path
  1.3       +11 -13    jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/PropertyHelper.java
  
  Index: PropertyHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/embed/src/java/org/apache/tools/ant/PropertyHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertyHelper.java	27 Jul 2002 02:20:15 -0000	1.2
  +++ PropertyHelper.java	11 Oct 2002 18:01:33 -0000	1.3
  @@ -67,13 +67,12 @@
   /**
    * Deals with properties - substitution, dynamic properties, etc.
    *
  - * Eventually the static methods from ProjectHelper should be
  - * moved here ( with a wrapper for backward compat ).
  + * Important: the static methods from ProjectHelper belong here. They should
  + *  be changed to wrap this.
    *
  - * Also the property store ( Hashtable ) and all property manipulation
  - * logic could be moved here.
  + * Also the property store ( Hashtable ) from Project and all property manipulation
  + * logic should be moved here ( and delegated to interceptors ).
    *
  - * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
    * @author Costin Manolache
    */
   public class PropertyHelper {
  @@ -105,10 +104,6 @@
       public void addPropertyInterceptor( PropertyInterceptor pi ) {
           propertyInterceptors.addElement( pi );
       }
  -
  -//     public Vector getPropertyInterceptors() {
  -//         return propertyInterceptors;
  -//     }
       
       /** Process an value, doing the replacements.
        */
  @@ -168,7 +163,6 @@
       Object processDynamic( Project project, String name ) {
           for(int i=0; i<propertyInterceptors.size(); i++ ) {
               PropertyInterceptor pi=(PropertyInterceptor)propertyInterceptors.elementAt(
i );
  -            
               Object o=pi.getProperty( project, null, name );
               if( o!=null )
                   return o;
  @@ -197,12 +191,17 @@
           
           IntrospectionHelper ih = 
               IntrospectionHelper.getHelper(target.getClass());
  -        
  +
  +        // Why ???
           project.addBuildListener(ih);
           
           for (int i = 0; i < attrs.getLength(); i++) {
  +            String attValue=attrs.getValue(i);
  +
  +            // XXX ADD SPECIAL CASE FOR ${property} - don't convert to string
  +            // and support ARRAYS.
               // reflect these into the target
  -            String value = replaceProperties(attrs.getValue(i));
  +            String value = replaceProperties(attValue);
               
               try {
                   ih.setAttribute(project, target, 
  @@ -215,5 +214,4 @@
               }
           }
       }
  -
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message