Skip to content

A simple Java code generator, that takes YAML as an input to generate data classes.

License

Notifications You must be signed in to change notification settings

singhjava592/javadataclass

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javadataclass

A simple Java source file generator, that takes a YAML file as an input.

Here's the content of an example YAML file:

User:
    name: Name
    age: Integer
    
Name:
    firstName: String
    lastName: String

From this file, 2 Java source files will be generated, User.java and Name.java.

For the sake of simplicity, the Java source files will be generated in the same directory as the YAML file.

The contents of these two files are:

User.java:

public class User{
	private Name name;
	private Integer age;

	public User(){
	}
	
	public Name getName(){
		return name;
	}
	public void setName(Name name){
		this.name = name;
	}
	public Integer getAge(){
		return age;
	}
	public void setAge(Integer age){
		this.age = age;
	}
}

Name.java:

public class Name{
	private String firstName;
	private String lastName;

	public Name(){
	}
	
	public String getFirstName(){
		return firstName;
	}
	public void setFirstName(String firstName){
		this.firstName = firstName;
	}
	public String getLastName(){
		return lastName;
	}
	public void setLastName(String lastName){
		this.lastName = lastName;
	}
}

About

A simple Java code generator, that takes YAML as an input to generate data classes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 93.3%
  • FreeMarker 6.7%