Core Library for Kotlin

Composable specifications, checked type conversion and the everyday extensions the Kotlin standard library leaves out.

What's inside

Discover the capabilities built to elevate your Kotlin applications.

Composable Specifications

Specification<T> captures a business rule as an object you can test, name and reuse. Combine rules with and, or and not, or combine whole lists at once, and every specification describes itself in readable language, so a composed rule can explain what it checks.

Built-in Specifications

Ready-made specifications for strings, collections, comparable values, booleans and any value: length and content checks, regular expressions, UUIDs and Luhn checksums, counts, distinctness, exact contents, ranges, equality and null checks.

Checked Type Conversion

Type converters for the numeric types, BigInteger, BigDecimal, Boolean, Char, String and UUID refuse to lose data quietly. A conversion that would overflow or drop a fractional part throws an exception that says so, rather than returning the wrong value.

Calendar Day Types

DayOfMonth and DayOfMonthOccurrence describe days like the second Tuesday or the last Friday of a month, and can tell whether a date matches, so calendar logic reads the way people describe it.

Everyday Extensions

Extensions for the tasks every codebase repeats: zero and one constants and BigDecimal conversions for the numeric types, comparison and range checks for anything comparable, content and count checks for collections, string helpers for UUIDs, checksums, regular expressions and snake and kebab case, and arithmetic for java.time durations.

Reflection Helpers

Find a class's primary constructor and properties, create instances from a map of arguments, resolve generic type arguments, and format type names with their generics and nullability intact.

Terminal Colours

Write coloured output to the terminal with the sixteen ANSI colours, with the colours reset automatically after each print.

Built for Modern Kotlin

Built with Kotlin 2.4 for Java 17 and later, with an explicit public API that is checked for compatibility on every build, and no dependencies beyond the Kotlin standard library and kotlin-reflect.