Annotation Type ModelProp


  • @Target({METHOD,FIELD})
    @Retention(CLASS)
    public @interface ModelProp
    Used in conjunction with 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.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element 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)".
      • value

        ModelProp.Option[] value
        The same as options(), 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:
        ""
      • group

        java.lang.String group
        Specify an optional group name. Multiple props with the same group name will only allow one of the props to be set on the view.

        https://github.com/airbnb/epoxy/wiki/Generating-Models-from-View-Annotations#prop-groups

        Default:
        ""