A Python script that can generate necessary codes to implement Android's Parcelable interface. Aside from the obvious, following data types are supported:
- Calendar
- GregorianCalendar
- XMLGregorianCalendar
- BigDecimal
- BigInteger
- Byte
- Short
- Integer
- Long
- Float
- Double
- Char
- Boolean
- Enum Types
- List
All other unknown types are assumed to be Parcelable. Null is properly taken care of.
- Run the Python script in command line.
- Copy and paste your Java class in there. (Doesn't even have to be the whole class, just until the end of all of your fields is fine.)
- Press Ctrl + z in Windows or Ctrl + d in *nix, then press enter.
- It will spit out a chunk of code. (probably should have redirected stdout to a file eh?)
- Copy and paste into your Java code.
- Let your IDE auto format and auto import missing packages.
mm... Open the Python file and read the header.
mm... Open the Python file and edit it. Look for the constants near the top.
Sure, go for it! I put this script under MIT License, which is one of the most lenient licenses. But in all honesty, I don't care. Your call.
MIT License. See LICENSE.