-
Notifications
You must be signed in to change notification settings - Fork 682
Introduce Limit
type
#2836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Limit
type
#2836
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor findings.
|
||
|=== | ||
|
||
The `Top` keyword used to limit results can be used to along with `Pageable` whereas `Top` defines the total maximum of results, whereas the Pageable parameter may reduce this this number. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double "this this"?
@@ -290,6 +264,41 @@ public String toString() { | |||
return method.toString(); | |||
} | |||
|
|||
public void validate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor findings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, seconding what Ollie said.
/** | ||
* @return {@literal true} if no limiting (maximum value) should be applied. | ||
*/ | ||
default boolean isUnlimited() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also have a isLimited()
method.
@@ -24,6 +24,7 @@ | |||
* | |||
* @author Oliver Gierke | |||
* @author Mark Paluch | |||
* @author Christoph Strobl | |||
*/ | |||
public interface Pageable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a toLimit()
method as well, similar to toScrollPosition()
?
That's merged and polished now. |
Limit
can be used asParameter
within repository query methods to define the maximum number of results to be returned.The default
ParameterAccessor
implementation will pick upLimit
andSort
to assemble aPageable
out of the provided values if present to provide out of the box support for modules usingParameterAcessor#getPageable()
to apply order and limit.Limit#max
is aligned toPage.size
, both usingint
. We might want to considerlong
forLimit
and error if the actual value exceeds thePage
one when assembling thePageable
.