Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a java code generation library [closed]

What is/are "good" java code generation libs? I found a generation part in JaxMe, but it's poor and old. I like to generate java code through java code. So basically use a lib to tell that it has to generate a certain concrete class or interface with X fields, Y methods, etc.. that are then written to the file system.. I know that frameworks use them, but can't find a standalone lib.. - Ed

like image 540
edbras Avatar asked Nov 10 '12 13:11

edbras


People also ask

What makes a good Java code generator?

A good Java Code Generator (as a general term) has to allow you to generate code in frameworks such as Spring, Struts, GWT, Play, JSF, Blade, Hibernate, etc. It has to be also useful with your custom infrastructure and speed you up while developing. In addition, it has to write code like you.

Can code generation be used for small portions of code?

Some IDEs have the functionality to generate boilerplate code, like the equals or hashCode methods in Java So Code Generation can be used for small portions of code or entire applications. It can be used with widely different programming languages and using different techniques.

How to generate code from other languages?

We can generate code from information we obtained by reverse-engineering code written using other languages or frameworks Some IDEs have the functionality to generate boilerplate code, like the equals or hashCode methods in Java So Code Generation can be used for small portions of code or entire applications.

What are the best general purpose Java libraries?

Google Guava is another top-grade general-purpose Java library. Initially developed by Google and designed by renowned Software Engineer and Author Joshua Bloch. It is now an open-source project where many engineers outside Google contributed. Like Apache Commons, it is also Modular and contains many independent libraries.


1 Answers

There are several libraries with various capabilities and ease of use:

  • Javassist
  • Apache BCEL
  • ASM
  • cglib

You will probably have to take a look at the API of each one to determine which one is more suitable for your purposes.

like image 119
thkala Avatar answered Oct 21 '22 22:10

thkala