Package com.fauna.query.builder
Class QueryArr<E extends QueryFragment>
- java.lang.Object
-
- com.fauna.query.builder.QueryFragment<java.util.List<E>>
-
- com.fauna.query.builder.QueryArr<E>
-
- Type Parameters:
E- The type of elements in the QueryArr, which must be a subtype ofQueryFragment.
public final class QueryArr<E extends QueryFragment> extends QueryFragment<java.util.List<E>>
Represents a special type that allows Fauna to evaluate an array of individual queries, each of which will be processed, and its result will be an element in the returned array.Example usage:
var listOfQueries = List.of(fql("1 + 1"), fql("2 + 2"), fql("3 + 3"));Directly providing this list to a query will fail because it would be treated as aQueryVal. By wrapping it in aQueryArr, each query within the list will be evaluated separately:client.query(fql("${queries}", Map.of("queries", listOfQueries))); // Error: the list is treated as a single value. client.query(fql("${queries}", Map.of("queries", QueryArr.of(listOfQueries))); // Returns: [2, 4, 6]
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Checks if thisQueryArris equal to another object.java.util.List<E>get()Retrieves the encapsulated list of query fragments in thisQueryArr.java.util.List<E>getValue()Retrieves the encapsulated list directly.inthashCode()Returns the hash code of thisQueryArr, based on its encapsulated list of query fragments.static <E extends QueryFragment>
QueryArr<E>of(java.util.List<E> val)Static factory method to create a newQueryArrinstance.
-
-
-
Constructor Detail
-
QueryArr
public QueryArr(java.util.List<E> value)
Constructs aQueryArrwith the specified list of query fragments.- Parameters:
value- the list of query fragments to encapsulate.
-
-
Method Detail
-
of
public static <E extends QueryFragment> QueryArr<E> of(java.util.List<E> val)
Static factory method to create a newQueryArrinstance.- Type Parameters:
E- the type of elements in the list, which must extendQueryFragment.- Parameters:
val- the list ofQueryFragmentelements to wrap.- Returns:
- a new instance of
QueryArrencapsulating the provided list.
-
get
public java.util.List<E> get()
Retrieves the encapsulated list of query fragments in thisQueryArr.- Specified by:
getin classQueryFragment<java.util.List<E extends QueryFragment>>- Returns:
- the list of query fragments.
-
equals
public boolean equals(java.lang.Object o)
Checks if thisQueryArris equal to another object. TwoQueryArrobjects are equal if they contain the same list of query fragments.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the object to compare with.- Returns:
trueif the specified object is equal to thisQueryArr;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code of thisQueryArr, based on its encapsulated list of query fragments.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code of this object.
-
getValue
public java.util.List<E> getValue()
Retrieves the encapsulated list directly.- Returns:
- the encapsulated list of query fragments.
-
-