= Core 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:


In Apache Causeway every domain object is either a domain entity, a view model or a domain service.  And each of these are made up of properties, collections and actions (domain services only have actions).

For each of these domain types and members there are two annotations.  One covers the semantics intrinsic to the domain (eg whether an action parameter is optional or not), then other (suffix `...Layout`) captures semantics relating to the UI/presentation layer.

[TIP]
====
Most UI semantics can also be specified using xref:userguide:fun:ui.adoc#object-layout[dynamic object layout].
====


The table below summarizes these most commonly used annotations in Apache Causeway.


.Core annotations for domain objects, services and members
[cols="2,4a,1,1", options="header"]
|===
|Annotation
|Purpose
|Layer
|xref:userguide:fun:ui.adoc#object-layout[File-based layout]?

|xref:refguide:applib:index/annotation/Action.adoc[@Action]
|Domain semantics for actions
|Domain
|

|xref:refguide:applib:index/annotation/ActionLayout.adoc[@ActionLayout]
|User interface hints for actions
|UI
|Yes

|xref:refguide:applib:index/annotation/Collection.adoc[@Collection]
|Domain semantics for collections
|Domain
|

|xref:refguide:applib:index/annotation/CollectionLayout.adoc[@CollectionLayout]
|User interface hints for collections
|UI
|Yes

|xref:refguide:applib:index/annotation/DomainObject.adoc[@DomainObject]
|Domain semantics for domain object (entities and optionally view models)
|Domain
|

|xref:refguide:applib:index/annotation/DomainObjectLayout.adoc[@DomainObjectLayout]
|User interface hints for domain object (entities and optionally view models)
|UI
|Yes

|xref:refguide:applib:index/annotation/DomainService.adoc[@DomainService]
|Class is a domain service (rather than an entity or view model)
|Domain
|

|xref:refguide:applib:index/annotation/DomainServiceLayout.adoc[@DomainServiceLayout]
|User interface hints for domain services
|UI
|

|xref:refguide:applib:index/annotation/Parameter.adoc[@Parameter]
|Domain semantics for action parameters
|Domain
|

|xref:refguide:applib:index/annotation/ParameterLayout.adoc[@ParameterLayout]
|Layout hints for an action parameter (currently: its label position either to top or the left).
|UI
|Yes

|xref:refguide:applib:index/annotation/Property.adoc[@Property]
|Domain semantics for properties
|Domain
|

|xref:refguide:applib:index/annotation/PropertyLayout.adoc[@PropertyLayout]
|Layout hints for a property
|UI
|Yes


|===



