Added parceler @Extra and @InstanceState support#1559
Added parceler @Extra and @InstanceState support#1559yDelouis merged 4 commits intoandroidannotations:developfrom
@Extra and @InstanceState support#1559Conversation
8c4d13e to
4849b9c
Compare
There was a problem hiding this comment.
you already added this method in AnnotationHelper any chance to use that one?
There was a problem hiding this comment.
I certainly could, but I wasn't sure how to get ahold of AnnotationHelper other than making isAnnotatedWith static. What do you suggest?
There was a problem hiding this comment.
I'd pass the AnnotationHelper to the intent builder.
Add it to the constructor, then update the ActivityIntentBuilder and ServiceIntentBuilder to constructors and thier instantiations. where they are instantiated there is annotationHelper field from parent class available.
but i think you should do that in a separate commit before doing the work that adds the parceler support
There was a problem hiding this comment.
I think you still forgot to remove the method from here.
There was a problem hiding this comment.
It got missed in the rebase.. should be removed now.
4849b9c to
384f4d9
Compare
There was a problem hiding this comment.
Parcels.wrap/unwrap method can handle List<AnnotatedWithParcel> AFAIK, or even more. We should also allow those.
There was a problem hiding this comment.
Parceler can also handle boxed primitives in collections:
List<Integer>, Map<Integer, String>
A mix:
Map<String, AnnotatedWithParcel>
And nested collections:
Map<List<String>, List<AnnotatedWithParcel>>
Would you like these cases handled as well?
There was a problem hiding this comment.
If you can add it, it would be great. However we should also check that we have Parceler on the classpath (when the user adds a List of primitives for examples, we cannot be sure because we are not checking any annotation).
There was a problem hiding this comment.
I've been going with the assumption that if you annotate your bean with @Parcel that would mean Parceler is on the classpath. Perhaps we should just support collections with supported types and at least one bean annotated with @Parcel... would that be acceptable instead of checking explicitly that Parceler is on the classpath?
There was a problem hiding this comment.
@johncarl81 it is very easy to check it is on the classpath: elementUtils.getTypeElement("org.parceler.Parcel") != null. We use this type of check for lots of things throughout AA.
There was a problem hiding this comment.
Ok, that will work nicely, I'll move forward with that then.
There was a problem hiding this comment.
I'm finding that matching types following the critieria we discussed may be a bit overzelous. For instance, this is matching the ArrayList<String> listExtra in ExtraInjectedActivity. Should we be serializing this through Parceler?
There was a problem hiding this comment.
No, i think we should only serialize those objects through Parceler which are not in plain Android.
There was a problem hiding this comment.
Agreed... I think I have a solution, pushing shortly.
|
Sorry, but i am not sure the refactor with passing the annotationHelper = new AnnotationHelper(environment); |
1a3c81a to
fdce23e
Compare
|
Could you please update the javadoc of the annotations |
|
And I think you forgot to handle inner |
|
@yDelouis Those extra annotations are already handled by the |
|
@WonderCsabo, you're right, sorry. |
190d955 to
3dba0f3
Compare
There was a problem hiding this comment.
Can you move all Parceler-related things to another helper class (which can extend AnnotationHelper)?
There was a problem hiding this comment.
I would move PARCEL_ANNOTATION to CanonicalNameConstants and use that constant everywhere.
|
This is OK, however i realized |
f208bb5 to
b12377d
Compare
|
Ok, let me know if you like that language. By the way, if you guys would like great looking javadocs with less ceremony I'd recommend Asciidoclet |
|
We also have to add info for:
|
|
I don't see |
51d3ead to
09117a1
Compare
|
Sorry. Just ServiceAction.
|
58520e6 to
40d19d8
Compare
40d19d8 to
5df3858
Compare
|
Alright, I think I got them all and rebased against develop... let me know if there's anything else. |
|
Ping |
|
Sorry for not adding feedback, i am very busy at work :( I think this can be merged. @yDelouis ? |
|
I think so ! Thanks ! |
Added parceler `@Extra` and `@InstanceState` support
|
Fantastic! Thanks @WonderCsabo for your help on this effort, both on this PR and your attention to Eclipse support in Parceler. Without your diligence this feature would have never reached this point. |
|
@johncarl81 i hope i could help, and thank you for implementing this in AA, it was not a quick task. @yDelouis we have to update the wiki. I think we can add this information in the third party integration section. Is that OK? |
|
@johncarl81 i created a wiki page for Parceler integration, i hope everything is correct. |
|
Looks spot on @WonderCsabo. |
|
Great, thanks for checking.
|
|
@johncarl81 FYI i tried this in Gradle, and the |
|
Ah, good catch.
|
This PR offers Parceler integration which wraps and unwraps beans annotated with
@Parceltransparently when they are used in@Extraor@InstanceStateaspects. This is a rework of this previous PR: #977