|
|
|
@ -24,16 +24,17 @@ import org.springframework.lang.Nullable; |
|
|
|
* defining the {@link #max() maximum} number of results within a repository finder method or if applicable a template |
|
|
|
* defining the {@link #max() maximum} number of results within a repository finder method or if applicable a template |
|
|
|
* operation. |
|
|
|
* operation. |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* A {@link Limit#isUnlimited()} is used to indicate that there is no {@link Limit} defined, which should be favoured |
|
|
|
* A {@link Limit#isUnlimited()} is used to indicate that there is no {@link Limit} defined, which should be favored |
|
|
|
* over using {@literal null} or {@link java.util.Optional#empty()} to indicate the absence of an actual {@link Limit}. |
|
|
|
* over using {@literal null} or {@link java.util.Optional#empty()} to indicate the absence of an actual {@link Limit}. |
|
|
|
* </p> |
|
|
|
* </p> |
|
|
|
* {@link Limit} itself does not make assumptions about the actual {@link #max()} value sign. This means that a negative |
|
|
|
* {@link Limit} itself does not make assumptions about the actual {@link #max()} value sign. This means that a negative |
|
|
|
* value may be valid within a defined context. |
|
|
|
* value may be valid within a defined context. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Christoph Strobl |
|
|
|
* @author Christoph Strobl |
|
|
|
|
|
|
|
* @author Oliver Drotbohm |
|
|
|
* @since 3.2 |
|
|
|
* @since 3.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public sealed interface Limit permits Limited,Unlimited { |
|
|
|
public sealed interface Limit permits Limited, Unlimited { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return a {@link Limit} instance that does not define {@link #max()} and answers {@link #isUnlimited()} with |
|
|
|
* @return a {@link Limit} instance that does not define {@link #max()} and answers {@link #isUnlimited()} with |
|
|
|
@ -89,7 +90,7 @@ public sealed interface Limit permits Limited,Unlimited { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean equals(Object obj) { |
|
|
|
public boolean equals(@Nullable Object obj) { |
|
|
|
|
|
|
|
|
|
|
|
if (obj == null) { |
|
|
|
if (obj == null) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
@ -109,7 +110,7 @@ public sealed interface Limit permits Limited,Unlimited { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int hashCode() { |
|
|
|
public int hashCode() { |
|
|
|
return max ^ (max >>> 32); |
|
|
|
return max ^ max >>> 32; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -129,6 +130,5 @@ public sealed interface Limit permits Limited,Unlimited { |
|
|
|
public boolean isLimited() { |
|
|
|
public boolean isLimited() { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|