@Nullable (javax.validation)
Apache Causeway' defaults for properties and parameters is that they are mandatory unless otherwise stated.
The @javax.annotation.Nullable
annotation is recognized by Apache Causeway for both properties and parameters as means to indicate that the property/parameter is not mandatory.
For example:
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
or:
public Customer updateName(@javax.annotation.Nullable final String name) {
setName(name);
return this;
}
Apache Causeway does provide several other ways to specify optionality: using the @Property#optionality() / @Parameter#optionality() annotation. For properties, the optionality can also be inferred from the @Column#allowsNull() attribute.
See the @Property#optionality() documentation for a much fuller discussion on the relationship between using the Apache Causeway annotations vs @Column#allowsNull(). |
If more than one method is specified then the framework will validate that there are no incompatibilities (and fail to boot otherwise).