Annotation Type ModelProp
-
@Target({METHOD,FIELD}) @Retention(CLASS) public @interface ModelPropUsed in conjunction withModelViewto automatically generate EpoxyModels from custom views - https://github.com/airbnb/epoxy/wiki/Generating-Models-from-View-AnnotationsThis 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
TextPropinstead for props representing text.Similarly you can use
CallbackPropfor props representing listeners or callbacks.Alternatively, the
options()parameter can be used to configure a prop.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringdefaultValueThe name of the constant field that should be used as the default value for this prop.java.lang.StringgroupSpecify an optional group name.ModelProp.Option[]optionsSpecify anyModelProp.Optionvalues that should be used when generating the model class.ModelProp.Option[]valueThe same asoptions(), but this allows the shortcut of setting an option eg "@ModelProp(DoNotHash)".
-
-
-
Element Detail
-
options
ModelProp.Option[] options
Specify anyModelProp.Optionvalues that should be used when generating the model class.- Default:
- {}
-
-
-
value
ModelProp.Option[] value
The same asoptions(), but this allows the shortcut of setting an option eg "@ModelProp(DoNotHash)".- Default:
- {}
-
-
-
defaultValue
java.lang.String defaultValue
The name of the constant field that should be used as the default value for this prop. The default value will be used if the prop value isn't set on the model.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.
- Default:
- ""
-
-