Skip to content

A Python script that can generate necessary codes to implement Android's Parcelable interface with support for many popular Java classes.

License

Notifications You must be signed in to change notification settings

initialxy/parcelable-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

How Does It Work?

  1. Run the Python script in command line.
  2. 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.)
  3. Press Ctrl + z in Windows or Ctrl + d in *nix, then press enter.
  4. It will spit out a chunk of code. (probably should have redirected stdout to a file eh?)
  5. Copy and paste into your Java code.
  6. Let your IDE auto format and auto import missing packages.

More Detailed Instructions?

mm... Open the Python file and read the header.

How Do I Configure It?

mm... Open the Python file and edit it. Look for the constants near the top.

Can I use it for my project(s)? Can I remove the "Generated by ..." comment?

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.

License

MIT License. See LICENSE.

About

A Python script that can generate necessary codes to implement Android's Parcelable interface with support for many popular Java classes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages