|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.izforge.izpack.compiler.Property
Sets a property by name, or set of properties (from file or resource) in the project. This is modeled after ant properties
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".
Field Summary | |
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 Summary | |
Property(XMLElement xmlProp,
CompilerConfig config)
|
Method Summary | |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
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
Constructor Detail |
public Property(XMLElement xmlProp, CompilerConfig config)
Method Detail |
public java.lang.String getValue()
public java.lang.String toString()
public void execute() throws CompilerException
CompilerException
protected void loadFile(java.io.File file) throws CompilerException
file
- file to load
CompilerException
protected void loadEnvironment(java.lang.String prefix) throws CompilerException
prefix
- prefix to place before them
CompilerException
protected void addProperty(java.lang.String name, java.lang.String value) throws CompilerException
name
- name of propertyvalue
- value to set
CompilerException
protected void addProperties(java.util.Properties props) throws CompilerException
CompilerException
private void resolveAllProperties(java.util.Properties props) throws CompilerException
props
- properties to resolve
CompilerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |