Package com.adobe.granite.ui.components
Class ExpressionCustomizer
- java.lang.Object
 - 
- com.adobe.granite.ui.components.ExpressionCustomizer
 
 
- 
public class ExpressionCustomizer extends java.lang.ObjectA mechanic to allow a certain customization forExpressionResolver.The customization is only scoped to the current request, not a global one. The resource type implementation needs to use this class explicitly to make the customization available in the request scope going forward.
For example, the resource type implementation of CQ Dialog (
/apps/my/dialog) wants to registercqDesignvariable so that it can be used in EL expression:Design design = getDesign(); ExpressionCustomizer customizer = ExpressionCustomizer.from(request); customizer.setVariable("cqDesign", design);Then in the content structure, the content author can use
cqDesignvariable in the property that accepts EL:+ /apps/content/my/dialog - sling:resourceType = "my/dialog" + field1 - sling:resourceType = "my/textfield" - value = "${cqDesign.id}" 
- 
- 
Constructor Summary
Constructors Constructor Description ExpressionCustomizer() 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ExpressionCustomizerfrom(javax.servlet.ServletRequest request)Returns the instance from the given request.java.lang.ObjectgetVariable(java.lang.String name)Returns the value of the variable with the given name.booleanhasVariable(java.lang.String name)Returnstrueif there is a variable with the given name;falseotherwise.voidsetVariable(java.lang.String name, java.lang.Object value)Creates a variable with the given name and value. 
 - 
 
- 
- 
Method Detail
- 
from
@Nonnull public static ExpressionCustomizer from(@Nonnull javax.servlet.ServletRequest request)
Returns the instance from the given request.- Parameters:
 request- the current request acting as the scope of the customization- Returns:
 - the instance of the customizer
 
 
- 
getVariable
@CheckForNull public java.lang.Object getVariable(@Nonnull java.lang.String name)Returns the value of the variable with the given name.- Parameters:
 name- the name of the variable- Returns:
 - the value of the variable, or 
nullif there is no variable with that name 
 
- 
setVariable
public void setVariable(@Nonnull java.lang.String name, @Nonnull java.lang.Object value)Creates a variable with the given name and value.Setting an existing variable with the same name will overwrite its value.
- Parameters:
 name- the name of the variablevalue- the value of the variable
 
- 
hasVariable
public boolean hasVariable(@Nonnull java.lang.String name)Returnstrueif there is a variable with the given name;falseotherwise.- Parameters:
 name- the name of the variable- Returns:
 trueif there is a variable with the given name;falseotherwise
 
 - 
 
 -