Type Factory
Type Factory helps Java developers replace loosely validated String values with small, explicit custom types.
Use it when a value has its own rules, but repeated validation logic is hard to maintain and handwritten value objects would add too much boilerplate.
What it provides
- Immutable, thread-safe
TypeParserdefinitions for cleanup, formatting, and validation. - Simple creation of immutable custom value-object classes extending
CharSequence. - Consistent boundary validation, so invalid values fail before spreading through your application.
- Less repeated annotation validation, regex validation, and cleanup boilerplate.
Start here
- Getting started – create your first custom types.
Next steps
There is a lot more to come in this section.
- Best practices – how to use Type Factory effectively.
- Regex validation pitfalls – some regular expression shortcomings and a comparison to TypeFactory types.