Ladybug Formatters

Ladybug Formatters is a Java library of formatters that convert various inputs into DOM subtrees to be used in PushMode applications. It is reactive (via Hookless) where appropriate. Formatted output is rounded to improve readability while tooltip can be used to see the exact value.

Download

Get Ladybug Formatters from Maven Central:

Tool
<dependency>
    <groupId>com.machinezoo.ladybugformatters</groupId>
    <artifactId>ladybugformatters</artifactId>
    <version>0.1.2</version>
</dependency>

Or clone sources from GitHub or Bitbucket. Don't forget to configure your build for Java 17+. Sources and binaries are distributed under Apache License 2.0.

If your project is a Java module, add the following declaration to your module-info.java:

requires com.machinezoo.ladybugformatters;

Usage

Most of the time, you just want to access the formatters via the Pretty class.

double rate = 0.04352;
Html.p()
    .add("Current interest rate is ")
    .add(Pretty.percents().format(rate))
    .add(".");

The above code will produce content shown below. Hover over the rounded value to see the exact value.

Current interest rate is 4.35 %.

Next steps