1
@Immutable
@Modifiable
public interface Record {

    String id();

    String fName();

    String lName();

    String mName();
}

All the fields in Record can be Nullable. One way for me to make these fields Nullable is to add @Nullable annotation on top of each field. Like this:

@Nullable
String mName()

Is there a way for me to specify at the interface level(through some annotation) that all fields can be null?

Adi
  • 387
  • 3
  • 6
  • 14

1 Answers1

0

I used the following config to disable null check in builder and with methods:

@Value.Style(
  validationMethod = Value.Style.ValidationMethod.NONE,
)

The following quote is the the ValidationMethod.NONE javadoc description:

Disables null and mandatory attribute checks. Any missing primitives will be initialized to their zero-based values: false, 0, '\0'. Object references will be nulls. Any optional, default and collection attributes will be initialized with their appropriate default values regardless of this validation setting.

Mohamed Gara
  • 2,665
  • 3
  • 13
  • 19