Package com.adobe.granite.ui.components
Class ExpressionHelper
- java.lang.Object
-
- com.adobe.granite.ui.components.ExpressionHelper
-
public class ExpressionHelper extends 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(String expression, Class<T> expectedType)
Resolves the given expression.<T> T
get(String expression, Locale locale, Class<T> expectedType)
Resolves the given expression, with the given locale.boolean
getBoolean(String expression)
Resolves the given expression as boolean.boolean
getBoolean(String expression, Locale locale)
Resolves the given expression as boolean, with the given locale.String
getString(String expression)
Resolves the given expression as string.String
getString(String expression, 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 String getString(@CheckForNull 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 String getString(@CheckForNull String expression, @Nonnull 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 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 String expression, @Nonnull 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 String expression, @Nonnull 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 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
null
when expression is
-
-