airbnb/epoxy

Use default value from kotlin setter in a model view

Open

#598 opened on Oct 30, 2018

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Java (8,412 stars) (738 forks)batch import
help wanted

Description

In @ModelView components setting default values is a pain, since the annotation @ModelProp has to take a string reference by name of a constant.

With kotlin's native support of default values, ideally the generated epoxy model could call a no-arg version of the setter to have the default value used.

The annotation processor and generated code would have to be updated for this. Main issues I see are having the annotation processor know if a default value is present (I think there is a kotlin metadata library we can use for that), and since the generated model is in java it needs to be able to access the no arg version of the function, so many jvmoverloads is required, but it would be nice to not need that

Contributor guide