Randgalt / record-builder

Record builder generator for Java records
Apache License 2.0
723 stars 51 forks source link

Return interface type for @RecordInterface #166

Open DenWav opened 7 months ago

DenWav commented 7 months ago

It would be nice to have an option for something like the following:

@RecordInterface
public interface SomeInterface extends SomeInterfaceRecordBuilder.With {
    String thingOne();
    String thingTwo();

    static SomeInterfaceRecordBuilder builder() {
        return SomeInterfaceRecordBuilder.builder();
    }
}

But when I do that, SomeInterface.builder().build() returns SomeInterfaceRecord rather than just SomeInterface.

Similarly an option for the with methods would be nice too.

Randgalt commented 7 months ago

I can see this. I don't have a lot of time at the moment. A PR would be appreciated otherwise I'll get to it when I can.