Class VisitorUtils

java.lang.Object
com.aerospike.dsl.visitor.VisitorUtils

public class VisitorUtils extends Object
  • Constructor Details

    • VisitorUtils

      public VisitorUtils()
  • Method Details

    • buildExpr

      public static AbstractPart buildExpr(ExpressionContainer expr, PlaceholderValues placeholderValues, Map<String,List<Index>> indexes)
      Builds a secondary index Filter and a filter Exp for a given ExpressionContainer. This is the main entry point for enriching the parsed expression tree with query filters.
      Parameters:
      expr - The ExpressionContainer representing the expression tree
      placeholderValues - The PlaceholderValues to match with placeholders by index
      indexes - A map of available secondary indexes, keyed by bin name
      Returns:
      The updated ExpressionContainer with the generated Filter and Exp. Either of them can be null if there is no suitable filter
    • buildCtx

      public static com.aerospike.client.cdt.CTX[] buildCtx(AbstractPart path)
      Builds an array of CTX for a given path. This is the main entry point for building context based on the parsed expression tree.
      Parameters:
      path - The AbstractPart representing the path
      Returns:
      Array of CTX objects representing the context, or null
      Throws:
      UnsupportedOperationException - If the given input expression is not a path, or if it has path function
    • traverseTree

      public static void traverseTree(AbstractPart part, Consumer<AbstractPart> visitor, Predicate<AbstractPart> stopCondition)
      Traverses the AbstractPart nodes tree and applies the visitor function to each node. Uses a pre-order traversal (top-down, root-left-right). The visitor function can be used to modify the node's state or to extract information.
      Parameters:
      part - The current node being visited (start with the root)
      visitor - The function to apply to each AbstractPart node
      stopCondition - The condition that causes stop of traversing
    • traverseTree

      public static void traverseTree(AbstractPart part, Consumer<AbstractPart> visitor, int depth, Predicate<AbstractPart> stopCondition)
      Traverses the AbstractPart nodes tree and applies the visitor function to each node with limited depth. Uses a pre-order traversal (root-left-right). The visitor function can be used to modify the node's state or to extract information.
      Parameters:
      part - The current node being visited (start with the root)
      visitor - The function to apply to each AbstractPart node
      depth - The depth to limit traversing at