org.apache.tools.ant
public class PropertyHelper extends Object
Since: Ant 1.6
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.
|
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
|
PropertyHelper | getNext()
Get the next property helper in the chain.
|
Hashtable | getProperties()
Returns a copy of the properties table. |
Object | getProperty(String ns, String name)
Returns the value of a property, if it is set. |
static PropertyHelper | getPropertyHelper(Project project)
Factory method to create a property processor.
|
Object | getPropertyHook(String ns, String name, boolean user) Get a property. |
Hashtable | getUserProperties()
Returns a copy of the user property hashtable |
Object | getUserProperty(String ns, String name)
Returns the value of a user property, if it is set.
|
void | parsePropertyString(String value, Vector fragments, Vector propertyRefs)
Parses a string containing ${xxx} style property
references into two lists. |
String | replaceProperties(String ns, String value, Hashtable keys)
Replaces ${xxx} style constructions in the given value
with the string value of the corresponding data types.
|
void | setInheritedProperty(String ns, String name, Object value)
Sets an inherited user property, which cannot be overwritten by set/unset
property calls. |
void | setNewProperty(String ns, String name, 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(String ns, String name, Object value, boolean verbose) Default implementation of setProperty. |
boolean | setPropertyHook(String ns, String name, Object value, boolean inherited, boolean user, boolean isNew)
Sets a property. |
void | setUserProperty(String ns, String name, Object value)
Sets a user property, which cannot be overwritten by
set/unset property calls. |
To copy all "user" properties, you will also have to call
copyUserProperties
.
Parameters: other the project to copy the properties to. Must not be null.
Since: Ant 1.6
To copy all "user" properties, you will also have to call
copyInheritedProperties
.
Parameters: other the project to copy the properties to. Must not be null.
Since: Ant 1.6
Returns: the live hashtable inherited properties
Returns: the live hashtable of all properties
Returns: the live hashtable of user properties
Returns: the next property helper.
Returns: a hashtable containing all properties (including user properties).
Parameters: ns The namespace for the property (currently not used). name The name of the property.
May be null
, in which case
the return value is also null
.
Returns: the property value, or null
for no match
or if a null
name is provided.
Parameters: project the project fro which the property helper is required.
Returns: the project's property helper.
Parameters: ns namespace of the sought property. name name of the sought property. user True if this is a user property.
Returns: The property, if returned by a hook, or null if none.
Returns: a hashtable containing just the user properties
Parameters: ns The namespace for the property (currently not used). name The name of the property.
May be null
, in which case
the return value is also null
.
Returns: the property value, or null
for no match
or if a null
name is provided.
${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.
Parameters: 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
.
Throws: BuildException if the string contains an opening
${
without a closing
}
${xxx}
style constructions in the given value
with the string value of the corresponding data types.
Parameters: ns The namespace for the property. 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.
Returns: the original string with the properties replaced, or
null
if the original string is null
.
Throws: BuildException if the string contains an opening
${
without a closing
}
Parameters: ns The namespace for the property (currently not used). name The name of property to set.
Must not be null
. value The new value of the property.
Must not be null
.
Parameters: ns The namespace for the property (currently not used). name The name of property to set.
Must not be null
. value The new value of the property.
Must not be null
.
Since: Ant 1.6
Parameters: next the next property helper in the chain.
Parameters: p the project instance.
Parameters: ns The namespace for the property (currently not used). name The name of the property. value The value to set the property to. verbose If this is true output extra log messages.
Returns: true if the property is set.
Parameters: ns The namespace that the property is in (currently
not used. name The name of property to set.
Must not be null
. value The new value of the property.
Must not be null
. inherited True if this property is inherited (an [sub]ant[call] property). user True if this property is a user property. isNew True is this is a new property.
Returns: true if this helper has stored the property, false if it couldn't. Each helper should delegate to the next one (unless it has a good reason not to).
Parameters: ns The namespace for the property (currently not used). name The name of property to set.
Must not be null
. value The new value of the property.
Must not be null
.