= Annotations

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


This guide describes the various annotations used by Apache Causeway to provide additional metadata about the domain objects.
Most of these are defined by the framework itself, but some are from other libraries.
It also identifies a number of annotations that are now deprecated, and indicates their replacement.


The annotations supported by Apache Causeway break out into five categories.

include::about/main.adoc[leveloffset=+1]
include::about/other.adoc[leveloffset=+1]
include::about/jdo.adoc[leveloffset=+1]
include::about/jpa.adoc[leveloffset=+1]
include::about/jee.adoc[leveloffset=+1]
// include::about/partial.adoc[leveloffset=+1]


== Examples

To give just a few examples of annotations supported by Apache Causeway:

* if a property is read-only, then this can be annotated with `@Property(editing=EditingDISABLED)`.
* if a class has a small fixed set of instances (eg a picklist), then it can be annotated using `@DomainObject(bounded=true)`
* if a class is a domain service and should be automatically instantiated as a singleton, then it can be annotated using `@DomainService`
* if an action is idempotent, then it can be annotated using `@Action(semantics=SemanticsOf.IDEMPOTENT)`.
* if an action parameter is optional, it can be annotated using `@Parameter(optionality=Optionality.OPTIONAL)`

Some annotations act as UI hints, for example:

* if a collection should be rendered "open" rather than collapsed, it can be annotated using `@CollectionLayout(defaultView="table")`
* if an action has a tooltip, it can be annotated using `@ActionLayout(describedAs=...)`
* if a domain object is bookmarkable, it can be annotated using `@DomainObjectLayout(bookmarking=BookmarkPolicy.AS_ROOT`).

