java.lang.Object
org.litebridge.orm.engine.compiler.QueryCompiler
Compiler for AST query nodes.
The compiler processes query node chains and producing PreparedOperation instances from them.
This class acts as a root-level query compiler that delegates responsibility to specialised compilers for different query types.
Specialised compilers are lazily initialised and maintained as private fields to ensure their reuse and improve performance.
This class is thread-safe.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQueryCompiler(LitebridgeContext litebridgeContext) Constructs a new QueryCompiler instance. -
Method Summary
Modifier and TypeMethodDescriptionCompiles a given query node into a prepared operation.compile(QueryNode node, @Nullable List<SelectTarget> contextSelectTargets) Flattens the linked query node chain into a sequential list in root-to-leaf order.
-
Field Details
-
litebridgeContext
The Litebridge context.
-
-
Constructor Details
-
QueryCompiler
Constructs a new QueryCompiler instance.- Parameters:
litebridgeContext- Current Litebridge context.
-
-
Method Details
-
compile
Compiles a given query node into a prepared operation.This method resolves the appropriate query compiler for the root query node type and applies all nodes in the query chain to create a structured database operation along with its associated bind values.
- Parameters:
node- the query node to be compiled- Returns:
- a
PreparedOperationcontaining the structured operation and bind values - Throws:
IllegalArgumentException- if the root query node type is unsupported
-
compile
-
flatten
Flattens the linked query node chain into a sequential list in root-to-leaf order.- Parameters:
node- the terminal query node- Returns:
- the ordered list of query nodes
-