Skip to content

Simple enum field initialization #270

@foal

Description

@foal

Right now to initializi the enum attrubute I need to write following

@RecordBuilder
public record MyRecord(
    @Initializer("DEFAULT") MyEnum value
) {
    public static final MyEnum DEFAULT = MyEnum.STANDARD;
}

What I want is something

@RecordBuilder
public record MyRecord(
    @Initializer("STANDARD") MyEnum value
) {}

We can use the class=MyEnum.class also but it is essential :)
For enum attributtes

  1. check the standard (static fields/tethods of the record with this name)
  2. check the enum for such field

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions