Record Class ProjectionQuery<T>

java.lang.Object
java.lang.Record
nl.datasteel.crudcraft.projection.api.ProjectionQuery<T>

public record ProjectionQuery<T>(FilterCriteria<T> filter, org.springframework.data.domain.Pageable pageable) extends Record
Encapsulates filtering and paging information for a projection query.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ProjectionQuery(FilterCriteria<T> filter, org.springframework.data.domain.Pageable pageable)
    Creates an instance of a ProjectionQuery record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<com.querydsl.core.types.Predicate>
    Converts the filter criteria into a QueryDSL Predicate.
    Optional<org.springframework.data.jpa.domain.Specification<T>>
    Converts the filter criteria into a JPA Specification.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the filter record component.
    final int
    Returns a hash code value for this object.
    static <T> ProjectionQuery<T>
    of(FilterCriteria<T> filter, org.springframework.data.domain.Pageable pageable)
    Creates a new ProjectionQuery with the specified filter criteria and pageable.
    org.springframework.data.domain.Pageable
    Returns the value of the pageable record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ProjectionQuery

      public ProjectionQuery(FilterCriteria<T> filter, org.springframework.data.domain.Pageable pageable)
      Creates an instance of a ProjectionQuery record class.
      Parameters:
      filter - the value for the filter record component
      pageable - the value for the pageable record component
  • Method Details

    • of

      public static <T> ProjectionQuery<T> of(FilterCriteria<T> filter, org.springframework.data.domain.Pageable pageable)
      Creates a new ProjectionQuery with the specified filter criteria and pageable.
      Type Parameters:
      T - the type of the entity being queried
      Parameters:
      filter - the filter criteria to apply to the query
      pageable - the pagination information for the query
      Returns:
      a new ProjectionQuery instance
    • asSpecification

      public Optional<org.springframework.data.jpa.domain.Specification<T>> asSpecification()
      Converts the filter criteria into a JPA Specification.
      Returns:
      an Optional containing the Specification if it can be created, otherwise empty.
    • asPredicate

      public Optional<com.querydsl.core.types.Predicate> asPredicate()
      Converts the filter criteria into a QueryDSL Predicate.
      Returns:
      an Optional containing the Predicate if it can be created, otherwise empty.
    • 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.
    • filter

      public FilterCriteria<T> filter()
      Returns the value of the filter record component.
      Returns:
      the value of the filter record component
    • pageable

      public org.springframework.data.domain.Pageable pageable()
      Returns the value of the pageable record component.
      Returns:
      the value of the pageable record component