...
Code Block | ||||
---|---|---|---|---|
| ||||
<conditions> <condition type="variable" id="standardinstallation"> <name>setup.type</name> <value>standard</value> </condition> <condition type="variable" id="expertinstallation"> <name>setup.type</name> <value>expert</value> </condition> <condition type="java" id="installonwindows"> <java> <class>com.izforge.izpack.util.OsVersion</class> <field>IS_WINDOWS</field> </java> <returnvalue type="boolean">true</returnvalue> </condition> <condition type="and" id="standardinstallation.onwindows"> <condition type="ref" refid="standardinstallation"/> <condition type="ref" refid="installonwindows" /> </condition> </conditions> |
...
Expression languages
Simple expression language
From IzPack 3.11 on normally, you don't have to define the compound conditions because you can use a simple expression language. The language has supports the following operators:
| an operator for the Andcondition |
| an operator for the OrCondition |
{{ | an operator for the XOrCondition |
| an operator for the NotCondition |
...
Thus, !conditionA+conditionB+!conditionC
DOES NOT equal (!conditionA) && conditionB && (!conditionC)
, but equals !(conditionA && (conditionB && !(conditionC)))
.
So you should definecomplex define complex conditions using the xml structure or use the Complex expression language.
Complex expression language
With IZPACK-577 fixed and released, you can also use a more Complex expression language that evaluates using the boolean precedence rules.
| an operator for the Andcondition |
| an operator for the OrCondition |
| an operator for the NotCondition |
!conditionA+conditionB+!conditionC
equals (!conditionA) && conditionB && (!conditionC)
.
XOR and parentheses () may be added in the future.
More types of conditions can be defined by inheriting com.izforge.izpack.Condition class.
...