Open bryant1410 opened 8 years ago
Yes, that could be done, but I didn't wanted to depend on a third party library like Parceler. The reason is that every time Parceler makes a release with breaking changes or new features, FragmentArgs must be updated and released too. So that might not be the biggest issue with only Parceler integration, but imagine that there are 4 more other third party libraries integrated in FragmentArgs. I hope you get the point.
However, I was thinking about an alternative solution: In a nutshell: to go the same way that AutoValue did by providing Extensions for the Annotation Processor. Then one could write a FragmenArgs Annotation Processor Extension for Parceler which would generate code during annotation processing.
But I'm not too sure if it is worth the effort right now.
I think it's a good idea what you pose, and yes with a doubtful tradeoff, at least by now.
The way that AutoValue did is really good. An idea that you have to insert this line "@Arg(bundler = ParcelerArgsBundler.class)" with every parcelable field unfortunately stopping us from using it in every our projects.
@Arg(bundler = ParcelerArgsBundler.class)
has to be used withbundler-parceler
, doesn't it? Maybe an approach can be taken in which it automatically detects that@Parcel
is present in the class, as in Dart.