Package com.fauna.query.builder
Class Query
- java.lang.Object
-
- com.fauna.query.builder.QueryFragment<QueryFragment[]>
-
- com.fauna.query.builder.Query
-
public class Query extends QueryFragment<QueryFragment[]>
Represents a Fauna query that is constructed from fragments. This class allows the building of queries from literal and variable parts.
-
-
Constructor Summary
Constructors Constructor Description Query(java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> args)
Construct a Query from the given template String and args.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Query
fql(java.lang.String query)
Creates a Query instance from a String.static Query
fql(java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> args)
Creates a Query instance from a String and arguments.QueryFragment[]
get()
Retrieves the list of fragments that make up this query.
-
-
-
Constructor Detail
-
Query
public Query(java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> args) throws java.lang.IllegalArgumentException
Construct a Query from the given template String and args.- Parameters:
query
- A Fauna Query Language (FQL) v10 template string.args
- A map of variable names -> values.- Throws:
java.lang.IllegalArgumentException
-
-
Method Detail
-
fql
public static Query fql(java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> args) throws java.lang.IllegalArgumentException
Creates a Query instance from a String and arguments. The template strings can contain literals and variable placeholders.- Parameters:
query
- A Fauna Query Language (FQL) v10 template string.args
- A map of variable names -> values.- Returns:
- a Query instance representing the complete query.
- Throws:
java.lang.IllegalArgumentException
- if a template variable does not have a corresponding entry in the provided args.
-
fql
public static Query fql(java.lang.String query) throws java.lang.IllegalArgumentException
Creates a Query instance from a String. Without any args, the template string cannot contain variables.- Parameters:
query
- the string template of the query.- Returns:
- a Query instance representing the complete query.
- Throws:
java.lang.IllegalArgumentException
- if a template variable does not have a corresponding entry in the provided args.
-
get
public QueryFragment[] get()
Retrieves the list of fragments that make up this query.- Specified by:
get
in classQueryFragment<QueryFragment[]>
- Returns:
- an array of Fragments.
- Throws:
java.lang.IllegalArgumentException
- if a template variable does not have a corresponding entry in the provided args.
-
-