= Optionality _(enum)_
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Whether the property or parameter is optional or is required (aka mandatory).

== API

[source,java]
.Optionality.java
----
enum Optionality {
  DEFAULT     // <.>
  OPTIONAL     // <.>
  MANDATORY     // <.>
  NOT_SPECIFIED     // <.>
  boolean isOptional()
}
----

<.> xref:#DEFAULT[DEFAULT]
+
--
Default, usually meaning mandatory for properties and always meaning mandatory for parameters.
--
<.> xref:#OPTIONAL[OPTIONAL]
+
--
Indicates that the property or parameter is not required.
--
<.> xref:#MANDATORY[MANDATORY]
+
--
Indicates that the property is required (even if the JDO `javax.jdo.annotations.Column` annotation says otherwise).
--
<.> xref:#NOT_SPECIFIED[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

Default, usually meaning mandatory for properties and always meaning mandatory for parameters.

For properties, will be false unless JDO `javax.jdo.annotations.Column` has also specified with `javax.jdo.annotations.Column#allowsNull()` set to `true` .

[#OPTIONAL]
=== OPTIONAL

Indicates that the property or parameter is not required.

[#MANDATORY]
=== MANDATORY

Indicates that the property is required (even if the JDO `javax.jdo.annotations.Column` annotation says otherwise).

When using the JDO/DataNucleus objectstore, it is sometimes necessary to annotate a property as optional (using `javax.jdo.annotations.Column#allowsNull()` 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 `javax.jdo.annotations.Inheritance` > with the `javax.jdo.annotations.InheritanceStrategy#SUPERCLASS_TABLE` superclass strategy.

This annotation, therefore, is intended to override any objectstore-specific annotation, so that Isis can apply the constraint even though the objectstore is unable to do so.

[#NOT_SPECIFIED]
=== NOT_SPECIFIED

Ignore the value provided by this annotation (meaning that the framework will keep searching, in meta annotations or superclasses/interfaces).
