Generate model for abstract class if class annotation is present #105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@felipecsl @gpeal @seanabraham
This forces the annotation processor to generate a model for abstract model classes if they have the
@EpoxyClassModel
attribute. Previously abstract classes never had a model generated for them since we couldn't know if they implemented every necessary method. This annotation approach allows users to tell the processor if they want a model generated.We may like to use an abstract class for all our models to indicate that they shouldn't be instantiated directly, and to prevent people from accidentally using them instead of the generated class.
In this PR I also add a new feature to automatically generate the
createNewHolder
method on models that use view holders. This method was mostly boilerplate and we can generate it by looking at the type of the class and just returning a new object of that type.For example, in our sample app we now have the class
This is a small win to reduce boilerplate.
Besides that I did some cleanup - moving util methods to a ProcessorUtils class - and a little other refactoring clean up since the processor is getting large and more complicated.