KanishR KanishR - 9 months ago 60
Android Question

@SerializedName("home") is it invalid annotation in order to implemnt parcelable

I am using Retrofit and have many pojo class according to json.Since i am Using Gson parsing I need to use:

private List<Home> home = new ArrayList<>();

private List<Away> Away= new ArrayList<>();

public List<Home> getHome() {
return home;

Now I want to implement Parcelable in all pojo class.

I am not very sure will
name annotation use java serialization or just a name check annotation?

Will it add any runtime exceptions while unmarshalling in parcel?

Answer Source

There's no problem with SerializedName and Parcelable.

SerializedName is a GSON annotation for specifying JSON property names and has really nothing to do with Java serialization.

When you implement Parcelable, you write the marshal/unmarshal code yourself (or generate it yourself) and no reflection or annotation lookup needs to happen at runtime.