Sunday 29 July 2018

A Human Readable Predicate with ObjectLab Kit

Recently, I have been working with Predicates.

I'm modelling some stuff for a bank but I needed to present updates and changes to the handwritten rules regularly. I don't know about you but wouldn't be nice if we could print the Predicate and not getting something like:

net.objectlab.kit.util.excel.ExcelWorkbookTest$$Lambda$1/868693306@13221655

Therefore, here comes the PrintablePredicate class in the next release of ObjectLab Kit.

See PrintablePredicate.java

The idea is to create an implementation of a Predicate and allow you to give it a name and the values it is comparing against.  We also support AND, OR and NEGATE as per a Predicate.

Let's imagine a small model, a financial Instrument 'Asset' and some basic Predicates.  Imagine that we create a predicate that detects instruments that are either Bonds or Commodities but that they should also be Active.

Using PrintablePredicate, I can combine 2 predicates and when I print the predicate (in an Excel spreadsheet that I generate automatically, more on that later) I can see a nice string "AssetClass in (Bond, Commodities) AND Active".  Here is the code for it:



This tiny class will come with ObjectLab Kit 1.4.1. Enjoy!

Sunday 22 July 2018

Flatpack 4.0.2 released! 50% speed improvement

Dear All

It is with great pleasure to announce that, after a while one must admit, we have released a new version of FlatPack, v 4.02.

See FlatPack Website for more information.

The libraries are available on Maven Central and still only required JDK 1.8.

The release jumped directly to Java8 as we make use of some cool stream functionalities and Autocloseable features.  We have also spent a little bit of time on performance and improved the overall parsing results by about 50%! 

Enjoy!