kamikat / moshi-jsonapi

JSON API v1.0 Specification in Moshi.
MIT License
156 stars 35 forks source link

Resource implement Parcelable #79

Open dreamsbond opened 6 years ago

dreamsbond commented 6 years ago

Is there any sample illustrating the use of Parcelable for bundle parameter transfer? thanks

dreamsbond commented 6 years ago

i am having problem doing readParcelable, for example:


    public static final Parcelable.Creator<Room> CREATOR = new Creator<Room>() {
        @Override
        public Room createFromParcel(Parcel parcel) {
           Room room = new Room();

            room.setId(parcel.readString());
            room.setRoomType(parcel.readParcelable(Room.class.getClassLoader()));

            return room;
        }

        @Override
        public Room[] newArray(int i) {
            return new Room[i];
        }
    };

Change the setter did help, retrieving the relationship:

    public void setRoomType(ResourceIdentifier roomType) {
        this.roomType = new HasOne<>(roomType);
    }

did help show room type relation (HasOne linkedResource) but fail to retrieve its attribute via getDocument() method.

please help.

onemonster commented 5 years ago

Any update on this issue?

xdbas commented 4 years ago

Will Parcelable be implemented?