Annotation Interface ArezComponent
Observable properties,
Memoize properties, Observe methods and Action methods.
The annotation controls the way that contained actions and observables are named (if names are enabled in the system.
- The value returned by
name()indicates the type name for instances of this object. If not specified it will default to the SimpleName of the class. i.e. The classcom.biz.models.MyModelwill default to a name of "MyModel".
The name of any elements contained within the component follows the pattern
"[ArezComponent.name].[ArezComponent.id].[Element.name]".
The type that is annotated with this annotation must comply with the additional constraints:
- Must be a class or an interface
- Must be abstract
- Must not be final
- Must not be a non-static nested class
- Must have at least one method annotated with
Action,Observe,MemoizeorObservable
The annotation processor that handles this annotation will analyze all super classes and super
interfaces. This includes analysis of default methods on interfaces. So it is perfectly valid to
add annotations such as Observable, Memoize, Action, PreDispose and/or
PostDispose to default methods on implemented interfaces.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanReturn true if the component does not need to explicitly declare elements.The default value for the readOutsideTransaction parameter ofMemoizeandObservableannotated methods.The default value for the writeOutsideTransaction parameter ofObservableannotated methods.Return enum to control whether the component should support implement theDisposeNotifierinterface.booleanReturn true if the component should dispose itself once it is no longer "observed".Return the name of the type.The enum to control whether the component should support being "observed" by implementing theComponentObservableinterface and allowing invocation of theComponentObservable.observe(Object)method.Indicate whether theObject.hashCode()andObject.equals(Object)methods need to be implemented.Indicates whether the component should support access of the id viaIdentifiable.getArezId(Object).An enum controlling whether the component is treated like a service or an entity.Enum controlling whether sting integration is enabled.Indicates whether the component should implement the interfaceVerifiable.Indicate whether references to the component should also be annotated withCascadeDisposeorComponentDependency.
-
Element Details
-
name
Return the name of the type. The value must conform to the requirements of a java identifier.- Returns:
- the name of the type.
- Default:
- "<default>"
-
allowEmpty
boolean allowEmptyReturn true if the component does not need to explicitly declare elements. Otherwise if no elements (i.e.Observables,Actions,Observes etc) are defined on a component it will generate an error.- Returns:
- true if the component does not need to explicitly declare elements, false otherwise.
- Default:
- false
-
service
An enum controlling whether the component is treated like a service or an entity. A service is expected to be a long running component that exists based on the functionality of the application while an entity represents data within the application and may come and go based on changes in the application data. Within arez, the only practical effect is to change the default behaviour of other features. See the documentation for other parameters for further details.If set as
Feature.AUTODETECTor left as the default value, then Arez will assumes that if the component is injected using dependency injection, then the component is a service. Arez detects whether the type is annotated by the sting annotationssting.Named,sting.Typedandsting.Eageror the jsr330 annotationjavax.inject.Namedor any annotation that is annotated withjavax.inject.Scopeannotation. If such an annotation is found then the component defaults to being treated like a service.- Returns:
- an enum controlling whether the component is treated like a service or an entity.
- Default:
- AUTODETECT
-
observable
The enum to control whether the component should support being "observed" by implementing theComponentObservableinterface and allowing invocation of theComponentObservable.observe(Object)method. If unset or explicitly set toFeature.AUTODETECTthen the component will implement the interface if thedisposeOnDeactivate()parameter istrue.- Returns:
- enum to control whether the component should support being "observed".
- Default:
- AUTODETECT
-
disposeNotifier
Return enum to control whether the component should support implement theDisposeNotifierinterface. This will result in the component invoking dispose listener callbacks during dispose operation within the scope of the disposing transaction.If the value of this parameter is
Feature.AUTODETECTthen theDisposeNotifierinterface is not implemented if theservice()resolves toFeature.ENABLE.- Returns:
- Return enum to control whether the component should implement DisposeNotifier.
- Default:
- AUTODETECT
-
disposeOnDeactivate
boolean disposeOnDeactivateReturn true if the component should dispose itself once it is no longer "observed". By "observed" it means that the component will haveComponentObservable.observe(Object)called on it. This parameter MUST be false ifobservable()has the valueFeature.DISABLE.- Returns:
- true if the component should dispose itself once it is no longer "observed".
- Default:
- false
-
sting
Enum controlling whether sting integration is enabled. If enabled, the annotation processor will add sting annotations to the generated component implementation. If the value of this parameter isFeature.AUTODETECTthen sting integration will be enabled if theservice()resolves toFeature.ENABLEand thesting.Injectorclass is present on the classpath.- Returns:
- an enum controlling whether a sting integration is enabled.
- Default:
- AUTODETECT
-
requireEquals
Indicate whether theObject.hashCode()andObject.equals(Object)methods need to be implemented. If set toFeature.AUTODETECTthen the methods will not be generated.- Returns:
- an enum whether the
Object.hashCode()andObject.equals(Object)methods need to be implemented.
- Default:
- AUTODETECT
-
requireId
Indicates whether the component should support access of the id viaIdentifiable.getArezId(Object). TheFeature.AUTODETECTwill be treated asFeature.ENABLE. This feature must be enabled in the following scenarios:- a method annotated with the
Inverseannotation is present. - a method annotated with the
ComponentIdannotation is present. - a method annotated with the
ComponentIdRefannotation is present.
- Returns:
- enum controlling whether a unique if of the component can be accessed via
Identifiable.getArezId(Object).
- Default:
- AUTODETECT
- a method annotated with the
-
verify
Indicates whether the component should implement the interfaceVerifiable. This feature is ignored unlessArez.isVerifyEnabled()is true. TheFeature.AUTODETECTvalue will enable this feature if the component has anyReferencemethods or anyInversemethods.- Returns:
- enum that indicates whether the component should implement the interface
Verifiable.
- Default:
- AUTODETECT
-
verifyReferencesToComponent
Indicate whether references to the component should also be annotated withCascadeDisposeorComponentDependency. This is used to ensure that when a component is disposed that any reference to the component from another component is rectified. The annotation processor will warn if the above rules are violated.Feature.ENABLEwill tell the annotation to warn if references to component are invalid.Feature.DISABLEdisables the warning.Feature.AUTODETECTwill enable the warning if thedisposeNotifier()resolves toFeature.ENABLE.- Returns:
- enum controlling whether a references to components should be explicitly managed.
- Default:
- AUTODETECT
-
defaultPriority
The default priority used byMemoizeandObserveannotated methods. This parameter should only be specified if there areMemoizeorObserveannotated methods present on the component.- Default:
- NORMAL
-
defaultReadOutsideTransaction
The default value for the readOutsideTransaction parameter ofMemoizeandObservableannotated methods.- Returns:
- The flag indicating whether the default is to allow reads outside a transaction or to require a transaction to read observables and memoized values.
- Default:
- AUTODETECT
-
defaultWriteOutsideTransaction
The default value for the writeOutsideTransaction parameter ofObservableannotated methods.- Returns:
- The flag indicating whether the default is to allow writes outside a transaction or to require a transaction to write observables values.
- Default:
- AUTODETECT
-