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
ConstructorsConstructorDescriptionProjectionQuery
(FilterCriteria<T> filter, org.springframework.data.domain.Pageable pageable) Creates an instance of aProjectionQuery
record class. -
Method Summary
Modifier and TypeMethodDescriptionOptional
<com.querydsl.core.types.Predicate> Converts the filter criteria into a QueryDSL Predicate.Converts the filter criteria into a JPA Specification.final boolean
Indicates whether some other object is "equal to" this one.filter()
Returns the value of thefilter
record component.final int
hashCode()
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
pageable()
Returns the value of thepageable
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ProjectionQuery
Creates an instance of aProjectionQuery
record class.- Parameters:
filter
- the value for thefilter
record componentpageable
- the value for thepageable
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 querypageable
- the pagination information for the query- Returns:
- a new ProjectionQuery instance
-
asSpecification
Converts the filter criteria into a JPA Specification.- Returns:
- an Optional containing the Specification if it can be created, otherwise empty.
-
asPredicate
Converts the filter criteria into a QueryDSL Predicate.- Returns:
- an Optional containing the Predicate if it can be created, otherwise empty.
-
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)
. -
filter
Returns the value of thefilter
record component.- Returns:
- the value of the
filter
record component
-
pageable
public org.springframework.data.domain.Pageable pageable()Returns the value of thepageable
record component.- Returns:
- the value of the
pageable
record component
-