🌐
GitHub
github.com › randgalt › record-builder
GitHub - Randgalt/record-builder: Record builder generator for Java records · GitHub
Record builder generator for Java records. Contribute to Randgalt/record-builder development by creating an account on GitHub.
Starred by 923 users
Forked by 70 users
Languages   Java
🌐
GitHub
github.com › avaje › avaje-record-builder
GitHub - avaje/avaje-record-builder: generates builder for records · GitHub
Return a new builder with all fields set to default Java values */ public static ArmoredCoreBuilder builder() { return new ArmoredCoreBuilder(); } ... Return a new builder with all fields set to the values taken from the given record instance */ public static ArmoredCoreBuilder builder(ArmoredCore from) { return new ArmoredCoreBuilder(from.coreName(), from.model(), from.energyReserve(), from.ap()); }
Starred by 22 users
Forked by 2 users
Languages   Java
Discussions

Records and @Builder
It does not defeat the purpose. Records are immutable data objects. How you initialize them, is up to you and using the builder pattern on big data objects makes sense as sometimes the default record constructor might be inflexible. If you don't want to use lombok (@Builder), this works great: https://github.com/Randgalt/record-builder More on reddit.com
🌐 r/javahelp
12
2
September 2, 2024
Java record does not have default builder - Stack Overflow
This standalone project provides a great record builder solution github.com/Randgalt/record-builder. ... Recreating Lombok is not the purpose of Java record. More on stackoverflow.com
🌐 stackoverflow.com
ANN: Record Builder (early access) for Java Records

I see a builder as vital to complete Java records. The JDK will get around to it eventually (and likely other tools) but I thought I'd add it now.

Example

@RecordBuilder  
public record NameAndAge(String name, int age){}

This will generate a builder class that can be used ala:

// build from components
var n1 = NameAndAgeBuilder.builder().name(aName).age(anAge).build();

// generate a copy with a changed value
var n2 = NameAndAgeBuilder.builder(n1).age(newAge).build(); // name is the same as the name in n1

