Skip to content

a lightweight Java class generator written in python

Notifications You must be signed in to change notification settings

ThomasPokorny/pyGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

 ________  ___    ___ ________  _______   ________      
|\   __  \|\  \  /  /|\   ____\|\  ___ \ |\   ___  \    
\ \  \|\  \ \  \/  / | \  \___|\ \   __/|\ \  \\ \  \   
 \ \   ____\ \    / / \ \  \  __\ \  \_|/_\ \  \\ \  \  
  \ \  \___|\/  /  /   \ \  \|\  \ \  \_|\ \ \  \\ \  \ 
   \ \__\ __/  / /      \ \_______\ \_______\ \__\\ \__\
    \|__||\___/ /        \|_______|\|_______|\|__| \|__|
         \|___|/                                        
                                                   

pyGen

A lightweight Java Class generation Tool

Calling Synopsis

python pyGen.py gen.json

python pyGen.py  [json-file]

Examples

When called with the following .json File

{
    "Transport" : 
        {   "abstract":true,
            "fields": [ {"name":"generatedBool", "t":"boolean", "gs":true},  {"name":"engine", "t":"Engine"},  {"name":"someMap", "t":"Map<String,Integer>"}   ] ,
            "methods":[ {"name":"someGeneratedTestMethod", "return":"Long", "param":"ArrayList<Integer> ints, boolean isTrue"} ,
                        {"name":"someAbstractTestMethod", "abstract":true, "return":"Long", "param":"ArrayList<Integer> ints, boolean isTrue"} 
                        ] 
        },
 "Engine" : 
        {   "interface":true, 
            "methods":[ {"name":"range", "return":"int"} ]
        },

}

The resulting Java Files look like this:

(Transport.java)

public abstract class Transport
{

	private boolean generatedBool;

	private Engine engine;

	private Map<String,Integer> someMap;

	public Long someGeneratedTestMethod(ArrayList<Integer> ints, boolean isTrue)
	{
	}

	public abstract Long someAbstractTestMethod(ArrayList<Integer> ints, boolean isTrue);

	public boolean getGeneratedbool(){
		return generatedBool;
	}

	public void setGeneratedbool(boolean generatedBool){
		this.generatedBool = generatedBool;
	}
}

and

(Engine.java)

public interface Engine
{

	public int range();
}

(Note that import -, package - and method return statements are not generated yet!)

About

a lightweight Java class generator written in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages