Monthly Archives: February 2013

ParcelableCodeGenerator

If you are used to coding Android applications, there is a good chance that you had to write some Parcelable classes.

A quick reminder about Parcelable : It’s an interface you can implement on your classes. If you do so, you can then store the whole class in a Bundle or as an Intent extra.
My webservice library, DataDroid, use Parcelable objects to retrieve the result from the webservices if you don’t use a Database to store your data.

There is one downside with Parcelable … You need to write a LOT of boilerplate to implement the Parcelable interface in your class. And as every good software engineer, I’m lazy :D
Which brings us to ParcelableCodeGenerator !!

You can find all the information on its GitHub page, but here is a short explanation :

  • You clone the repository and import the Java project in Eclipse (or your favorite IDE)
  • You write a JSON file defining your Parcelable class in the input folder (you can use subfolders to sort your files). Examples are provided to learn the syntax
  • You run the project as a Java Project
  • The corresponding classes are “magically” generated in the output folder ready for you to copy them in your project

It’s really easy to use and it’s going to save you a lot of time.

Last important thing : the project license. As all my other projects, it is released under the Beerware license :

You can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.

Page optimized by WP Minify WordPress Plugin