java common utils library

Overview

java-common-utils

java common utils library

一个简单的Java通用工具类,目前的设想,包括简化异常处理工具、简易限流处理工具等

ExceptionHandler, 目标简化try catch的代码冗余度

try {
  // dosomething...
} catch (Exception e) {
  log.error(e);
}

简化为

ExceptionHandler.ignoreExceptionWithErrorMsg(() -> {
  // dosomething....            
}, "exec error");
try {
  // dosomething...
} catch (Exception e) {
  log.error(e);
  throws new MyException("执行错误");
}

简化为

ExceptionHandler.runtimeException(() -> {
   // dosomething...
}, "exec error");
try {
  // dosomething...
} catch (Exception e) {
  log.error(e);
  // if exception happen, then exec something...
  // dosomething
  log.error("exec error");
}

简化为

ThrowsHandler.run(() -> {
    // dosomething...
   })
   .whenExceptionThen(() -> //dosomethings...)
   .logThrowable("exec error");
try {
  // dosomething...
} catch (Exception e) {
  log.error(e);
  // if exception happen, then exec something...
  // dosomething
  log.error("exec error");
  throws new MyException("exec error");
}

简化为

ThrowsHandler.run(() -> {
    // dosomething...
   })
   .whenExceptionThen(() -> //dosomethings...)
   .runtimeExp("exec error");
You might also like...

A Java API for checking if text contains profanity via the alt-profanity-checker Python library.

ProfanityCheckerAPI A Java API for checking if text contains profanity via the alt-profanity-checker Python library. It uses jep to run and interpret

Feb 19, 2022

High performance I/O library for Java using io_uring under the hood

nio_uring nio_uring is an I/O library for Java that uses io_uring under the hood, which aims to be: A simple and flexible API Super fast and efficient

Dec 18, 2022

archifacts is a library to extract your architectural concepts out of your application's code

archifacts is a free (Apache 2.0 license) library for describing and detecting architectural building blocks and their relationships in your Java appl

Nov 29, 2022

Java lib for monitoring directories or individual files via java.nio.file.WatchService

ch.vorburger.fswatch Java lib for monitoring directories or individual files based on the java.nio.file.WatchService. Usage Get it from Maven Central

Jan 7, 2022

Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) with quarterly updates. Tencent Kona JDK11 is certified as compatible with the Java SE standard.

Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) with quarterly updates. Tencent Kona JDK11 is certified as compatible with the Java SE standard.

Tencent Kona JDK11 Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) w

Dec 16, 2022

This repository contains Java programs to become zero to hero in Java.

This repository contains Java programs to become zero to hero in Java. Data Structure programs topic wise are also present to learn data structure problem solving in Java. Programs related to each and every concep are present from easy to intermidiate level

Oct 9, 2022

Java Constraint Programming solver

https://maven-badges.herokuapp.com/maven-central/org.jacop/jacop/badge.svg [] (https://maven-badges.herokuapp.com/maven-central/org.jacop/jacop/) JaCo

Dec 30, 2022

Java Constraint Solver to solve vehicle routing, employee rostering, task assignment, conference scheduling and other planning problems.

OptaPlanner www.optaplanner.org Looking for Quickstarts? OptaPlanner’s quickstarts have moved to optaplanner-quickstarts repository. Quick development

Jan 2, 2023

Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas

Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas

Arthas Arthas is a Java Diagnostic tool open sourced by Alibaba. Arthas allows developers to troubleshoot production issues for Java applications with

Jan 4, 2023
Owner
xuangy
A Java Coder.
xuangy
Android developers should collect the following utils

README of Chinese About AndroidUtilCode ?? is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used

Blankj 31.7k Jan 3, 2023
Commons networking related utils.

commons-networking Commons networking related utils. Note: This is not an official Cisco product. Features SSE (Server-sent Events) client GNMI Utils

Cisco Systems Engineers 6 Dec 22, 2022
Serializes Entities, Basically converting them to namespacedkeys that can be used later, not exactly serializing with its common definition

Serializes Entities, Basically converting them to namespacedkeys that can be used later, not exactly serializing with its common definition

2Hex 2 Apr 3, 2022
An open-source Java library for Constraint Programming

Documentation, Support and Issues Contributing Download and installation Choco-solver is an open-source Java library for Constraint Programming. Curre

null 607 Jan 3, 2023
Java rate limiting library based on token/leaky-bucket algorithm.

Java rate-limiting library based on token-bucket algorithm. Advantages of Bucket4j Implemented on top of ideas of well known algorithm, which are by d

Vladimir Bukhtoyarov 1.7k Jan 8, 2023
A Java library for designing good error messages

JDoctor, a Java library for good error messages Designing good error messages is hard. In Java, most often, developers just rely on throwing exception

Cédric Champeau 125 Oct 24, 2022
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

null 1.5k Jan 4, 2023
Ta4j is an open source Java library for technical analysis

Ta4j is an open source Java library for technical analysis. It provides the basic components for creation, evaluation and execution of trading strategies.

null 1.7k Dec 31, 2022
hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java.

Hella easy HTML in Java hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java. Very lightweight and fast, the prim

null 1 Nov 23, 2022
documents4j is a Java library for converting documents into another document format

documents4j is a Java library for converting documents into another document format. This is achieved by delegating the conversion to any

documents4j 455 Dec 23, 2022