Optionality (enum)
Whether the property or parameter is optional or is required (aka mandatory).
API
enum Optionality {
DEFAULT (1)
OPTIONAL (2)
MANDATORY (3)
NOT_SPECIFIED (4)
boolean isOptional()
}
| 1 | DEFAULT
Default, usually meaning mandatory for properties and always meaning mandatory for parameters. |
| 2 | OPTIONAL
Indicates that the property or parameter is not required. |
| 3 | MANDATORY
Indicates that the property is required (even if the JPA jakarta.persistence.Column annotation says otherwise). |
| 4 | NOT_SPECIFIED
Ignore the value provided by this annotation (meaning that the framework will keep searching, in meta annotations or superclasses/interfaces). |
Members
DEFAULT
Default, usually meaning mandatory for properties and always meaning mandatory for parameters.
For properties, will be false unless JPA Column has also specified with Column#nullable() set to true .
MANDATORY
Indicates that the property is required (even if the JPA jakarta.persistence.Column annotation says otherwise).
When using the JPA/EclipseLink objectstore, it is sometimes necessary to annotate a property as optional (using Column#nullable() set to true ), even if the property is logically mandatory. For example, this can occur when the property is in a subtype class that has been "rolled up" to the superclass table using jakarta.persistence.Inheritance strategy of jakarta.persistence.InheritanceType#SINGLE_TABLE
This annotation, therefore, is intended to override any objectstore-specific annotation, so that Causeway can apply the constraint even though the objectstore is unable to do so.