// pass to other methods to set components
var builder = new NameAndAgeBuilder();
setName(builder);
setAge(builder);
var n3 = builder.build();
More on reddit.com
🌐 r/java
37
42
December 16, 2019
[ANN] RecordBuilder v33 Released
I love this project for bringing much needed withers to Java records. Still waiting for the day we get named params so that we can reduce wither boilerplate. More on reddit.com
🌐 r/java
39
50
April 8, 2022
🌐
GitHub
github.com › Blackdread › record-builder
GitHub - Blackdread/record-builder: Record builder generator for Java records
Record builder generator for Java records. Contribute to Blackdread/record-builder development by creating an account on GitHub.
Author   Blackdread
🌐
GitHub
github.com › pawellabaj › auto-record
GitHub - pawellabaj/auto-record: Java record source generator
Java record source generator. Contribute to pawellabaj/auto-record development by creating an account on GitHub.
Starred by 7 users
Forked by 2 users
Languages   Java 100.0% | Java 100.0%
🌐
GitHub
github.com › Pravin3c › Builder-Pattern-with-Java-Records
GitHub - Pravin3c/Builder-Pattern-with-Java-Records: Ways to Create Builder Pattern for Java Records · GitHub
Below are three approaches to implementing the builder pattern with Java Records. 1. Using Nested Static Class Step 1: Define the Record We start by defining an Employee record with multiple fields. public record Employee(Long id, String name, String company, Integer salary) {} Step 2: Create the Builder Class We then create a static inner builder class inside the Employee record.
Author   Pravin3c
🌐
GitHub
github.com › lilbaek › recordbuilder
GitHub - lilbaek/recordbuilder: Fast opinionated annotation processor to generate builders for Java records
Fast opinionated annotation processor to generate builders for Java records - lilbaek/recordbuilder
Author   lilbaek
Find elsewhere
🌐
DEV Community
dev.to › agavrilov76 › record-companion-simple-builder-pattern-for-java-records-4h9f
Record Companion: Simple Builder Pattern for Java Records - DEV Community
September 21, 2025 - Today, I want to introduce Record Companion - a library that brings the same philosophy of simplicity to builder pattern generation. ... You'd typically need to write a lot of boilerplate code. Record Companion solves this with a single annotation. Record Companion follows the same philosophy I outlined in the validation article: the goal isn't to have the most features—it's to have code that's easy to read, maintain, and debug. ... import io.github.recordcompanion.annotations.Builder; @Builder public record User(String name, int age, String email) {}
🌐
GitHub
github.com › stevejuma › intellij-plugin-builder
GitHub - stevejuma/intellij-plugin-builder: IntelliJ IDE Record builder generator plugin for Java Records, Beans, Interfaces · GitHub
IntelliJ IDE Record builder generator plugin for Java Records, Beans, Interfaces - stevejuma/intellij-plugin-builder
Author   stevejuma
🌐
GitHub
github.com › Randgalt › record-builder › blob › master › customizing.md
record-builder/customizing.md at master · Randgalt/record-builder
Record builder generator for Java records. Contribute to Randgalt/record-builder development by creating an account on GitHub.
Author   Randgalt
🌐
How to do in Java
howtodoinjava.com › home › java basics › builder pattern for java records
Builder Pattern for Java Records
August 6, 2024 - In this Java tutorial, we learned to implement the builder pattern style fluent API for creating records in an incremental manner. we also learned to use the RecordBuilder library to implement copy constructors on the records. Happy Learning !! Sourcecode on Github ·
🌐
GitHub
github.com › DanielLiu1123 › recordbuilder
GitHub - DanielLiu1123/recordbuilder: Build your objects with confidence. Not null by default, inspired by Protobuf. · GitHub
import org.jspecify.annotations.Nullable; @Generated( value = "recordbuilder.RecordBuilderProcessor", date = "..." ) public final class UserBuilder { private String _name; private Integer _age; private @Nullable String _email; private List<String> _roles; private Map<String, String> _attributes; private int _presenceMask0_; private UserBuilder() {} // Factory methods to create a new builder public static UserBuilder builder() { ...
Author   DanielLiu1123
🌐
GitHub
github.com › Randgalt › record-builder › blob › master › README.md
record-builder/README.md at master · Randgalt/record-builder
Record builder generator for Java records. Contribute to Randgalt/record-builder development by creating an account on GitHub.
Author   Randgalt
Top answer
1 of 1
23

Records are not “Lombok-lite”

Recreating Lombok is not the purpose of Java record.

The purpose of Java record is to provide an explicit vehicle for transparently communicating shallowly-immutable data.

Technically, records are Java’s nominal tuple. Tuple means an ordered set of fields. Nominal means the fields have names, as does their container. Practically, you can think of a Java record as a struct on steroids.

See the official document for scope and purpose, JEP 395: Records.

So no Builder feature need be provided by default as that lies outside the scope of Java record. However, you can easily create your own Builder for any particular record class.

AI-generated

Actually, you need not write your own Builder implementation. Let a generative AI draft the code on your behalf. (Be sure to review carefully as these AIs are imperfect.)

For example:

write code for a Builder class for the Java record record Person ( String name , LocalDate birth ){}

Ecosia AI chat feature produces:

public record Person(String name, LocalDate birth) {
    
    public static class Builder {
        private String name;
        private LocalDate birth;

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder birth(LocalDate birth) {
            this.birth = birth;
            return this;
        }

        public Person build() {
            return new Person(name, birth);
        }
    }
}

That code worked for me, copy-pasted, with no edits needed.

Usage:

Person person = new Person.Builder()
    .birth(LocalDate.of(2001, Month.JANUARY, 23))
    .name("Alice")
    .build();

person.toString() // ➡️ Person[name=Alice, birth=2001-01-23]

Withers

By the way, work is underway to add “withers”, a feature to instantiate a new record object based on the payload values of another. See JEP 468: Derived Record Creation (Preview).

Jakarta Validation

You may want to use Jakarta Validation (previously known as Bean Validation) to verify the validity of your new record object’s state.

Likewise, you might use Jakarta Validation in your Builder implementation.

IDE code generation

Your IDE may have a feature for generating code for a Builder from a given Java Record.

For example, IntelliJ has a built-in feature Replace Constructor with Builder. However that does not work for Java Record. But there is a plugin for that. The Record Builder Plugin can “automatically generate builder classes for your Java Records, JavaBeans and Interfaces, allowing you to select fields and configure the generated builder”.

RecordBuilder library

RecordBuilder is an interesting project that lets you mark a Java record with an annotation. Then RecordBuilder generates code for builders and withers.

I’ve not yet tried using this library, so I cannot vouch for it.

🌐
Baeldung
baeldung.com › home › java › a practical guide to recordbuilder in java
A Practical Guide to RecordBuilder in Java | Baeldung
November 12, 2025 - It generates fluent, immutable-friendly builders that remove the need for manual constructors or update methods. Its real strength is balance: flexible updates without losing immutability, and expressive code without boilerplate. Whether we’re building DTOs, API responses, or config objects, it fits naturally into our workflow. With almost no setup, RecordBuilder becomes a powerful tool for clean, scalable Java development. The code backing this article is available on GitHub...
🌐
GitHub
github.com › topics › records
records · GitHub Topics · GitHub
Java · Star 864 · Record builder generator for Java records · java records enable-preview java-17 java-records java-16 · Updated · Aug 20, 2025 · Java · Star 138 · Java Coding Problems, Second Edition - Published by Packt ·
🌐
GitHub
github.com › topics › java-records
java-records · GitHub Topics · GitHub
java converter parser data performance mapping mapper excel apache poi unmarshall deserialize pojo apache-poi poiji microsoft-excel java-11 java-17 java-records java-23 ... java builder records annotation-processor code-generation default-parameters default-values java-records
🌐
OpenJDK
mail.openjdk.org › pipermail › core-libs-dev › 2021-May › 077957.html
Builder pattern for Java records
May 22, 2021 - If some project out there wants to have code generators for patterns that are sometimes useful for records, that’s great — but that’s not where the language should be focusing. > On May 21, 2021, at 11:37 AM, Alberto Otero Rodríguez <albest512 at hotmail.com> wrote: > > Hi, I have found this project on GitHub which creates a Builder for Java records: > https://github.com/Randgalt/record-builder > [https://opengraph.githubassets.com/a4e3a7b3c7b16b51e0854011fe4b031577bcc09919058baef412b03613295d20/Randgalt/record-builder]<https://github.com/Randgalt/record-builder> > GitHub - Randgalt/record-builder: Record builder generator for Java records<https://github.com/Randgalt/record-builder> > The target package for generation is the same as the package that contains the "Include" annotation.