We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a user model as shown below
import org.parceler.Parcel; import org.parceler.ParcelConstructor; import org.parceler.ParcelPropertyConverter; import org.threeten.bp.OffsetDateTime; @Parcel public class User { String firstName; String lastName; @ParcelPropertyConverter(OffsetDateTimeParcelConverter.class) OffsetDateTime createdAt; @ParcelConstructor public User(String firstName, String lastName, OffsetDateTime createdAt) { this.firstName = firstName; this.lastName = lastName; this.createdAt = createdAt; } }
with the createdAt OffsetDateTime field annotated with a @ParcelPropertyConverter, but the converter is not used when writing this field to a parcel.
createdAt
@ParcelPropertyConverter
This is the generated parcelable class i get
@Generated("org.parceler.ParcelAnnotationProcessor") @SuppressWarnings({ "unchecked", "deprecation" }) public class User$$Parcelable implements Parcelable, ParcelWrapper<com.edwinnyawoli.parcelerissuetest.User> { private com.edwinnyawoli.parcelerissuetest.User user$$0; @SuppressWarnings("UnusedDeclaration") public final static Creator<User$$Parcelable>CREATOR = new Creator<User$$Parcelable>() { @Override public User$$Parcelable createFromParcel(android.os.Parcel parcel$$2) { return new User$$Parcelable(read(parcel$$2, new IdentityCollection())); } @Override public User$$Parcelable[] newArray(int size) { return new User$$Parcelable[size] ; } } ; public User$$Parcelable(com.edwinnyawoli.parcelerissuetest.User user$$2) { user$$0 = user$$2; } @Override public void writeToParcel(android.os.Parcel parcel$$0, int flags) { write(user$$0, parcel$$0, flags, new IdentityCollection()); } public static void write(com.edwinnyawoli.parcelerissuetest.User user$$1, android.os.Parcel parcel$$1, int flags$$0, IdentityCollection identityMap$$0) { int identity$$0 = identityMap$$0 .getKey(user$$1); if (identity$$0 != -1) { parcel$$1 .writeInt(identity$$0); } else { parcel$$1 .writeInt(identityMap$$0 .put(user$$1)); parcel$$1 .writeString(user$$1 .firstName); parcel$$1 .writeString(user$$1 .lastName); parcel$$1 .writeSerializable(user$$1 .createdAt); } } @Override public int describeContents() { return 0; } @Override public com.edwinnyawoli.parcelerissuetest.User getParcel() { return user$$0; } public static com.edwinnyawoli.parcelerissuetest.User read(android.os.Parcel parcel$$3, IdentityCollection identityMap$$1) { int identity$$1 = parcel$$3 .readInt(); if (identityMap$$1 .containsKey(identity$$1)) { if (identityMap$$1 .isReserved(identity$$1)) { throw new ParcelerRuntimeException("An instance loop was detected whild building Parcelable and deseralization cannot continue. This error is most likely due to using @ParcelConstructor or @ParcelFactory."); } return identityMap$$1 .get(identity$$1); } else { com.edwinnyawoli.parcelerissuetest.User user$$4; int reservation$$0 = identityMap$$1 .reserve(); java.lang.String string$$0 = parcel$$3 .readString(); java.lang.String string$$1 = parcel$$3 .readString(); org.threeten.bp.OffsetDateTime offsetDateTime$$0 = ((org.threeten.bp.OffsetDateTime) parcel$$3 .readSerializable()); user$$4 = new com.edwinnyawoli.parcelerissuetest.User(string$$0, string$$1, offsetDateTime$$0); identityMap$$1 .put(reservation$$0, user$$4); com.edwinnyawoli.parcelerissuetest.User user$$3 = user$$4; identityMap$$1 .put(identity$$1, user$$3); return user$$3; } } }
The text was updated successfully, but these errors were encountered:
This may be an oversight, trying to think of why this was implemented the way it is.
In the meantime you can move the converter to your constructor:
@Parcel public class User { String firstName; String lastName; OffsetDateTime createdAt; @ParcelConstructor public User(String firstName, String lastName, @ParcelPropertyConverter(OffsetDateTimeParcelConverter.class) OffsetDateTime createdAt) { this.firstName = firstName; this.lastName = lastName; this.createdAt = createdAt; } }
Sorry, something went wrong.
No branches or pull requests
I have a user model as shown below
with the
createdAt
OffsetDateTime field annotated with a@ParcelPropertyConverter
, but the converter is not used when writing this field to a parcel.This is the generated parcelable class i get
The text was updated successfully, but these errors were encountered: