public class Property extends Object
Properties are immutable: once a property is set it cannot be changed. They are most definately not variable.
There are five ways to set properties:
The value part of the properties being set, might contain references to other properties. These references are resolved when the properties are set.
This also holds for properties loaded from a property file.
Properties are case sensitive.
When specifying the environment attribute, it's value is used as a prefix to use when retrieving environment variables. This functionality is currently only implemented on select platforms.
Thus if you specify environment="myenv" you will be able to access OS-specific environment variables via property names "myenv.PATH" or "myenv.TERM".
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.
Note that when specifying either the prefix
or environment
attributes, 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".
Modifier and Type | Field and Description |
---|---|
protected Compiler |
compiler |
protected CompilerConfig |
config |
protected String |
env |
protected File |
file |
protected String |
name |
protected String |
prefix |
protected String |
value |
protected net.n3.nanoxml.XMLElement |
xmlProp |
Constructor and Description |
---|
Property(net.n3.nanoxml.XMLElement xmlProp,
CompilerConfig config) |
Modifier and Type | Method and Description |
---|---|
protected void |
addProperties(Properties props)
iterate through a set of properties, resolve them then assign them
|
protected void |
addProperty(String name,
String value)
Add a name value pair to the project property set
|
void |
execute()
Set the property in the project to the value.
|
String |
getValue()
get the value of this property
|
protected void |
loadEnvironment(String prefix)
load the environment values
|
protected void |
loadFile(File file)
load properties from a file
|
private void |
resolveAllProperties(Properties props)
resolve properties inside a properties object
|
String |
toString()
get the value of this property
|
protected net.n3.nanoxml.XMLElement xmlProp
protected CompilerConfig config
public Property(net.n3.nanoxml.XMLElement xmlProp, CompilerConfig config)
public String getValue()
public void execute() throws CompilerException
CompilerException
protected void loadFile(File file) throws CompilerException
file
- file to loadCompilerException
protected void loadEnvironment(String prefix) throws CompilerException
prefix
- prefix to place before themCompilerException
protected void addProperty(String name, String value) throws CompilerException
name
- name of propertyvalue
- value to setCompilerException
protected void addProperties(Properties props) throws CompilerException
CompilerException
private void resolveAllProperties(Properties props) throws CompilerException
props
- properties to resolveCompilerException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses