Record Class PageResult
java.lang.Object
java.lang.Record
org.gcube.informationsystem.resourceregistry.pep.PageResult
- Record Components:
json- serialized JSON array for the current pagelimit- effective page size (>= 1)offset- zero-based start index (>= 0)hasNext- whether a further page exists beyond this one
Carries a single page of serialized JSON results together with the
pagination context needed by the REST layer to emit
Link headers.
json— the serialized JSON array for the current page (at mostlimititems)limit— the effective page size used for this requestoffset— the zero-based start index of this pagehasNext— whether a further page exists beyond this one
hasNext must be computed by the caller from the pre-truncation
fetch size (e.g. the "peek +1" strategy: fetch limit + 1 items,
hasNext = fetched.size() > limit, then truncate to limit
before building this record). It must not be re-derived from
json.size() == limit, since a last page that happens to be exactly
limit items long is indistinguishable from a full intermediate page
under that heuristic.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
ConstructorsConstructorDescriptionPageResult(String json, int limit, int offset, boolean hasNext) Creates an instance of aPageResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhasNext()Returns the value of thehasNextrecord component.json()Returns the value of thejsonrecord component.intlimit()Returns the value of thelimitrecord component.intoffset()Returns the value of theoffsetrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
json
Returns the value of thejsonrecord component.- Returns:
- the value of the
jsonrecord component
-
limit
public int limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-
offset
public int offset()Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-
hasNext
public boolean hasNext()Returns the value of thehasNextrecord component.- Returns:
- the value of the
hasNextrecord component
-