Package com.adobe.granite.ui.components
Class ExpressionHelper
- java.lang.Object
-
- com.adobe.granite.ui.components.ExpressionHelper
-
public class ExpressionHelper extends java.lang.Object
A helper to deal with EL easier.
-
-
Constructor Summary
Constructors Constructor Description ExpressionHelper(ExpressionResolver resolver, PageContext pageContext)
ExpressionHelper(ExpressionResolver resolver, SlingHttpServletRequest servletRequest)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
get(java.lang.String expression, java.lang.Class<T> expectedType)
Resolves the given expression.<T> T
get(java.lang.String expression, java.util.Locale locale, java.lang.Class<T> expectedType)
Resolves the given expression, with the given locale.boolean
getBoolean(java.lang.String expression)
Resolves the given expression as boolean.boolean
getBoolean(java.lang.String expression, java.util.Locale locale)
Resolves the given expression as boolean, with the given locale.java.lang.String
getString(java.lang.String expression)
Resolves the given expression as string.java.lang.String
getString(java.lang.String expression, java.util.Locale locale)
Resolves the given expression as string, with the given locale.
-
-
-
Constructor Detail
-
ExpressionHelper
public ExpressionHelper(@Nonnull ExpressionResolver resolver, @Nonnull PageContext pageContext)
-
ExpressionHelper
public ExpressionHelper(@Nonnull ExpressionResolver resolver, @Nonnull SlingHttpServletRequest servletRequest)
-
-
Method Detail
-
getString
public java.lang.String getString(@CheckForNull java.lang.String expression)
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
null
when expression is
-
getString
public java.lang.String getString(@CheckForNull java.lang.String expression, @Nonnull java.util.Locale locale)
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
null
when expression is
-
getBoolean
public boolean getBoolean(@CheckForNull java.lang.String expression)
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
null
when expression is
-
getBoolean
public boolean getBoolean(@CheckForNull java.lang.String expression, @Nonnull java.util.Locale locale)
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
null
when expression is
-
get
public <T> T get(@CheckForNull java.lang.String expression, @Nonnull java.lang.Class<T> expectedType)
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
null
when expression is
-
get
public <T> T get(@CheckForNull java.lang.String expression, @Nonnull java.util.Locale locale, @Nonnull java.lang.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
null
when expression is
-
-