This article has participated in the call for good writing activity, click to view:Back end, big front end double track submission, 20,000 yuan prize pool waiting for you to challenge!”

preface

Hutool, if you use it, say yes. A handy Java tool class library!

First acquaintance with Hutool

Hutool is a small and complete Java tool class library, through the static method encapsulation, reduce the cost of learning related API, improve work efficiency, make Java has the elegant functional language, let the Java language can also be “sweet”.

The tools and methods in Hutool come from the elaboration of each user. It covers all aspects of the Java development code. It is not only a sharp tool to solve small problems in large project development, but also an efficiency responsibility in small projects.

The design idea of Hutool is to minimize repeated definitions and minimize the util package in the project. Generally speaking, it has the following ideas:

  • Methods take precedence over objects
  • Automatic identification is better than user-defined
  • Convenience and flexibility coexist
  • Adaptation and compatibility
  • Optional dependency principle
  • Principle of non-intrusion

Second, the component

Util utility class a Java basic utility class that encapsulates JDK methods such as files, streams, encryption and decryption, transcoding, re, threads, and XML. Util utility classes provide the following components:

The module introduce
hutool-aop JDK dynamic proxy encapsulation, providing non-IOC aspect support
hutool-bloomFilter Bloom filtering, which provides some Hash algorithms for Bloom filtering
hutool-cache Simple cache implementation
hutool-core
hutool-cron Scheduled task module that provides scheduled tasks like Crontab expressions
hutool-crypto Encryption and decryption module, providing symmetric, asymmetric and digest algorithm encapsulation
hutool-db JDBC encapsulated data manipulation, based on ActiveRecord ideas
hutool-dfa Multi-keyword search based on DFA model
hutool-extra Extension module, encapsulation for third parties (template engine, mail, Servlet, TWO-DIMENSIONAL code, Emoji, FTP, word segmentation, etc.)
hutool-http Http client encapsulation based on HttpUrlConnection
hutool-log Automatic identification of log facade of log implementation
hutool-script Scripts perform encapsulation, such as Javascript
hutool-setting More powerful Setting profile and Properties wrapper
hutool-system System parameters call encapsulation (JVM information, etc.)
hutool-json JSON implementation
hutool-captcha Image verification code implementation
hutool-poi Excel and Word encapsulation for POI
hutool-socket NIO and AIO Socket encapsulation based on Java
hutool-jwt JSON Web Token (JWT) encapsulation implementation

Each module can be imported individually as required, or all modules can be imported by hutool-all. |

Start fast

Maven add the following items to project Pom. XML dependencies:

<dependency>
    <groupId>cn.hutool</groupId>
    <artifactId>hutool-all</artifactId>
    <version>5.7.3</version>
</dependency>
Copy the code

2, Gradle

compile 'cn. Hutool: hutool -all: 5.7.3'
Copy the code

Four, common tools

The utility classes in this package are uncategorized and provide common utility methods.

Classified as XXXUtil by purpose, this package offers a wide range of tools and methods. In the tool class, mainly to class method (static method), and each class can not be instantiated as an object, a method is an independent function, no mutual influence.

  • String tool -StrUtil
  • Hexadecimal tool -HexUtil
  • The Escape tools – EscapeUtil
  • – HashUtil Hash algorithm
  • Tools – URLUtil URL
  • XML tools – XmlUtil
  • Object tool -ObjectUtil
  • Reflection tool -ReflectUtil
  • Generic type tool -TypeUtil
  • Paging tool -PageUtil
  • Clipboard tool -ClipboardUtil
  • Tools – ClassUtil
  • Class loading tool -ClassLoaderUtil
  • Enumeration tool -EnumUtil
  • Command line tool -RuntimeUtil
  • Number tools -NumberUtil
  • Array utility -ArrayUtil
  • Random Tool -RandomUtil
  • Unique ID tool -IdUtil
  • Compression tool -ZipUtil
  • Reference tool -ReferenceUtil
  • Re tool -ReUtil
  • Idcard tool -IdcardUtil
  • Information desensitization tool -DesensitizedUtil
  • Social Credit code tool -CreditCodeUtil
  • SPI loading tool -ServiceLoaderUtil

Five, the conclusion

Hutool has more and more rich functions, you go to learn to find the latest features.

Document address: Hutool user manual