frankiesardo / auto-parcel
posted
Category: Utils
Minimum SDK Level: None (1 | 1.0)

Badge

View in Github Github project information
Starred: 1251
Forks: 75
Watchers: 54
Open Issues: 7

Snapshot pictures

No snapshot for this library yet.

Description

AutoParcel is an AutoValue extension that enables Parcelable values generation.

Just add implements Parcelable to your @AutoValue annotated models.

@AutoValue
abstract class Person implements Parcelable {
  abstract String name();
  abstract List<Address> addresses();
  abstract Map<Person, Integer> likes();

  static Person create(String name, List<Address> addresses, Map<Person, Integer> likes) {
    return new AutoValue_Person(name, addresses, likes);
  }
}

That's that simple. And you get Parcelable, hashCode, equals and toString implementations for free.

As your models evolve you don't need to worry about keeping all the boilerplate in sync with the new implementation, it's already taken care of.

2

See also