ZEMS Value Documentation
ZEMS Value is a library of immutable value types for Java, built to become value classes when Project Valhalla lands. Each value carries its own state, such as null or an error, so bad input does not throw where it is parsed: it travels with the data and is handled where it is used.
- Setup — the JDK floor and the dependency.
- Getting started — your first values, and what happens to bad input.
Guides
One guide per feature. Each one shows the feature as a use case and ends with the decisions it asks of you.
- Explicit state — the six state markers, which one to produce, and your own types as values.
- Errors as values — a refused input travels as an
ErrorValue, a refused request as anUnsupportedValue. - Transform and recover — chain like
Optional, recover from errors, fold out. - Collections — lists, sets and maps of values in one call.
- Type names as data — a type name that never loads a class.
- Versions — version strings that know their grammar.
- Quantities and money — a number with its unit, physical or monetary.
- Enum constants — an enum constant as a value with a wire shape for free.
- Converting values — one verb from any value to a target class, lossless by default.
- JSON documents — JSON as data, parsed and navigated without exceptions.
- Marshalling with ValueIo — records to JSON or binary CBOR and back.
- Testing with ValueAssertions — AssertJ assertions for values and a round-trip harness.