Code Monkey home page Code Monkey logo

paging's Introduction

分页封装模型

用法

        List<String> content = new ArrayList<>(Arrays.asList("Reka", "雷卡", "Rachel", "瑞秋"));
        // 通过 Page.custom(List<T>) 得到创建者,随后通过创建者模式构造分页数据
        Page<String> page = Page.custom(content)
                                .pageOffset(1)
                                .pageSize(5)
                                // 根据 pageOffset、pageSize、content.size(),totalElements 被调整成 9
                                .totalElements(8)
                                .pagingNavigationNum(3)
                                .build();

        List<User> userContent = new ArrayList<>();
        userContent.add(new User("Reka", 23));
        userContent.add(new User("雷卡", 23));
        userContent.add(new User("Rachel", 22));
        userContent.add(new User("瑞秋", 22));
        Page<User> userPage = new Page.Builder<>(userContent)
                // pageRequest 的优先级高于 pagingNavigationNum、pageOffset、pageSize,随后这三项的配置不起作用
                .pageRequest(new PageRequest(3, 4, 4))
                .pagingNavigationNum(5)
                .totalElements(30)
                .pageOffset(3)
                .pageSize(7)
                .build();

paging's People

Contributors

reka-downey avatar rekadowney avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.