Package com.aerospike.dsl.visitor
Class VisitorUtils
java.lang.Object
com.aerospike.dsl.visitor.VisitorUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.aerospike.client.cdt.CTX[]buildCtx(AbstractPart path) Builds an array ofCTXfor a given path.static AbstractPartbuildExpr(ExpressionContainer expr, PlaceholderValues placeholderValues, Map<String, List<Index>> indexes) static voidtraverseTree(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.static voidtraverseTree(AbstractPart part, Consumer<AbstractPart> visitor, Predicate<AbstractPart> stopCondition) Traverses the AbstractPart nodes tree and applies the visitor function to each node.
-
Constructor Details
-
VisitorUtils
public VisitorUtils()
-
-
Method Details
-
buildExpr
public static AbstractPart buildExpr(ExpressionContainer expr, PlaceholderValues placeholderValues, Map<String, List<Index>> indexes) Builds a secondary indexFilterand a filterExpfor a givenExpressionContainer. This is the main entry point for enriching the parsed expression tree with query filters.- Parameters:
expr- TheExpressionContainerrepresenting the expression treeplaceholderValues- ThePlaceholderValuesto match with placeholders by indexindexes- A map of available secondary indexes, keyed by bin name- Returns:
- The updated
ExpressionContainerwith the generatedFilterandExp. Either of them can be null if there is no suitable filter
-
buildCtx
Builds an array ofCTXfor a given path. This is the main entry point for building context based on the parsed expression tree.- Parameters:
path- TheAbstractPartrepresenting the path- Returns:
- Array of
CTXobjects 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 nodestopCondition- 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 nodedepth- The depth to limit traversing at
-