Browse Source

add some helper methods on PropertyHelper to access the get/get methods

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@567747 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
8967c1546c
1 changed files with 47 additions and 1 deletions
  1. +47
    -1
      src/main/org/apache/tools/ant/PropertyHelper.java

+ 47
- 1
src/main/org/apache/tools/ant/PropertyHelper.java View File

@@ -52,7 +52,7 @@ import java.util.Enumeration;
/** NOT FINAL. API MAY CHANGE
*
* Deals with properties - substitution, dynamic properties, etc.
*
*q
* This is the same code as in Ant1.5. The main addition is the ability
* to chain multiple PropertyHelpers and to replace the default.
*
@@ -173,6 +173,52 @@ public class PropertyHelper implements Cloneable {
add(DEFAULT_EXPANDER);
}

// --------------------------------------------------------
//
// Some helper static methods to get and set properties
//
// --------------------------------------------------------

/**
* A helper static method to get a property
* from a particular project.
* @param project the project in question.
* @param name the property name
* @return the value of the property if present, null otherwise.
* @since Ant 1.8
*/
public static Object getProperty(Project project, String name) {
return PropertyHelper.getPropertyHelper(project)
.getProperty(name);
}

/**
* A helper static method to set a property
* from a particular project.
* @param project the project in question.
* @param name the property name
* @param value the value to use.
* @since Ant 1.8
*/
public static void setProperty(Project project, String name, Object value) {
PropertyHelper.getPropertyHelper(project)
.setProperty(name, value, true);
}

/**
* A helper static method to set a new property
* from a particular project.
* @param project the project in question.
* @param name the property name
* @param value the value to use.
* @since Ant 1.8
*/
public static void setNewProperty(
Project project, String name, Object value) {
PropertyHelper.getPropertyHelper(project)
.setNewProperty(name, value);
}

//override facility for subclasses to put custom hashtables in

// -------------------- Hook management --------------------


Loading…
Cancel
Save