Package com.adobe.granite.ui.components
Class ExpressionHelper
java.lang.Object
com.adobe.granite.ui.components.ExpressionHelper
A helper to deal with EL easier.
-
Constructor Summary
ConstructorsConstructorDescriptionExpressionHelper(ExpressionResolver resolver, PageContext pageContext) ExpressionHelper(ExpressionResolver resolver, SlingHttpServletRequest servletRequest) -
Method Summary
Modifier and TypeMethodDescription<T> TResolves the given expression.<T> TResolves the given expression, with the given locale.booleangetBoolean(String expression) Resolves the given expression as boolean.booleangetBoolean(String expression, Locale locale) Resolves the given expression as boolean, with the given locale.Resolves the given expression as string.Resolves the given expression as string, with the given locale.
-
Constructor Details
-
ExpressionHelper
-
ExpressionHelper
public ExpressionHelper(@Nonnull ExpressionResolver resolver, @Nonnull SlingHttpServletRequest servletRequest)
-
-
Method Details
-
getString
Resolves the given expression as string. Request's locale will be used.- Parameters:
expression- the expression to be resolved- Returns:
- the resolved expression as a string, or
nullwhen expression is
-
getString
Resolves the given expression as string, with the given locale.- Parameters:
expression- the expression to be resolvedlocale- the locale- Returns:
- the resolved expression as a string, or
nullwhen expression is
-
getBoolean
Resolves the given expression as boolean. Request's locale will be used.- Parameters:
expression- the expression to be resolved- Returns:
- the resolved expression as a boolean, or
nullwhen expression is
-
getBoolean
Resolves the given expression as boolean, with the given locale.- Parameters:
expression- the expression to be resolvedlocale- the locale- Returns:
- the resolved expression as a boolean, or
nullwhen expression is
-
get
Resolves the given expression. Request's locale will be used.- Type Parameters:
T- the type of the resolved expression- Parameters:
expression- the expression to be resolvedexpectedType- the expected type of the resolved expression- Returns:
- the resolved expression, or
nullwhen expression is
-
get
public <T> T get(@CheckForNull String expression, @Nonnull Locale locale, @Nonnull Class<T> expectedType) Resolves the given expression, with the given locale.- Type Parameters:
T- the type of the resolved expression- Parameters:
expression- the expression to be resolvedlocale- the localeexpectedType- the expected type of the resolved expression- Returns:
- the resolved expression, or
nullwhen expression is
-