What is POJava?

POJava is a set of very light-weight utility libraries providing a practical assortment of data transformations. The base jar, POJava, provides simplified functions for string and binary conversions, such as compression, encryption, and encoding, and tools for date manipulation, reflection, external process invocation, and language binding.

A key strength of the POJava library is its handling of dates and times. Its immutable DateTime object will quickly parse dates from a string in most languages and formats without having to specify either. It allows for system-global definition of the several default behaviors of the DateTime object, including the toString() format, input and output time zones, MDY vs DMY interpretation of ambiguous formats, and interpretation of two digit years. It can perform date math, such as truncating to an hour or subtracting a month.

The POJava Persistence jar layers additional support for database-to-object (ORM) and object-to-xml exchanges in both directions.

What's new and cool in POJava?

As of version 3.0.0, POJava has separated DateTime into a separate project and includes it as a dependency. The DateTimeConfig object was refactored to get rid of all static variables except for the one used as a singleton, which now returns an instance of IDateTimeConfig, rather than the DateTimeConfig object, so it can be overridden as needed. The DateTime object now uses the IDateTimeConfig.systemTime() to fetch the system time, rather than System.currentTimeMillis(), so it can be overridden for testing.

The DateTimeConfig object is immutable, and there is now a mutable DateTimeConfigBuilder object that can be used to more easily define a custom configuration. The algorithm for interpreting text-based months has changed, so the IDateTimeConfig now supports a MonthMap object that maps month names and abbreviations to their respective calendar month offsets. This new approach made it easy to add nearly all languages to the default, and support custom additions in case there are known abbreviations or languages that are not yet supported.

When constructing a DateTime while specifying a Time Zone, the DateTime object will no longer clone the default config, but will wrap it in a LocalConfig object that overrides only what is needed. This reduces garbage collection and complexity.

Generated Documentation

POJava 3.0.0 JavaDocs POJava provides utilities for managing data using simple POJOs (Plain Old Java Objects).
POJava DateTime 3.0.0 JavaDocs POJava DateTime combines an intelligent date parser with date manipulation features such as advanced formatting, simple time zone conversions, and date arithmetic.
Persistence 2.6.0 JavaDocs POJava Persistence provides a persistence layer for Object Relational Mapping between Java and a wide array of database platforms. It also provides Object to XML serialization and deserialization to simplify the conversion of your objects into a portable form.

Hand-written Documentation

How to use POJava for...

Compression Using Zip compression to fit more into the same space.
Date and Time Easily parse freeform text Date and Time in multiple languages and formats.
Number Base Encoding Base-64 or Hex-encode your binary data for document portability.
Unit testing with JNDI Use JNDIRegistry to populate a test-friendly InitialContext.
Running External Programs Use the ProcessTool to reliably execute external programs, capturing both stdout and stderr.
Encryption Encrypt and decrypt your data using government-approved AES-128 encryption (and other supported encryption methods).

How to use POJava Persistence for...

XML Serialization Stream your Objects to XML. Retrieve and rehydrate them back into Objects, preserving complex circular references.
Object Relational Mapping Make your Data Access Objects simple, secure and speedy.