Enum Class AstTraversalDirection

java.lang.Object
java.lang.Enum<AstTraversalDirection>
org.mule.runtime.ast.api.util.AstTraversalDirection
All Implemented Interfaces:
Serializable, Comparable<AstTraversalDirection>, Constable

public enum AstTraversalDirection extends Enum<AstTraversalDirection>
Strategy use to navigates the whole AST
Since:
1.0.0
  • Enum Constant Details

    • TOP_DOWN

      public static final AstTraversalDirection TOP_DOWN
      Navigate the whole AST from top down.

      e.g Given following ComponentAst:

      • root
        • component-1
          • component-1.1
        • component-2
          • component-2.1
            • component-2.1.1
          • component-2.2

      Will navigate ComponentAst through:

      • root
      • component-1
      • component-1.1
      • component-2
      • component-2.1
      • component-2.1.1
      • component-2
    • BOTTOM_UP

      public static final AstTraversalDirection BOTTOM_UP
      Navigate the whole AST from top down.

      e.g Given following ComponentAst:

      • root
        • component-1
          • component-1.1
        • component-2
          • component-2.1
            • component-2.1.1
          • component-2.2

      Will navigate ComponentAst through:

      • component-1.1
      • component-1
      • component-2.1.1
      • component-2.1
      • component-2.2
      • component-2
      • root
  • Method Details

    • values

      public static AstTraversalDirection[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AstTraversalDirection valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • recursiveSpliterator

      public abstract Spliterator<ComponentAst> recursiveSpliterator(ComponentAst component)
      Creates a Spliterator for a ComponentAst that travers through this ComponentAst and its children recursively by current AstTraversalDirection.
      Parameters:
      component - the ComponentAst to navigate.
      Returns:
      a Spliterator for this component and its children recursively that navigates the whole AST by current AstTraversalDirection.
    • recursiveStreamWithHierarchy

      public Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> recursiveStreamWithHierarchy(Stream<ComponentAst> components)
      Enhances the Stream by adding hierarchy context to each ComponentAst.

      The Stream is traversed in AstTraversalDirection direction

      The elements of the Stream are Pairs:

      • the first element is the same component that would be obtained by calling ArtifactAst.recursiveStream().
      • the second element is the hierarchy that was traversed to get to the first element, the first element being a root and the last being the direct parent of the first element of the pair.
      Parameters:
      components - the Stream to enrich.
      Returns:
      an enhanced Stream with hierarchy context.
    • recursiveStreamWithHierarchy

      public Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> recursiveStreamWithHierarchy(Stream<ComponentAst> components, boolean ignoreParameterComplexValues)
      Enhances the Stream by adding hierarchy context to each ComponentAst.

      The Stream is traversed in AstTraversalDirection direction

      The elements of the Stream are Pairs:

      • the first element is the same component that would be obtained by calling ArtifactAst.recursiveStream().
      • the second element is the hierarchy that was traversed to get to the first element, the first element being a root and the last being the direct parent of the first element of the pair.
      Parameters:
      components - the Stream to enrich.
      ignoreParameterComplexValues - whether the returned Stream will contain any complex values in component parameters.
      Returns:
      an enhanced Stream with hierarchy context.
    • recursiveStreamWithHierarchy

      public Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> recursiveStreamWithHierarchy(Stream<ComponentAst> components, List<ComponentAst> commonAncestors)
      Enhances the Stream by adding hierarchy context to each ComponentAst.

      The Stream is traversed in AstTraversalDirection direction

      The elements of the Stream are Pairs:

      • the first element is the same component that would be obtained by calling ArtifactAst.recursiveStream().
      • the second element is the hierarchy that was traversed to get to the first element, the first element being a root and the last being the direct parent of the first element of the pair.
      Parameters:
      components - the Stream to enrich.
      commonAncestors - any ComponentAst hierarchy that is common for all the components in the provided components.
      Returns:
      an enhanced Stream with hierarchy context.
    • recursiveStreamWithHierarchy

      public Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> recursiveStreamWithHierarchy(Stream<ComponentAst> components, List<ComponentAst> commonAncestors, boolean ignoreParameterComplexValues)
      Enhances the Stream by adding hierarchy context to each ComponentAst.

      The Stream is traversed in AstTraversalDirection direction

      The elements of the Stream are Pairs:

      • the first element is the same component that would be obtained by calling ArtifactAst.recursiveStream().
      • the second element is the hierarchy that was traversed to get to the first element, the first element being a root and the last being the direct parent of the first element of the pair.
      Parameters:
      components - the Stream to enrich.
      commonAncestors - any ComponentAst hierarchy that is common for all the components in the provided components.
      ignoreParameterComplexValues - whether the returned Stream will contain any complex values in component parameters.
      Returns:
      an enhanced Stream with hierarchy context.