Class ImmutablePagination.Builder

  • Enclosing class:
    ImmutablePagination

    @NotThreadSafe
    public static final class ImmutablePagination.Builder
    extends Object
    Builds instances of type ImmutablePagination. Initialize attributes and then invoke the build() method to create an immutable instance.

    Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

    • Method Detail

      • from

        @CanIgnoreReturnValue
        public final ImmutablePagination.Builder from​(Pagination instance)
        Fill a builder with attribute values from the provided Pagination instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • current

        @CanIgnoreReturnValue
        public final ImmutablePagination.Builder current​(Integer current)
        Initializes the value for the current attribute.
        Parameters:
        current - The value for current
        Returns:
        this builder for use in a chained invocation
      • last

        @CanIgnoreReturnValue
        public final ImmutablePagination.Builder last​(Integer last)
        Initializes the value for the last attribute.
        Parameters:
        last - The value for last
        Returns:
        this builder for use in a chained invocation
      • previous

        @CanIgnoreReturnValue
        public final ImmutablePagination.Builder previous​(int previous)
        Initializes the optional value previous to previous.
        Parameters:
        previous - The value for previous
        Returns:
        this builder for chained invocation
      • previous

        @CanIgnoreReturnValue
        public final ImmutablePagination.Builder previous​(Optional<Integer> previous)
        Initializes the optional value previous to previous.
        Parameters:
        previous - The value for previous
        Returns:
        this builder for use in a chained invocation
      • next

        @CanIgnoreReturnValue
        public final ImmutablePagination.Builder next​(int next)
        Initializes the optional value next to next.
        Parameters:
        next - The value for next
        Returns:
        this builder for chained invocation
      • next

        @CanIgnoreReturnValue
        public final ImmutablePagination.Builder next​(Optional<Integer> next)
        Initializes the optional value next to next.
        Parameters:
        next - The value for next
        Returns:
        this builder for use in a chained invocation