@Documented
@Target(value=METHOD)
public @interface Prop
The method that is annotated with this annotation must also comply with the following constraints:
ReactComponent
Modifier and Type | Optional Element and Description |
---|---|
Feature |
disposable
Return an enum indicating whether prop is disposable and should be checked before rendering component.
|
java.lang.String |
name
Return the name of the prop.
|
Feature |
observable
Indicate whether the prop is an Arez observable.
|
Feature |
require
Return enum indicating whether prop should be when component is constructed.
|
Feature |
shouldUpdateOnChange
Return an enum indicating whether prop should trigger a change if it updated.
|
@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.ENABLE
then the code will check the prop when implementing
shouldComponentUpdate
while setting the value to Feature.DISABLE
will result in
the value of the prop being ignored when determining whether a prop change should cause a re-render.
If set to Feature.AUTODETECT
then the annotation processor will treat it as Feature.ENABLE
.public abstract Feature observable
Feature.ENABLE
the generated class will make the prop observable and report changes
in the prop when the prop changes. The component MUST be a subclass of ReactArezComponent
.
If set to Feature.DISABLE
then the prop will not be observable. If set to Feature.AUTODETECT
then the prop will be observable if the component is a subclass of ReactArezComponent
, the value
of shouldUpdateOnChange()
is not Feature.DISABLE
and the component has a method
annotated with arez.annotations.Computed
, arez.annotations.Memoize
or
arez.annotations.Observe
.public abstract Feature disposable
ReactArezComponent.anyPropsDisposed()
and check whether the prop is disposed prior to attempting to render the component. If any props
are disposed then rendering will be aborted and the render method will return null.
If set to Feature.ENABLE
then the code will add an isDisposed() check while if set to
Feature.DISABLE
no such check will be generated. If set to 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 arez.annotations.ArezComponent
annotation and the host component is
an Arez component. It is invalid to specify Feature.ENABLE
unless the host component is an Arez
component.