Class ResolveContext<E extends java.lang.Exception>

  • Type Parameters:
    E - the exception type that can be thrown by the expansion function

    public final class ResolveContext<E extends java.lang.Exception>
    extends java.lang.Object
    The expression resolve context, which can be used to query the current expression key, write out expansions or default values, or perform validation.

    The expression context is not thread-safe and is not valid outside of the property expansion function body.

    Author:
    David M. Lloyd
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void expandDefault()
      Expand the default value to the current target string builder.
      void expandDefault​(java.lang.StringBuilder target)
      Expand the default value to the given string builder.
      java.lang.String getExpandedDefault()
      Expand the default value to a string.
      java.lang.String getKey()
      Get the expression resolution key, as a string.
      boolean hasDefault()
      Determine if the current expression has a default value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getKey

        public java.lang.String getKey()
                                throws E extends java.lang.Exception
        Get the expression resolution key, as a string. If the key contains an expression, it will have been expanded unless Expression.Flag.NO_RECURSE_KEY was given. The result is not cached and will be re-expanded every time this method is called.
        Returns:
        the expanded key (not null)
        Throws:
        E - if the recursive expansion threw an exception
        E extends java.lang.Exception
      • expandDefault

        public void expandDefault​(java.lang.StringBuilder target)
                           throws E extends java.lang.Exception
        Expand the default value to the given string builder. If the default value contains an expression, it will have been expanded unless Expression.Flag.NO_RECURSE_DEFAULT was given. The result is not cached and will be re-expanded every time this method is called.
        Parameters:
        target - the string builder target
        Throws:
        E - if the recursive expansion threw an exception
        E extends java.lang.Exception
      • expandDefault

        public void expandDefault()
                           throws E extends java.lang.Exception
        Expand the default value to the current target string builder. If the default value contains an expression, it will have been expanded unless Expression.Flag.NO_RECURSE_DEFAULT was given. The result is not cached and will be re-expanded every time this method is called.
        Throws:
        E - if the recursive expansion threw an exception
        E extends java.lang.Exception
      • getExpandedDefault

        public java.lang.String getExpandedDefault()
                                            throws E extends java.lang.Exception
        Expand the default value to a string. If the default value contains an expression, it will have been expanded unless Expression.Flag.NO_RECURSE_DEFAULT was given. The result is not cached and will be re-expanded every time this method is called.
        Returns:
        the expanded string (not null)
        Throws:
        E - if the recursive expansion threw an exception
        E extends java.lang.Exception
      • hasDefault

        public boolean hasDefault()
        Determine if the current expression has a default value.
        Returns:
        true if there is a default value, false otherwise