= Supporting Methods

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


Supporting methods are those that are associated with properties, collections and actions, providing additional imperative business rule checking and behaviour to be performed when the user interacts with those object members.

This association is performed by name matching.
Thus, a property called "firstName", derived from a method `getFirstName()` may have supporting methods `hideFirstName()`, `disableFirstName()` and `validateFirstName()`.
Supporting methods are, therefore, each characterized by their own particular prefix.


The table below lists the method prefixes that are recognized as part of Apache Causeway' default programming model.

.Method Prefixes
[cols="2m,1,1,1,1,1,4a",options="header"]
|===

|Prefix
|Object
|Property
|Collection
|Action
|Action +
Param
|Description


|xref:refguide:applib-methods:prefixes.adoc#autoComplete[autoComplete...()]
|
|Y
|
|
|Y
|Return a list of matching elements for a property or an action parameter. +

Alternatively, can specify for a class using xref:refguide:applib:index/annotation/DomainObject.adoc#autoCompleteRepository[`@DomainObject` +
`#autoCompleteRepository`] +

See also xref:refguide:applib-methods:prefixes.adoc#choices[choices...()]

|xref:refguide:applib-methods:prefixes.adoc#choices[choices...()]
|
|Y
|
|
|Y
|Provide list of choices for a property or action parameter. +

See also xref:refguide:applib-methods:prefixes.adoc#autoComplete[autoComplete...()].


|xref:refguide:applib-methods:prefixes.adoc#default[default...()]
|
|Y
|
|
|Y
|Default value for a property or an action parameter.

|xref:refguide:applib-methods:prefixes.adoc#disable[disable...()]
|Y
|Y
|
|Y
|Y
|Disables (makes read-only) a property, an action or (dynamically) an action parameter.

|xref:refguide:applib-methods:prefixes.adoc#get[get...()]
|
|Y
|Y
|
|
|Access the value of a property or collection. +

See also xref:refguide:applib-methods:prefixes.adoc#set[set...()].

|xref:refguide:applib-methods:prefixes.adoc#hide[hide...()]
|
|Y
|Y
|Y
|Y
|Hides a property, a collection, an action or (dynamically) an action parameter.


|xref:refguide:applib-methods:prefixes.adoc#set[set...()]
|
|Y
|
|
|
|Sets the value of a property.


|xref:refguide:applib-methods:prefixes.adoc#validate[validate...()]
|
|Y
|
|Y
|Y
|Validate the proposed value of a property or an action parameter.


|===


[NOTE]
====
Using name matching to associate supporting methods generally works very well, but of course if an object member's method is renamed, there's always the risk that the developer forgets to rename the supporting method; the supporting methods become "orphaned".

Apache Causeway checks for this automatically, and will fail-fast (fail to boot) if any orphaned methods are located.
A suitable error message is logged so that the issue can be easily diagnosed.
====


include::partial$prefixes/autoComplete.adoc[leveloffset=+1]
include::partial$prefixes/choices.adoc[leveloffset=+1]
include::partial$prefixes/default.adoc[leveloffset=+1]
include::partial$prefixes/disable.adoc[leveloffset=+1]
include::partial$prefixes/get.adoc[leveloffset=+1]
include::partial$prefixes/hide.adoc[leveloffset=+1]
include::partial$prefixes/set.adoc[leveloffset=+1]
include::partial$prefixes/validate.adoc[leveloffset=+1]
