Skip to content

javaquery/util

Repository files navigation

JavaQuery Util Library

Welcome to the JavaQuery util library

Maven Central

Overview

Goal is to remove repeated boilerplate utility code from your project. This library offers util classes of following framework and objects.

  • Collections: Provides wide range of operation you perform on collection (List, Set and Map) interfaces like nullOrEmpty(Collection), nonNullNonEmpty(Collection), batches(List source, int batchSize), etc...
  • Files: Provides wide range of operation you perform on java.io.File like createNewFile(T file), writeToFile(T file, String data), appendToFile(T file, String data, boolean appendNewLine), etc...
  • Console: Provides replacement of System.out.println() using .log() and System.err.println() using error().
  • JFile: Extends java.io.File and provide some extra function on file like getExtension , read, write.
  • JSONObject: Uses org.json.JSONObject and provides facility to optValue at any path in JSONObject, like items.item[0].batters.batter[2].available
  • Strings: Provides wide range of operation you perform on java.lang.String like nullOrEmpty( String str), joinStrings(String separator, String... strings), removeNotSupportedASCIICharacters(String str), etc...
  • DatePattern: Provides wide range of Date patterns commonly used worldwide like yyyyMMddHHmmss , yyyy-MM-dd HH:mm:ss'Z', yyyy-MM-dd'T'HH:mm:ss.SSSSSSS-HH:MM, etc...
  • DateRange: Class can be used to store start-date and end-date.
  • Dates: Provides wide range of operation you perform on java.util.Date like addInDate(Date date, int type, int amount), parse(String date, DatePattern datePattern, TimeZone timeZone) , format(Date date, DatePattern datePattern, TimeZone timeZone), etc...
  • Assert: Provides wide range of operation for Assertions like nonNull(Object object, Supplier exceptionSupplier), isTrue(boolean expression, Supplier exceptionSupplier), nonNullNonEmpty(Collection<?> collection, Supplier exceptionSupplier), etc...
  • Objects: Provides wide range of operation on java.lang.Object like isNull(Object obj) , nonNull(Object obj).
  • Regex: Provides wide range of operation using regular expression like isNumber(String value) , isAlphaNumeric(String value), isValidEmail(String value).
  • UniqueIdGenerator: Generate unique time based random alphanumeric string like Firebase keys.
  • LogBuilder: Help you to build Map for Markers used in logging with optional execution time of code or function.
  • JHashMap: Build on top of HashMap. Provide you extra functionality to opt values.
  • ExecutionContext: Help you to transfer data between method calls and log extra details.
  • CommonResponse: Build common http response object.

Maven

<dependency>
  <groupId>com.javaquery</groupId>
  <artifactId>util</artifactId>
  <version>1.2.4</version>
</dependency>

Gradle

implementation 'com.javaquery:util:1.2.4'