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 group
wheres - The run-time where constraints, in the order added
orderBys - The orderings, in the order added
nativeExpressions - 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 Details

  • Method Details

    • group

      public static CpoQuery group(String groupName)
      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

      public static CpoQuery defaultGroup()
      A query against the default (unnamed) function group.
      Returns:
      A CpoQuery with no clauses
    • where

      public CpoQuery where(CpoWhere where)
      Adds a where constraint.
      Parameters:
      where - The constraint to add; null is ignored
      Returns:
      A new CpoQuery with the constraint appended
    • wheres

      public CpoQuery wheres(Collection<CpoWhere> 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

      public CpoQuery orderBy(CpoOrderBy orderBy)
      Adds an ordering.
      Parameters:
      orderBy - The ordering to add; null is ignored
      Returns:
      A new CpoQuery with the ordering appended
    • orderBys

      public CpoQuery orderBys(Collection<CpoOrderBy> 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

      public CpoQuery nativeExpression(CpoNativeFunction 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

      public CpoQuery nativeExpressions(Collection<CpoNativeFunction> 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • groupName

      public String groupName()
      Returns the value of the groupName record component.
      Returns:
      the value of the groupName record component
    • wheres

      public List<CpoWhere> wheres()
      Returns the value of the wheres record component.
      Returns:
      the value of the wheres record component
    • orderBys

      public List<CpoOrderBy> orderBys()
      Returns the value of the orderBys record component.
      Returns:
      the value of the orderBys record component
    • nativeExpressions

      public List<CpoNativeFunction> nativeExpressions()
      Returns the value of the nativeExpressions record component.
      Returns:
      the value of the nativeExpressions record component