org.apache.tools.ant.taskdefs
public class Property extends Task
There are five ways to set properties:
Although combinations of these ways are possible, only one should be used at a time. Problems might occur with the order in which properties are set, for instance.
The value part of the properties being set, might contain references to other properties. These references are resolved at the time these properties are set. This also holds for properties loaded from a property file.
Properties are case sensitive.Since: Ant 1.1
UNKNOWN: name="name" description="One of these, when using the name attribute" name="noname" description="One of these, when not using the name attribute"
Field Summary | |
---|---|
protected Path | classpath |
protected String | env |
protected File | file |
protected String | name |
protected String | prefix |
protected Reference | ref |
protected String | resource |
protected URL | url |
protected boolean | userProperty |
protected String | value |
Constructor Summary | |
---|---|
Property() | |
protected | Property(boolean userProperty) |
protected | Property(boolean userProperty, Project fallback) |
Method Summary | |
---|---|
protected void | addProperties(Properties props)
iterate through a set of properties,
resolve them then assign them |
protected void | addProperty(String n, String v)
add a name value pair to the project property set |
Path | createClasspath()
The classpath to use when looking up a resource. |
void | execute()
set the property in the project to the value.
if the task was give a file, resource or env attribute
here is where it is loaded |
Path | getClasspath() |
String | getEnvironment() |
File | getFile() |
String | getName() |
String | getPrefix() |
Reference | getRefid() |
String | getResource() |
URL | getUrl() |
String | getValue() |
protected void | loadEnvironment(String prefix)
load the environment values |
protected void | loadFile(File file)
load properties from a file |
protected void | loadResource(String name)
load properties from a resource in the current classpath |
protected void | loadUrl(URL url)
load properties from a url |
void | setClasspath(Path classpath)
The classpath to use when looking up a resource. |
void | setClasspathRef(Reference r)
the classpath to use when looking up a resource,
given as reference to a <path> defined elsewhere |
void | setEnvironment(String env)
Prefix to use when retrieving environment variables.
|
void | setFile(File file)
Filename of a property file to load. |
void | setLocation(File location)
Sets the property to the absolute filename of the
given file. |
void | setName(String name)
The name of the property to set. |
void | setPrefix(String prefix)
Prefix to apply to properties loaded using file
or resource .
|
void | setRefid(Reference ref)
Sets a reference to an Ant datatype
declared elsewhere.
|
void | setResource(String resource)
The resource name of a property file to load |
void | setUrl(URL url)
The url from which to load properties. |
void | setUserProperty(boolean userProperty) |
void | setValue(String value)
The value of the property. |
String | toString()
get the value of this property |
Since: Ant 1.5
Since: Ant 1.5
Parameters: n name of property v value to set
Since: Ant 1.5
Since: Ant 1.5
Since: Ant 1.5
Parameters: prefix prefix to place before them
Parameters: file file to load
Parameters: name name of resource to load
Parameters: url url to load from
Parameters: classpath to add to any existing classpath
Note that if you supply a property name with a final
"." it will not be doubled. ie environment="myenv." will still
allow access of environment variables through "myenv.PATH" and
"myenv.TERM". This functionality is currently only implemented
on select platforms. Feel free to send patches to increase the number of platforms
this functionality is supported on ;).
Note also that properties are case sensitive, even if the
environment variables on your operating system are not, e.g. it
will be ${env.Path} not ${env.PATH} on Windows 2000.
Parameters: env prefix
UNKNOWN: group="noname"
Parameters: file filename
UNKNOWN: group="noname"
Parameters: location path to set
UNKNOWN: group="name"
Parameters: name property name
file
or resource
.
A "." is appended to the prefix if not specified.Parameters: prefix prefix string
Since: Ant 1.5
Parameters: ref reference
UNKNOWN: group="name"
Parameters: resource resource on classpath
UNKNOWN: group="noname"
Parameters: url url string
UNKNOWN: group="noname"
Deprecated: This was never a supported feature and has been deprecated without replacement
UNKNOWN: ignore="true"
Parameters: value value to assign
UNKNOWN: group="name"
Returns: the current value or the empty string