No commit activity in last 3 years
No release in over 3 years
Ruby script generating JSON model objects in Java when using GSON
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 0
 Project Readme

GSONClassGenerator Gem Version

Ruby script generating JSON model objects in Java when using GSON.

The classes can be used as is, or just generated for quickness instead of manually typing them all out.

The field names in the JSON are normalized, stripping out invalid characters and also converted to camel case to fit in with Java and produce cleaner code.

Installation

The easiest way is using ruby gems:

gem install gson-class-generator

Usage

gson-class-generator [-gfscb] json_file class_name [output_directory]

Arguments

json_file - The file you want to generate the model class from.

class_name - The top level class name, and therefore the name of the output file.

output_directory - The location to save the generated model class. If this is not provided the current directory will be used.

Flags

g - Generate getters.

s - Generate setters.

f - All fields are final, this will also generate a public no argument constructor for all classes and the 's' flag is ignored.

c - A public constructor is generated for all the classes with all the fields as arguments.

b - All primative types are boxed.