Android AutoParcel Processor

Port of Google AutoValue for the Android platform

License

License

Categories

Categories

Auto Application Layer Libs Code Generators
GroupId

GroupId

com.github.frankiesardo
ArtifactId

ArtifactId

auto-parcel-processor
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

Android AutoParcel Processor
Port of Google AutoValue for the Android platform
Project URL

Project URL

https://github.com/frankiesardo/auto-parcel
Source Code Management

Source Code Management

https://github.com/frankiesardo/auto-parcel

Download auto-parcel-processor

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.frankiesardo/auto-parcel-processor/ -->
<dependency>
    <groupId>com.github.frankiesardo</groupId>
    <artifactId>auto-parcel-processor</artifactId>
    <version>0.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.frankiesardo/auto-parcel-processor/
implementation 'com.github.frankiesardo:auto-parcel-processor:0.3.1'
// https://jarcasting.com/artifacts/com.github.frankiesardo/auto-parcel-processor/
implementation ("com.github.frankiesardo:auto-parcel-processor:0.3.1")
'com.github.frankiesardo:auto-parcel-processor:jar:0.3.1'
<dependency org="com.github.frankiesardo" name="auto-parcel-processor" rev="0.3.1">
  <artifact name="auto-parcel-processor" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.frankiesardo', module='auto-parcel-processor', version='0.3.1')
)
libraryDependencies += "com.github.frankiesardo" % "auto-parcel-processor" % "0.3.1"
[com.github.frankiesardo/auto-parcel-processor "0.3.1"]

Dependencies

compile (5)

Group / Artifact Type Version
org.ow2.asm : asm jar 4.1
com.google.code.findbugs : jsr305 jar 2.0.3
org.apache.velocity : velocity jar 1.7
com.github.frankiesardo : auto-parcel jar 0.3.1
com.google.auto.service : auto-service jar 1.0-rc2

test (4)

Group / Artifact Type Version
com.google.testing.compile : compile-testing jar 0.6
com.google.android : android jar 4.1.1.4
com.google.truth : truth jar 0.25
com.google.guava : guava-testlib jar 17.0

Project Modules

There are no modules declared in this project.

AutoParcel

Build status

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.

Download

Clojars Project

Use the same dependency qualifier that you would use for AutoValue (e.g. apt)

buildscript {
  repositories {
    mavenCentral()
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
  }
}

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

repositories {
  mavenCentral()
  jcenter()
  maven {url "https://clojars.org/repo/"}
}

dependencies {
  apt 'frankiesardo:auto-parcel:{{latest-version}}'
}

Notice the clojars line in your maven repositories

I recommend using the android-apt plugin so that Android Studio picks up the generated files. Check out the sample project for a working example.

Roadmap

  • Dismantle instanceof checks speeding up runtime serialization #16
  • Walking up superclasses to ensure the object is Parcelable #7

Versions

Version
0.3.1
0.3
0.2