Class ImmutablePagination

  • All Implemented Interfaces:
    Pagination

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutablePagination
    extends Object
    implements Pagination
    Immutable implementation of Pagination.

    Use the builder to create immutable instances: ImmutablePagination.builder().

    • Method Detail

      • current

        public Integer current()
        Current page number.
        Specified by:
        current in interface Pagination
        Returns:
        page number
      • last

        public Integer last()
        Last page number.
        Specified by:
        last in interface Pagination
        Returns:
        page number
      • withCurrent

        public final ImmutablePagination withCurrent​(Integer value)
        Copy the current immutable object by setting a value for the current attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for current
        Returns:
        A modified copy of the this object
      • withLast

        public final ImmutablePagination withLast​(Integer value)
        Copy the current immutable object by setting a value for the last attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for last
        Returns:
        A modified copy of the this object
      • withPrevious

        public final ImmutablePagination withPrevious​(int value)
        Copy the current immutable object by setting a present value for the optional previous attribute.
        Parameters:
        value - The value for previous
        Returns:
        A modified copy of this object
      • withPrevious

        public final ImmutablePagination withPrevious​(Optional<Integer> optional)
        Copy the current immutable object by setting an optional value for the previous attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for previous
        Returns:
        A modified copy of this object
      • withNext

        public final ImmutablePagination withNext​(int value)
        Copy the current immutable object by setting a present value for the optional next attribute.
        Parameters:
        value - The value for next
        Returns:
        A modified copy of this object
      • withNext

        public final ImmutablePagination withNext​(Optional<Integer> optional)
        Copy the current immutable object by setting an optional value for the next attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for next
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutablePagination that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: current, last, previous, next.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value Pagination with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • copyOf

        public static ImmutablePagination copyOf​(Pagination instance)
        Creates an immutable copy of a Pagination value. 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