Class Jexl3ComponentDescriptorProcessor
- java.lang.Object
-
- com.zfabrik.impl.components.processing.Jexl3ComponentDescriptorProcessor
-
- All Implemented Interfaces:
com.zfabrik.components.provider.IComponentDescriptorProcessor
public class Jexl3ComponentDescriptorProcessor extends java.lang.Object implements com.zfabrik.components.provider.IComponentDescriptorProcessorA jexl3 component descriptor processor. This processor is based on the Apache Commons JEXL library version 3.0 (see https://commons.apache.org/proper/commons-jexl).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:
Using theVariable 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.INSTANCEcomponents.getComponent("mymodule/mycomponent").getProperty("myProp") thisvariable, re-use of definitions within a single descriptor is possible. For example, assuming some other processor ext is involved, a property set
would be evaluated resolving across processors.hostName\:JEXl3=env.hostName database\:ext=_THE_DB_ ds.prop.url\:JEXl3=`jdbc:derby://${this.hostName}/${this.database};create=true`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 advancedsystem["os.name"].startsWith("Linux")? "We are running on a Linux OS" : "We are running on something else"but not500+10
which is indeed an integer. See also https://commons.apache.org/proper/commons-jexl/reference/syntax.html for more syntax information.- Author:
- hb
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJEXL3_STYLEStyle processed by this processor
-
Constructor Summary
Constructors Constructor Description Jexl3ComponentDescriptorProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.zfabrik.components.provider.props.EvaluatorcreateEvaluator()Provide an evaluator instance.
-
-
-
Field Detail
-
JEXL3_STYLE
public static final java.lang.String JEXL3_STYLE
Style processed by this processor- See Also:
- Constant Field Values
-
-
Method Detail
-
createEvaluator
public com.zfabrik.components.provider.props.Evaluator createEvaluator()
Description copied from interface:com.zfabrik.components.provider.IComponentDescriptorProcessorProvide an evaluator instance. The evaluator will be used during the processing of on component descriptor property map.- Specified by:
createEvaluatorin interfacecom.zfabrik.components.provider.IComponentDescriptorProcessor
-
-