frankiesardo / auto-parcel

Android Parcelable models made easy
Eclipse Public License 1.0
1.37k stars 83 forks source link

toBuilder() function is included in the constructor for the auto generated parcel code. #51

Open RoryKelly opened 7 years ago

RoryKelly commented 7 years ago

Builder toBuilder() function is included in the constructor for the auto generated parcel code.

Error:(128, 14) error: no suitable constructor found for AutoValue_TestSection(String,List<QuoteGroup>,Integer)
constructor AutoValue_TestSection.AutoValue_TestSection(String,List<QuoteGroup>,Integer,Builder) is not applicable
(actual and formal argument lists differ in length)
constructor AutoValue_TestSection.AutoValue_TestSection(Parcel) is not applicable
(actual and formal argument lists differ in length)

Example class.

@AutoValue @AutoGson public abstract class TestSection implements Parcelable, Comparable<TestSection> {

    public abstract String name();
    public abstract List<QuoteGroup> quoteGroups();
    public abstract Integer id();
    public abstract Builder toBuilder();

    @Override public int compareTo(@NonNull TestSection testSection) {
        return id().compareTo(testSection.id());
    }

    @AutoValue.Builder public abstract static class Builder {
        public abstract Builder name(String name);
        public abstract Builder quoteGroups(List<QuoteGroup> quoteGroups);
        public abstract Builder id(Integer id);
        public abstract TestSection build();
    }
}