Class Page.Builder

  • Enclosing class:
    Page

    public static class Page.Builder
    extends Object
    The page builder. Use Page.with() to get started.
    Author:
    Bauke Scholtz
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • range

        public Page.Builder range​(int offset,
                                  int limit)
        Set the range.
        Parameters:
        offset - Zero-based offset of the page. May not be negative. Defaults to 0.
        limit - Maximum amount of records to be matched. May not be less than 1. Defaults to Integer.MAX_VALUE.
        Returns:
        This builder.
        Throws:
        IllegalStateException - When another offset and limit is already set in this builder.
      • orderBy

        public Page.Builder orderBy​(String field,
                                    boolean ascending)
        Set the ordering. This can be invoked multiple times and will be remembered in same order. The default ordering is {"id",false}.
        Parameters:
        field - The field.
        ascending - Whether to sort ascending.
        Returns:
        This builder.
      • allMatch

        public Page.Builder allMatch​(Map<String,​Object> requiredCriteria)
        Set the required criteria. Map key represents property path and map value represents criteria. Each entity must match all of given criteria.
        Parameters:
        requiredCriteria - Required criteria.
        Returns:
        This builder.
        Throws:
        IllegalStateException - When another required criteria is already set in this builder.
        See Also:
        Criteria
      • anyMatch

        public Page.Builder anyMatch​(Map<String,​Object> optionalCriteria)
        Set the optional criteria. Map key represents property path and map value represents criteria. Each entity must match at least one of given criteria.
        Parameters:
        optionalCriteria - Optional criteria.
        Returns:
        This builder.
        Throws:
        IllegalStateException - When another optional criteria is already set in this builder.
        See Also:
        Criteria
      • build

        public Page build()
        Build the page.
        Returns:
        The built page.