Interface Expression

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <T extends Expression,​O>
      O
      apply​(Class<T> tClass, Function<T,​O> function)
      Applies the given function to this Expression treating it as an Expression of type T.
      default <T extends Expression>
      T
      as​(Class<T> tClass)
      Casts this Expression as the given Expression type
      Tag getType()
      Gets the tag associated with the Expression
      default boolean isInstance​(Tag... tags)
      Checks if this Expression's tag is an instance of any of the given tags
      default boolean isInstance​(Class<? extends Expression> tClass)
      Checks if this Expression is an instance of the given Expression type
      default boolean isInstance​(Class<? extends Expression> tClass, Tag type)
      Checks if this Expression is an instance of the given Expression type and the given Tag type
      default <T extends Expression>
      boolean
      when​(Class<T> tClass, Consumer<T> consumer)
      Applies the given consumer to the expression when it is an instance of the given expression type
      default <T extends Expression,​O>
      Optional<O>
      when​(Class<T> tClass, Function<T,​O> function)
      Applies the given function to the expression when it is an instance of the given expression type
    • Method Detail

      • apply

        default <T extends Expression,​O> O apply​(Class<T> tClass,
                                                       Function<T,​O> function)
        Applies the given function to this Expression treating it as an Expression of type T.
        Type Parameters:
        T - the expression type parameter
        O - the output type parameter
        Parameters:
        tClass - the class information of desired Expression type
        function - the function to process the expression
        Returns:
        the output of the function processing this expression
        Throws:
        IllegalStateException - if this Expression is not of type tClass
      • as

        default <T extends Expression> T as​(Class<T> tClass)
        Casts this Expression as the given Expression type
        Type Parameters:
        T - the expression type parameter
        Parameters:
        tClass - the class information of desired expression type
        Returns:
        the Expression as the given type
        Throws:
        IllegalStateException - if this Expression is not of type tClass
      • getType

        Tag getType()
        Gets the tag associated with the Expression
        Returns:
        the type
      • isInstance

        default boolean isInstance​(Class<? extends Expression> tClass)
        Checks if this Expression is an instance of the given Expression type
        Parameters:
        tClass - the class information of desired expression type
        Returns:
        True - if the expression is an instance of the given expression type, False otherwise
      • isInstance

        default boolean isInstance​(Class<? extends Expression> tClass,
                                   Tag type)
        Checks if this Expression is an instance of the given Expression type and the given Tag type
        Parameters:
        tClass - the class information of desired expression type
        type - the tag type
        Returns:
        True - if the expression is an instance of the given expression type and tag type, False otherwise
      • isInstance

        default boolean isInstance​(Tag... tags)
        Checks if this Expression's tag is an instance of any of the given tags
        Parameters:
        tags - the tags to check
        Returns:
        True - if the expression of any of the given tag , False otherwise
      • when

        default <T extends Expression,​O> Optional<O> when​(Class<T> tClass,
                                                                Function<T,​O> function)
        Applies the given function to the expression when it is an instance of the given expression type
        Type Parameters:
        T - the expression type parameter
        O - the output type parameter
        Parameters:
        tClass - the class information of desired Expression type
        function - the function to process the expression
        Returns:
        the Optional output of the function.
      • when

        default <T extends Expression> boolean when​(Class<T> tClass,
                                                    Consumer<T> consumer)
        Applies the given consumer to the expression when it is an instance of the given expression type
        Type Parameters:
        T - the expression type parameter
        Parameters:
        tClass - the class information of desired Expression type
        consumer - the consumer to process the expression
        Returns:
        True if consumer is applied, False otherwise