Save This Page
Home » apache-ant-1.7.1-src » org.apache.tools » ant » [javadoc | source]
org.apache.tools.ant
public class: PropertyHelper [javadoc | source]
java.lang.Object
   org.apache.tools.ant.PropertyHelper
NOT FINAL. API MAY CHANGE Deals with properties - substitution, dynamic properties, etc. This is the same code as in Ant1.5. The main addition is the ability to chain multiple PropertyHelpers and to replace the default.
Constructor:
 protected PropertyHelper() 
Method from org.apache.tools.ant.PropertyHelper Summary:
copyInheritedProperties,   copyUserProperties,   getInternalInheritedProperties,   getInternalProperties,   getInternalUserProperties,   getNext,   getProject,   getProperties,   getProperty,   getPropertyHelper,   getPropertyHook,   getUserProperties,   getUserProperty,   parsePropertyString,   parsePropertyStringDefault,   replaceProperties,   setInheritedProperty,   setNewProperty,   setNext,   setProject,   setProperty,   setPropertyHook,   setUserProperty
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.PropertyHelper Detail:
 public  void copyInheritedProperties(Project other) 
    Copies all user properties that have not been set on the command line or a GUI tool from this instance to the Project instance given as the argument.

    To copy all "user" properties, you will also have to call copyUserProperties .

 public  void copyUserProperties(Project other) 
    Copies all user properties that have been set on the command line or a GUI tool from this instance to the Project instance given as the argument.

    To copy all "user" properties, you will also have to call copyInheritedProperties .

 protected Hashtable getInternalInheritedProperties() 
    special back door for subclasses, internal access to the hashtables
 protected Hashtable getInternalProperties() 
    special back door for subclasses, internal access to the hashtables
 protected Hashtable getInternalUserProperties() 
    special back door for subclasses, internal access to the hashtables
 public PropertyHelper getNext() 
    Get the next property helper in the chain.
 public Project getProject() 
    Get this PropertyHelper's Project.
 public Hashtable getProperties() 
    Returns a copy of the properties table.
 public synchronized Object getProperty(String ns,
    String name) 
    Returns the value of a property, if it is set. You can override this method in order to plug your own storage.
 public static synchronized PropertyHelper getPropertyHelper(Project project) 
    Factory method to create a property processor. Users can provide their own or replace it using "ant.PropertyHelper" reference. User tasks can also add themselves to the chain, and provide dynamic properties.
 public Object getPropertyHook(String ns,
    String name,
    boolean user) 
    Get a property. If all hooks return null, the default tables will be used.
 public Hashtable getUserProperties() 
    Returns a copy of the user property hashtable
 public synchronized Object getUserProperty(String ns,
    String name) 
    Returns the value of a user property, if it is set.
 public  void parsePropertyString(String value,
    Vector fragments,
    Vector propertyRefs) throws BuildException 
    Parses a string containing ${xxx} style property references into two lists. The first list is a collection of text fragments, while the other is a set of string property names. null entries in the first list indicate a property reference from the second list. It can be overridden with a more efficient or customized version.
 static  void parsePropertyStringDefault(String value,
    Vector fragments,
    Vector propertyRefs) throws BuildException 
    Default parsing method. It is here only to support backward compatibility for the static ProjectHelper.parsePropertyString().
 public String replaceProperties(String ns,
    String value,
    Hashtable keys) throws BuildException 
    Replaces ${xxx} style constructions in the given value with the string value of the corresponding data types.
 public synchronized  void setInheritedProperty(String ns,
    String name,
    Object value) 
    Sets an inherited user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten. Also marks these properties as properties that have not come from the command line.
 public synchronized  void setNewProperty(String ns,
    String name,
    Object value) 
    Sets a property if no value currently exists. If the property exists already, a message is logged and the method returns with no other effect.
 public  void setNext(PropertyHelper next) 
    There are 2 ways to hook into property handling: - you can replace the main PropertyHelper. The replacement is required to support the same semantics (of course :-) - you can chain a property helper capable of storing some properties. Again, you are required to respect the immutability semantics (at least for non-dynamic properties)
 public  void setProject(Project p) 
    Set the project for which this helper is performing property resolution.
 public synchronized boolean setProperty(String ns,
    String name,
    Object value,
    boolean verbose) 
    Default implementation of setProperty. Will be called from Project. This is the original 1.5 implementation, with calls to the hook added.
 public boolean setPropertyHook(String ns,
    String name,
    Object value,
    boolean inherited,
    boolean user,
    boolean isNew) 
    Sets a property. Any existing property of the same name is overwritten, unless it is a user property. Will be called from setProperty(). If all helpers return false, the property will be saved in the default properties table by setProperty.
 public synchronized  void setUserProperty(String ns,
    String name,
    Object value) 
    Sets a user property, which cannot be overwritten by set/unset property calls. Any previous value is overwritten.