[Sharing of dry goods] General tools and general tools for dry goods

Source: Internet
Author: User

[Sharing of dry goods] General tools and general tools for dry goods

In actual project practice, both business coding and general coding will always summarize some common tool classes.

Put it into the project once and for all, so that the brothers and sisters do not write repeated code.

After the baptism of several projects, the company's R & D team has accumulated many common tools.

Take the time to summarize the exquisite and elegant tools scattered in multiple projects to form a project.

GitHub: https://github.com/OrsonEx/tool

Because the company's R & D team is everywhere, or leaves the company due to work, or changes between new and old ....

It is difficult to identify who owns some classes after polishing, but the code has been quietly lying in the project with his/her wishes.

The project is built using Maven. Only two jar files of Apache-Common are introduced.

       <dependency>            <groupId>commons-lang</groupId>            <artifactId>commons-lang</artifactId>            <version>2.6</version>        </dependency>        <dependency>            <groupId>commons-codec</groupId>            <artifactId>commons-codec</artifactId>            <version>1.10</version>        </dependency>

You can paste the tool classes in the project into your project. Of course, you can also export them as jar (the jar output is only 79KB) to the project.

Engineering Overview
  • ArrayUtil -----> common array tools
  • BrowserUtil -----> common browser Tools
  • ClassLoaderUtil -----> class load common tool class
  • ClassUtil -----> generic tool class
  • CollectionUtil -----> set common tool class
  • DateUtil -----> common date tools
  • FileUtil -----> common file tools
  • IOUtil -----> common input/output tool class
  • JVMRandom -----> common random number Tool
  • NumberUtil -----> common numeric tool class
  • ObjectUtil -----> Common Object tool class
  • PropertiesLoader -----> configuration file loading and reading common tool class
  • ReflectionUtils -----> common reflection tools
  • RMButil -----> common RMB Tool
  • SecurityUtil -----> general security tools
  • StringUtil -----> string generic tool class
  • WebContainerUtil -----> common container tools
  • ZipUtil -----> common compression tools

All Chinese-style methods have detailed annotations and use examples. You can easily control them by looking at the method name.

There are many methods in the tool class (only two of them are added), and I will not list the rest.

If you are interested in cloning the project to a local device, run it on your own.

// ================================================ ==================================================================/// Obtain the context class loader method. // ================================================ ==================================================================== /*** Obtain the <code> ClassLoader </code> of the current thread. JDK or later is required. ** Return <code> ClassLoader </code> */public static ClassLoader getContextClassLoader () {return Thread. currentThread (). getContextClassLoader ();}
/*** Description: truncates a String of the specified length. * compared with the String substring method, this method avoids null strings and lacks the length. */public static String getSubString (String sOurce, int len) {if (isEmpty (sOurce) {return "";} if (sOurce. length () <= len) {return sOurce;} return sOurce. substring (0, len );}

The project has been open-source on Git, and the address has been provided above. I sincerely invite you to complete it together.

 

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.