IComponentDescriptorProcessor
public class Jexl3ComponentDescriptorProcessor extends java.lang.Object implements IComponentDescriptorProcessor
All values of properties tagged as of JEXL3 processing style in the original component descriptor source will be considered JEXL expressions.
If evaluating to a non-null value, the expression evaluation result will be set as resulting property
value of the same property name. If the expression evaluates to null
, the corresponding property
will not be set.
The following implicit variables are made available by this processor:
Variable name | Definition | Example |
---|---|---|
system | System.getProperties() | `user dir is ${system["user.dir"]}` |
env | System.getenv() | "JAVA_HOME is ${env.JAVA_HOME}" |
this | The actual property set in its evaluated form. This may be used to resolve properties that are again computed by some processor. Note that a max evaluation depth of 50 is enforced when resolving properties defined in the property set. | this['com.zfabrik.component.type'] |
components | IComponentsManager.INSTANCE | components.getComponent("mymodule/mycomponent").getProperty("myProp") |
this
variable, re-use of definitions within a single descriptor is possible. For example, assuming
some other processor ext is involved, a property set
hostName\:JEXl3=env.hostName
database\:ext=_THE_DB_
ds.prop.url\:JEXl3=`jdbc:derby://${this.hostName}/${this.database};create=true`
would be evaluated resolving across processors.
Note that a JEXL expression does not necessarily evaluate to a string object. Neither is the input property value to be processed considered a JEXL string. For example, the expression
`Hallo this is ${system["user.name"]}`does indeed evaluate to a string. As does
"Hallo this is ${system[\"user.name\"]}"(without processing the ${} expression) and more advanced
system["os.name"].startsWith("Linux")? "We are running on a Linux OS" : "We are running on something else"but not
500+10which is indeed an integer. See also https://commons.apache.org/proper/commons-jexl/reference/syntax.html for more syntax information.
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
JEXL3_STYLE |
Style processed by this processor
|
EXTENSION_POINT, STYLE_PROCESSED
Constructor | Description |
---|---|
Jexl3ComponentDescriptorProcessor() |
Modifier and Type | Method | Description |
---|---|---|
Evaluator |
createEvaluator() |
Provide an evaluator instance.
|
public static final java.lang.String JEXL3_STYLE
public Evaluator createEvaluator()
com.zfabrik.components.provider.IComponentDescriptorProcessor
createEvaluator
in interface IComponentDescriptorProcessor