Java Request parameter Class QueryParameter

Source: Internet
Author: User

ImportJava.util.HashMap;ImportJava.util.Map;Importorg.apache.commons.lang.StringUtils;/*** Request Parameter class **/ Public classQueryParameter { Public Static FinalString ASC = "ASC";  Public Static FinalString desc = "desc"; protected intPageNo = 1; protected intPageSize = 1; protectedString by =NULL; protectedString order = "ASC"; protected BooleanAutocount =false; protectedMap<string, string> alias =NewHashmap<string, string>();  Public intgetpagesize () {return  This. pageSize; }     Public voidSetPageSize (intpageSize) {        if(PageSize < 1) {pageSize= 1; }         This. pageSize =pageSize; }     Public Booleanispagesizesetted () {return( This. pageSize >-1); }     Public intGetpageno () {return  This. PageNo; }     Public voidSetpageno (intPageNo) {        if(PageNo < 1) {PageNo= 1; }             This. PageNo =PageNo; }     Public intGetFirst () {if(( This. pageno < 1) | | ( This. pageSize < 1)){            return1; }        return(( This. pageNo-1) * This. pageSize) + 1; }     Public Booleanisfirstsetted () {return(( This. pageno > 0) && ( This. pageSize > 0)); }     PublicString Getorderby () {return  This. by; }     Public voidSetorderby (String by) { This. by =A . }     Public Booleanisorderbysetted () {returnStringutils.isnotblank ( This.); }     PublicString GetOrder () {return  This. Order; }     Public voidSetorder (String order) {Order=stringutils.lowercase (order); string[] Orders= Stringutils.split (Order, ', '));  for(String orderstr:orders) {if(! Stringutils.equals (DESC, orderstr) &&!stringutils.equals (ASC, orderstr))Throw NewIllegalArgumentException ("Sort direction" + Orderstr + "not legal value"); }         This. Order =Order.trim (); }     Public BooleanIsautocount () {return  This. Autocount; }     Public voidSetautocount (BooleanAutocount) {         This. Autocount =Autocount; }     Public voidAddalias (string name, string alias) { This. Alias.put (name, alias); }     Public BooleanHasalias () {return(! ( This. Alias.isempty ())); }     PublicMap<string, string>Getalias () {return  This. alias; }}

Java Request parameter Class QueryParameter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.