[#javax-annotation-Nullable]
= @Nullable (javax.validation)

: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.


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:

[source,java]
----
@javax.annotation.Nullable
public String getName() {
    return name;
}
public void setName(final String name) {
    this.name = name;
}
----

or:

[source,java]
----
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
xref:refguide:applib:index/annotation/Property.adoc#optionality[@Property#optionality()] /
xref:refguide:applib:index/annotation/Parameter.adoc#optionality[@Parameter#optionality()] annotation.
For properties, the optionality can also be inferred from the xref:refguide:applib-ant:Column.adoc#nullability[@Column#allowsNull()] attribute.

[TIP]
====
See the
xref:refguide:applib:index/annotation/Property.adoc#optionality[@Property#optionality()] documentation for a much fuller discussion on the relationship between using the Apache Causeway annotations vs
xref:refguide:applib-ant:Column.adoc#nullability[@Column#allowsNull()].
====

If more than one method is specified then the framework will validate that there are no incompatibilities (and fail to boot otherwise).




