Package com.spotify.github.http
Class ImmutablePagination
- java.lang.Object
-
- com.spotify.github.http.ImmutablePagination
-
- All Implemented Interfaces:
Pagination
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutablePagination extends Object implements Pagination
Immutable implementation ofPagination.Use the builder to create immutable instances:
ImmutablePagination.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutablePagination.BuilderBuilds instances of typeImmutablePagination.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutablePagination.Builderbuilder()Creates a builder forImmutablePagination.static ImmutablePaginationcopyOf(Pagination instance)Creates an immutable copy of aPaginationvalue.Integercurrent()Current page number.booleanequals(Object another)This instance is equal to all instances ofImmutablePaginationthat have equal attribute values.inthashCode()Computes a hash code from attributes:current,last,previous,next.Integerlast()Last page number.Optional<Integer>next()Next page number.Optional<Integer>previous()Previous page number.StringtoString()Prints the immutable valuePaginationwith attribute values.ImmutablePaginationwithCurrent(Integer value)Copy the current immutable object by setting a value for thecurrentattribute.ImmutablePaginationwithLast(Integer value)Copy the current immutable object by setting a value for thelastattribute.ImmutablePaginationwithNext(int value)Copy the current immutable object by setting a present value for the optionalnextattribute.ImmutablePaginationwithNext(Optional<Integer> optional)Copy the current immutable object by setting an optional value for thenextattribute.ImmutablePaginationwithPrevious(int value)Copy the current immutable object by setting a present value for the optionalpreviousattribute.ImmutablePaginationwithPrevious(Optional<Integer> optional)Copy the current immutable object by setting an optional value for thepreviousattribute.
-
-
-
Method Detail
-
current
public Integer current()
Current page number.- Specified by:
currentin interfacePagination- Returns:
- page number
-
last
public Integer last()
Last page number.- Specified by:
lastin interfacePagination- Returns:
- page number
-
previous
public Optional<Integer> previous()
Previous page number.- Specified by:
previousin interfacePagination- Returns:
- page number
-
next
public Optional<Integer> next()
Next page number.- Specified by:
nextin interfacePagination- Returns:
- page number
-
withCurrent
public final ImmutablePagination withCurrent(Integer value)
Copy the current immutable object by setting a value for thecurrentattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for current- Returns:
- A modified copy of the
thisobject
-
withLast
public final ImmutablePagination withLast(Integer value)
Copy the current immutable object by setting a value for thelastattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for last- Returns:
- A modified copy of the
thisobject
-
withPrevious
public final ImmutablePagination withPrevious(int value)
Copy the current immutable object by setting a present value for the optionalpreviousattribute.- Parameters:
value- The value for previous- Returns:
- A modified copy of
thisobject
-
withPrevious
public final ImmutablePagination withPrevious(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thepreviousattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for previous- Returns:
- A modified copy of
thisobject
-
withNext
public final ImmutablePagination withNext(int value)
Copy the current immutable object by setting a present value for the optionalnextattribute.- Parameters:
value- The value for next- Returns:
- A modified copy of
thisobject
-
withNext
public final ImmutablePagination withNext(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thenextattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for next- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutablePaginationthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:current,last,previous,next.
-
toString
public String toString()
Prints the immutable valuePaginationwith attribute values.
-
copyOf
public static ImmutablePagination copyOf(Pagination instance)
Creates an immutable copy of aPaginationvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Pagination instance
-
builder
public static ImmutablePagination.Builder builder()
Creates a builder forImmutablePagination.ImmutablePagination.builder() .current(Integer) // requiredcurrent.last(Integer) // requiredlast.previous(Integer) // optionalprevious.next(Integer) // optionalnext.build();- Returns:
- A new ImmutablePagination builder
-
-