@Target(value={METHOD,FIELD})
@Retention(value=CLASS)
public @interface ModelProp
ModelView to automatically generate EpoxyModels from custom
views - https://github.com/airbnb/epoxy/wiki/Generating-Models-from-View-Annotations
This annotation should be used on setter methods within a custom view class. Setters annotated with this will have a corresponding field on the generated model.
Alternatively, if your setter has no side effects, you can use this annotation on a field to have Epoxy set that field directly and avoid the boiler plate of a setter.
For convenience you can use TextProp instead for props representing text.
Similarly you can use CallbackProp for props representing listeners or callbacks.
Alternatively, the options() parameter can be used to configure a prop.
| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String |
defaultValue
The name of the constant field that should be used as the default value for this prop.
|
java.lang.String |
group
Specify an optional group name.
|
ModelProp.Option[] |
options
Specify any
ModelProp.Option values that should be used when generating the model class. |
ModelProp.Option[] |
value
The same as
options(), but this allows the shortcut of setting an option eg
"@ModelProp(DoNotHash)". |
public abstract ModelProp.Option[] options
ModelProp.Option values that should be used when generating the model class.public abstract ModelProp.Option[] value
options(), but this allows the shortcut of setting an option eg
"@ModelProp(DoNotHash)".public abstract java.lang.String defaultValue
For example, you would define a constant in your view class like static final int
DEFAULT_NUM_LINES = 3, and then set this parameter to "DEFAULT_NUM_LINES" so that the
annotation processor knows what constant to reference.
The name of the constant must be used instead of referencing the constant directly since objects are not valid annotation parameters.