@Documented
@Target(value=METHOD)
public @interface Input
The method that is annotated with this annotation must also comply with the following constraints:
View
SuppressWarnings
or SuppressReact4jWarnings
annotations with a key
"React4j:PublicMethod". This warning is also suppressed by the annotation processor if it is implementing
an interface method.
View
annotation as the method is not
expected to be invoked outside the view. A warning will be generated but can be suppressed by the
SuppressWarnings
or SuppressReact4jWarnings
annotations with a key "React4j:ProtectedMethod".
Modifier and Type | Optional Element and Description |
---|---|
Feature |
disposable
Return an enum indicating whether the view should check whether the value of the input is disposed
prior to rendering.
|
boolean |
immutable
True if the input is not expected to change after initial value is set.
|
java.lang.String |
name
Return the name of the input.
|
Feature |
observable
Indicate whether the input should be annotated by
Observable . |
java.lang.String |
qualifier
Return the qualifier used to access value from context.
|
Feature |
require
Setting indicating whether the input should be supplied when the view is constructed.
|
Feature |
shouldUpdateOnChange
Indicate whether changing the value of the input should schedule a re-render.
|
Input.Source |
source
The setting controlling where the input value is source from.
|
@Nonnull public abstract java.lang.String name
source()
to Input.Source.DEFAULT
.@Nonnull public abstract java.lang.String qualifier
source()
is set to Input.Source.CONTEXT
.public abstract Input.Source source
Input.Source.CONTEXT
then the input is sometimes described as a "TreeInput"
as it is transparently passed from a parent view to all child views. A "TreeInput" does not
have to be specified by the user when creating the view.public abstract Feature require
Feature.ENABLE
then the user MUST supply the input and the builder will require the user
to specify the value. If set to Feature.DISABLE
then the user can optionally supply the input.
If set to Feature.AUTODETECT
then the annotation processor will treat it as Feature.DISABLE
if there is a corresponding InputDefault
for the input or the source()
parameter is set to
Input.Source.CONTEXT
, otherwise it will be treated as Feature.ENABLE
. The value of this setting
must not be Feature.ENABLE
when source()
is set to Input.Source.CONTEXT
.public abstract Feature shouldUpdateOnChange
Feature.AUTODETECT
then the annotation processor will treat it as
Feature.ENABLE
unless immutable()
is set to true
.public abstract Feature observable
Observable
.
If set to Feature.AUTODETECT
then the input will be observable if and only if:
shouldUpdateOnChange()
is not set to Feature.DISABLE
.Memoize
or Observe
.public abstract Feature disposable
Feature.AUTODETECT
then the annotation processor will inspect the
type of the input and treat it as Feature.ENABLE
if the type is annotated with the ArezComponent
annotation or the ActAsComponent
annotation.public abstract boolean immutable
Boolean
, Short
etc).String
typeKeyed
ArezComponent
where the ArezComponent.requireId()
parameter does not resolve to Feature.DISABLE
ActAsComponent
. It is assumed that every implementation is an Arez component where the ArezComponent.requireId()
parameter does not resolve to Feature.DISABLE
Identifiable
Keyed
interface, then the Identifiable
interface and if these strategies are not possible then toString() will be invoked on the input.It should be noted that if a type implements Keyed
and is annotated with either ArezComponent
or ActAsComponent
then the annotation processor will assume the Keyed
interface is to used in
preference to other alternative strategies.