@Documented
@Target(value=METHOD)
public @interface Prop
The method that is annotated with this annotation must also comply with the following constraints:
ReactComponentSuppressWarnings or SuppressReact4jWarnings annotations with a key
"React4j:PublicMethod". This warning is also suppressed by the annotation processor if it is implementing
an interface method.
ReactComponent annotation as the method is not
expected to be invoked outside the component. 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 component should check whether the value of the prop is disposed
prior to rendering.
|
boolean |
immutable
True if the prop is not expected to change after initial value is set.
|
java.lang.String |
name
Return the name of the prop.
|
Feature |
observable
Indicate whether the prop should be annotated by
Observable. |
Feature |
require
Return enum indicating whether prop should be when component is constructed.
|
Feature |
shouldUpdateOnChange
Indicate whether changing the value of the prop should schedule a re-render.
|
@Nonnull public abstract java.lang.String name
public abstract Feature require
Feature.ENABLE then the user MUST supply the prop and the builder will require the user
to specify the value. If set to Feature.DISABLE then the user can optionally supply the prop.
If set to Feature.AUTODETECT then the annotation processor will treat it as Feature.DISABLE
if there is a corresponding PropDefault for the prop, otherwise it will be treated as
Feature.ENABLE.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 prop 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 prop 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 typeKeyedArezComponent where the ArezComponent.requireId() parameter does not resolve to Feature.DISABLEActAsComponent. It is assumed that every implementation is an Arez component where the ArezComponent.requireId() parameter does not resolve to Feature.DISABLEIt 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.
In the future, the annotation processor may include additional allowable types such as those that implement
Identifiable directly or other primitive types within the runtime library. These other
types will be added if demand is established, othewise an additional hook will be added to allow users to
customize key generation using a static method on the component.