Package arez.annotations
Annotation Interface Reference
A Reference annotation is placed on an abstract method that will resolve to a referenced object.
The reference annotation is paired with a
ReferenceId
method that returns the id
of the referenced object. The type
of the referenced object is the return type of the method
annotated with @Reference
. The type
and id
are passed to the
Locator.findById(Class, Object)
method when the reference is resolved.
* The reference can be resolved either eagerly (during a linking phase or when it is modified) or lazily (when accessed).
The method must also conform to the following constraints:
- Must not be annotated with any other arez annotation
- Must have 0 parameters
- Must return a value
- Must be abstract
- Must not throw exceptions
- Must be accessible to the class annotated by the
ArezComponent
annotation.
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionReturn the enum controlling whether there is an inverse for reference.Define the expected multiplicity of the inverse associated with the reference.Return the name of the inverse associated with the reference.Return the strategy for resolving reference.Return the name of the reference relative to the component.
-
Element Details
-
name
Return the name of the reference relative to the component. The value must conform to the requirements of a java identifier. If not specified, the name will be derived by assuming the naming convention "get[Name]" or failing that the name will be the method name.- Returns:
- the name of the reference relative to the component.
- Default:
- "<default>"
-
load
Return the strategy for resolving reference.- Returns:
- the strategy for resolving reference.
- Default:
- EAGER
-
inverse
Return the enum controlling whether there is an inverse for reference.Feature.ENABLE
tells the annotation processor to expect an inverse and add code to maintain the inverse.Feature.DISABLE
will generate no code to maintain inverse module.Feature.AUTODETECT
will be treated asFeature.ENABLE
if either theinverseName()
orinverseMultiplicity()
is specified.- Returns:
- the enum controlling whether there is an inverse for reference
- Default:
- AUTODETECT
-
inverseName
Return the name of the inverse associated with the reference. The value must conform to the requirements of a java identifier. If not specified, the name will be derived by camelCasing the simple name of the class on which theReference
annotation is placed and then adding an s ifinverseMultiplicity()
isMultiplicity.MANY
.- Returns:
- the name of the reference relative to the component.
- Default:
- "<default>"
-
inverseMultiplicity
Define the expected multiplicity of the inverse associated with the reference.- Returns:
- the expected multiplicity of the inverse associated with the reference.
- Default:
- MANY
-