An annotation processor that generates builders, withers, and records for Java records and interfaces.
RecordBuilder is a Java annotation processor that generates builder classes and 'wither' copy methods for Java records. It solves the problem of Java records lacking convenient construction and modification patterns, providing a fluent API for creating and transforming immutable data objects. The tool can also generate complete records from interface definitions, making it easier to define data contracts.
Java developers using Java 16+ records who need more flexible construction patterns, immutable updates, or want to generate records from interfaces. It's particularly useful for projects emphasizing immutable data models and clean API design.
Developers choose RecordBuilder because it seamlessly integrates with Java's standard record feature, requires no runtime dependencies, and offers extensive customization. It provides a lightweight, annotation-driven solution to overcome the limitations of vanilla records, making immutable data handling more practical and expressive.
Record builder generator for Java records
Automatically creates a fluent builder class for any Java record, enabling step-by-step construction as shown in the RecordBuilder Example with methods like `.name(aName).age(anAge).build()`.
Adds `withX()` copy methods for immutable updates, either by implementing a generated interface or via static helpers, as demonstrated in the Wither Example with `r1.withName("bar")`.
Generates full records from interface definitions, including builders and withers, useful for defining data contracts without boilerplate, as in the RecordInterface Example.
Can generate builders for existing records and interfaces from unmodifiable source code using `@Include` annotations, allowing enhancement of library classes without modification.
Requires explicit configuration in Maven, Gradle, and IDE settings for annotation processing, which can be complex and prone to environment-specific issues, as detailed in the Usage section.
Key features and customization options are split across multiple markdown files (customizing.md, options.md, deconstructors.md), making it harder to find comprehensive information in one place.
Successful use depends on proper IDE configuration for annotation processing, which might not work out-of-the-box in all environments, potentially causing frustration during setup.
JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
A Java API for generating .java source files.
A collection of source code generators for Java.
Automatic generation of the Builder pattern for Java
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.