Package react4j.annotations
Annotation Interface Input
Annotation used to specify an input.
The property is extracted from Reacts underlying props object. By default the input is passed as a
value in when creating the view but it can also be retrieved from the react context.
When applied to an abstract method, the input is mutable.
When applied to a constructor parameter, the input is immutable.
If applied to a method, the method that is annotated with this annotation must also comply with the following constraints:
- Must not be annotated with any other react annotation
- Must have 0 parameters
- Must return a value
- Must be an abstract instance method
- Must not throw exceptions
- Must be accessible from the same package as the class annotated by
View -
Should not be public as not expected to be invoked outside the view. A warning will be generated but can
be suppressed by the
SuppressWarningsorSuppressReact4jWarningsannotations with a key "React4j:PublicMethod". This warning is also suppressed by the annotation processor if it is implementing an interface method. -
Should not be protected if in the class annotated with the
Viewannotation as the method is not expected to be invoked outside the view. A warning will be generated but can be suppressed by theSuppressWarningsorSuppressReact4jWarningsannotations with a key "React4j:ProtectedMethod". -
Should be annotated with either
NonnullorNullableif the return type is not a primitive. A warning will be generated but can be suppressed by theSuppressWarningsorSuppressReact4jWarningsannotations with a key "React4j:MissingInputNullability".
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanReturntrueif the input value should be sourced from tree context rather than supplied when creating the view.Return the name of the input.Indicate whether the input should be annotated byObservable.Return the qualifier used to access value from context.Setting indicating whether the input should be supplied when the view is constructed.
-
Element Details
-
name
Return the name of the input. The name is the key used when accessing the input from the inputs object. It is also used when creating the builder steps associated with inputs that are not sourced from tree context.- Returns:
- the name of the input.
- Default:
- "<default>"
-
qualifier
Return the qualifier used to access value from context. It must only be specified iffromTreeContext()is set totrue.- Returns:
- the qualifier used to access value from context.
- Default:
- ""
-
fromTreeContext
boolean fromTreeContextReturntrueif the input value should be sourced from tree context rather than supplied when creating the view. Inputs sourced from tree context are transparently passed from a parent view to descendant views and do not need to be specified by the user when creating the view.- Returns:
trueif the input value should be sourced from tree context.
- Default:
- false
-
require
Setting indicating whether the input should be supplied when the view is constructed. This influences validation when enabled and how the Builder class is created. If set toFeature.ENABLEthen the user MUST supply the input and the builder will require the user to specify the value. If set toFeature.DISABLEthen the user can optionally supply the input. If set toFeature.AUTODETECTthen the annotation processor will treat it asFeature.DISABLEif there is a correspondingInputDefaultfor the input orfromTreeContext()istrue, otherwise it will be treated asFeature.ENABLE. The value of this setting must not beFeature.ENABLEwhenfromTreeContext()istrue.- Returns:
- the flag indicating whether the input needs to be supplied.
- Default:
- AUTODETECT
-
observable
Indicate whether the input should be annotated byObservable.If set to
Feature.AUTODETECTthen the input will be observable if and only if:- Returns:
- the enum indicating whether input is observable.
- Default:
- AUTODETECT
-