public class Property
extends java.lang.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 java.lang.String |
env |
protected java.io.File |
file |
protected java.lang.String |
name |
protected java.lang.String |
prefix |
protected java.lang.String |
value |
protected XMLElement |
xmlProp |
| Constructor and Description |
|---|
Property(XMLElement xmlProp,
CompilerConfig config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addProperties(java.util.Properties props)
iterate through a set of properties, resolve them then assign them
|
protected void |
addProperty(java.lang.String name,
java.lang.String value)
Add a name value pair to the project property set
|
void |
execute()
Set the property in the project to the value.
|
java.lang.String |
getValue()
get the value of this property
|
protected void |
loadEnvironment(java.lang.String prefix)
load the environment values
|
protected void |
loadFile(java.io.File file)
load properties from a file
|
private void |
resolveAllProperties(java.util.Properties props)
resolve properties inside a properties object
|
java.lang.String |
toString()
get the value of this property
|
protected java.lang.String name
protected java.lang.String value
protected java.io.File file
protected java.lang.String env
protected java.lang.String prefix
protected XMLElement xmlProp
protected CompilerConfig config
protected Compiler compiler
public Property(XMLElement xmlProp, CompilerConfig config)
public java.lang.String getValue()
public java.lang.String toString()
toString in class java.lang.Objectpublic void execute()
throws CompilerException
CompilerExceptionprotected void loadFile(java.io.File file)
throws CompilerException
file - file to loadCompilerExceptionprotected void loadEnvironment(java.lang.String prefix)
throws CompilerException
prefix - prefix to place before themCompilerExceptionprotected void addProperty(java.lang.String name,
java.lang.String value)
throws CompilerException
name - name of propertyvalue - value to setCompilerExceptionprotected void addProperties(java.util.Properties props)
throws CompilerException
CompilerExceptionprivate void resolveAllProperties(java.util.Properties props)
throws CompilerException
props - properties to resolveCompilerException