Class ExpressionHelper


  • public class ExpressionHelper
    extends java.lang.Object
    A helper to deal with EL easier.
    • 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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 resolved
        locale - 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 resolved
        locale - 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 resolved
        expectedType - 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 resolved
        locale - the locale
        expectedType - the expected type of the resolved expression
        Returns:
        the resolved expression, or null when expression is