Graph Projection for Kotlin

Convention-based object mapping that respects the Kotlin type system, with little or no mapping code.

What's inside

Discover the capabilities built to elevate your Kotlin applications.

Projection by Convention

Target constructor parameters and mutable properties take their values from source properties with the same name. Constructor defaults are kept where there's no value, and nullable parameters receive null. In the best case, a projection needs no configuration at all.

A DSL for the Exceptions

Where the convention doesn't fit, map a renamed property, compute a value, set a constant, convert with a specific type converter or ignore a member.

Type Conversion

Values are converted by clear, ordered rules: element by element for collections, arrays and maps, through registered projections and type converters, by name for enums, and recursively for nested classes. The core type converters are included, and you can add, replace or remove them.

Target Factories

Create targets that have no usable primary constructor through factories, which apply to subtypes too, with values then set through mutable properties.

Nested and Collection Projection

Nested objects, lists, sets, arrays and maps are projected recursively, with a path for every element, and cycles are reported as failures rather than overflowing the stack.

Every Failure at Once

Projection carries on wherever it can, then reports every problem together in a single ProjectionException, each with its target path, its source path and the cause.

With or Without a Registry

Project without a registry when you only need to once, or through a registry that honours each graph's member access policies.