This library is a collection of utility functions that I've written over the years. It exists because I found myself rewriting the same classes for each company that I worked with. At present I don't use Java much, so updates are few and far between.
The library currently supports Java 8 and higher. If you are using an earlier Java version, you can use version 1.x of the library, but it will not receive updates.
Include the following dependency in your project (variants for other build tools and the latest version number is available from Maven Central):
<dependency> <groupId>com.kdgregory.util</groupId> <artifactId>kdgcommons</artifactId> <version>LATEST_VERSION</version> </dependency>
Decide what classes are useful to you.
The top-level package is
com.kdgregory.kdgcommons. Under that you'll find the following packages:
||An introspection library for bean-style data classes that lets you manage the cache (so you don't end up with strong references to things you thought you unloaded).|
||Classes that convert byte arrays to and from another format (currently, Base64 and Hex).|
||Operations for building and using Java collections.|
||Streams and utilities for working with them. A lot of overlap with Apache Commons IO (including one class that ended up living there, albeit transformed beyond recognition).|
||Tools for working with core Java objects, especially strings and classes.|
||At present, only
||Helpers for JUnit tests, including a range of asserts and mocks. Supports JUnit versions from 3.8.2 up.|
||At present, just supports 2-tuples.|
||A catch-all for everything else. Looking at it as I write this README, most of what it contains should be elsewhere.|
JavaDoc is available here.
I use the standard
majoris currently (and expected to stay) 2
minoris updated whenever I add new classes or packages (in practice, it's updated with every release other than a bugfix, since I accumulate changes).
patchis updated for bugfixes or minor additions to existing classes.
The API will remain backwards-compatible for all 2.x releases, although I may choose to deprecate functionality.
I decided to make a clean break with the earlier version, so that transitive dependencies (for example, from practicalxml) would not be affected:
- A new Maven group ID:
- New package names:
The easiest way to upgrade is start by using the latest 1.x release, 1.0.19. This release deprecated all functionality that was removed in 2.x (mostly operations that are better implemented using Java8 lambdas). Run a test compile to find any deprecations, fix them, and look at the changelog to see if you'll be affected by any of the minor changes.
After that, using the new version should be a simple change of Maven dependencies and imports.