sockeqwe / fragmentargs

Annotation Processor for setting arguments in android fragments
http://hannesdorfmann.com/android/fragmentargs
Apache License 2.0
1.08k stars 87 forks source link

Automatic Parceler support #56

Open bryant1410 opened 8 years ago

bryant1410 commented 8 years ago

@Arg(bundler = ParcelerArgsBundler.class) has to be used with bundler-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.

sockeqwe commented 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.

bryant1410 commented 8 years ago

I think it's a good idea what you pose, and yes with a doubtful tradeoff, at least by now.

nkleban commented 7 years ago

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.