Package org.synchronoss.cpo.core
Record Class CpoQuery
java.lang.Object
java.lang.Record
org.synchronoss.cpo.core.CpoQuery
- Record Components:
groupName- The function group name; null selects the default groupwheres- The run-time where constraints, in the order addedorderBys- The orderings, in the order addednativeExpressions- The native expressions, in the order added
- All Implemented Interfaces:
Serializable
public record CpoQuery(String groupName, List<CpoWhere> wheres, List<CpoOrderBy> orderBys, List<CpoNativeFunction> nativeExpressions)
extends Record
implements Serializable
The clauses of a
CpoAdapter operation: the function group to run plus any run-time where
constraints, orderings, and native expressions. A CpoQuery replaces the telescoping method
overloads that previously carried these as positional parameters.
Instances are immutable — every accumulator returns a new CpoQuery — so a query may be built once, held in a constant, and shared freely between threads:
Stream<ValueObject> beans =
adapter.retrieveBeans(CpoQuery.group("byDept").where(w).orderBy(ob), criteria);
- Author:
- david berry
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCpoQuery(String groupName, List<CpoWhere> wheres, List<CpoOrderBy> orderBys, List<CpoNativeFunction> nativeExpressions) Creates an instance of aCpoQueryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic CpoQueryA query against the default (unnamed) function group.final booleanIndicates whether some other object is "equal to" this one.static CpoQueryA query against the named function group.Returns the value of thegroupNamerecord component.final inthashCode()Returns a hash code value for this object.nativeExpression(CpoNativeFunction nativeExpression) Adds a native expression that augments the expression stored in the metadata.Returns the value of thenativeExpressionsrecord component.nativeExpressions(Collection<CpoNativeFunction> nativeExpressions) Adds a collection of native expressions.orderBy(CpoOrderBy orderBy) Adds an ordering.orderBys()Returns the value of theorderBysrecord component.orderBys(Collection<CpoOrderBy> orderBys) Adds a collection of orderings.final StringtoString()Returns a string representation of this record class.Adds a where constraint.wheres()Returns the value of thewheresrecord component.wheres(Collection<CpoWhere> wheres) Adds a collection of where constraints.
-
Constructor Details
-
CpoQuery
public CpoQuery(String groupName, List<CpoWhere> wheres, List<CpoOrderBy> orderBys, List<CpoNativeFunction> nativeExpressions) Creates an instance of aCpoQueryrecord class.- Parameters:
groupName- the value for thegroupNamerecord componentwheres- the value for thewheresrecord componentorderBys- the value for theorderBysrecord componentnativeExpressions- the value for thenativeExpressionsrecord component
-
-
Method Details
-
group
A query against the named function group.- Parameters:
groupName- The function group name; null signifies the default group- Returns:
- A CpoQuery with no clauses
-
defaultGroup
A query against the default (unnamed) function group.- Returns:
- A CpoQuery with no clauses
-
where
Adds a where constraint.- Parameters:
where- The constraint to add; null is ignored- Returns:
- A new CpoQuery with the constraint appended
-
wheres
Adds a collection of where constraints.- Parameters:
wheres- The constraints to add; null or empty is ignored- Returns:
- A new CpoQuery with the constraints appended
-
orderBy
Adds an ordering.- Parameters:
orderBy- The ordering to add; null is ignored- Returns:
- A new CpoQuery with the ordering appended
-
orderBys
Adds a collection of orderings.- Parameters:
orderBys- The orderings to add; null or empty is ignored- Returns:
- A new CpoQuery with the orderings appended
-
nativeExpression
Adds a native expression that augments the expression stored in the metadata.- Parameters:
nativeExpression- The native expression to add; null is ignored- Returns:
- A new CpoQuery with the native expression appended
-
nativeExpressions
Adds a collection of native expressions.- Parameters:
nativeExpressions- The native expressions to add; null or empty is ignored- Returns:
- A new CpoQuery with the native expressions appended
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
groupName
Returns the value of thegroupNamerecord component.- Returns:
- the value of the
groupNamerecord component
-
wheres
Returns the value of thewheresrecord component.- Returns:
- the value of the
wheresrecord component
-
orderBys
Returns the value of theorderBysrecord component.- Returns:
- the value of the
orderBysrecord component
-
nativeExpressions
Returns the value of thenativeExpressionsrecord component.- Returns:
- the value of the
nativeExpressionsrecord component
-