|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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 Summary | |
protected |
PropertyHelper()
Default constructor. |
| Method Summary | |
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. |
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. |
PropertyHelper |
getNext()
Get the next property helper in the chain. |
java.util.Hashtable |
getProperties()
Returns a copy of the properties table. |
java.lang.Object |
getProperty(java.lang.String ns,
java.lang.String name)
Returns the value of a property, if it is set. |
static PropertyHelper |
getPropertyHelper(Project project)
Factory method to create a property processor. |
java.lang.Object |
getPropertyHook(java.lang.String ns,
java.lang.String name,
boolean user)
Get a property. |
java.util.Hashtable |
getUserProperties()
Returns a copy of the user property hashtable |
java.lang.Object |
getUserProperty(java.lang.String ns,
java.lang.String name)
Returns the value of a user property, if it is set. |
void |
parsePropertyString(java.lang.String value,
java.util.Vector fragments,
java.util.Vector propertyRefs)
Parses a string containing ${xxx} style property
references into two lists. |
java.lang.String |
replaceProperties(java.lang.String ns,
java.lang.String value,
java.util.Hashtable keys)
Replaces ${xxx} style constructions in the given value
with the string value of the corresponding data types. |
void |
setInheritedProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value)
Sets a user property, which cannot be overwritten by set/unset property calls. |
void |
setNewProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value)
Sets a property if no value currently exists. |
void |
setNext(PropertyHelper next)
There are 2 ways to hook into property handling: - you can replace the main PropertyHelper. |
void |
setProject(Project p)
Set the project for which this helper is performing property resolution |
boolean |
setProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value,
boolean verbose)
Default implementation of setProperty. |
boolean |
setPropertyHook(java.lang.String ns,
java.lang.String name,
java.lang.Object value,
boolean inherited,
boolean user,
boolean isNew)
Sets a property. |
void |
setUserProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value)
Sets a user property, which cannot be overwritten by set/unset property calls. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected PropertyHelper()
| Method Detail |
public void setProject(Project p)
p - the project instance.public void setNext(PropertyHelper next)
next - the next property helper in the chain.public PropertyHelper getNext()
public static PropertyHelper getPropertyHelper(Project project)
project - the project fro which the property helper is required.
public boolean setPropertyHook(java.lang.String ns,
java.lang.String name,
java.lang.Object value,
boolean inherited,
boolean user,
boolean isNew)
name - The name of property to set.
Must not be null.value - The new value of the property.
Must not be null.
public java.lang.Object getPropertyHook(java.lang.String ns,
java.lang.String name,
boolean user)
ns - namespace of the sought propertyname - name of the sought property
public void parsePropertyString(java.lang.String value,
java.util.Vector fragments,
java.util.Vector propertyRefs)
throws BuildException
${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.
value - Text to parse. Must not be null.fragments - List to add text fragments to.
Must not be null.propertyRefs - List to add property names to.
Must not be null.
BuildException - if the string contains an opening
${ without a closing
}
public java.lang.String replaceProperties(java.lang.String ns,
java.lang.String value,
java.util.Hashtable keys)
throws BuildException
${xxx} style constructions in the given value
with the string value of the corresponding data types.
value - The string to be scanned for property references.
May be null, in which case this
method returns immediately with no effect.keys - Mapping (String to String) of property names to their
values. If null, only project properties will
be used.
null if the original string is null.
BuildException - if the string contains an opening
${ without a closing
}
public boolean setProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value,
boolean verbose)
public void setNewProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value)
name - The name of property to set.
Must not be null.value - The new value of the property.
Must not be null.
public void setUserProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value)
name - The name of property to set.
Must not be null.value - The new value of the property.
Must not be null.
public void setInheritedProperty(java.lang.String ns,
java.lang.String name,
java.lang.Object value)
name - The name of property to set.
Must not be null.value - The new value of the property.
Must not be null.
public java.lang.Object getProperty(java.lang.String ns,
java.lang.String name)
name - The name of the property.
May be null, in which case
the return value is also null.
null for no match
or if a null name is provided.
public java.lang.Object getUserProperty(java.lang.String ns,
java.lang.String name)
name - The name of the property.
May be null, in which case
the return value is also null.
null for no match
or if a null name is provided.public java.util.Hashtable getProperties()
public java.util.Hashtable getUserProperties()
public void copyInheritedProperties(Project other)
To copy all "user" properties, you will also have to call
copyUserProperties.
other - the project to copy the properties to. Must not be null.public void copyUserProperties(Project other)
To copy all "user" properties, you will also have to call
copyInheritedProperties.
other - the project to copy the properties to. Must not be null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||