Learn how to automatically generate .java source files! Every Java developer eventually asks themselves "How can I auto generate Java code?" Well, I'm going to show you how in this tutorial by using a wicked library called JavaPoet. This lightweight an easy to learn API is a perfect tool to have on reserve.
In this 2 part tutorial mini-series, I'll introduce you to the core concepts to JavaPoet like TypeSpec, MethodSpec, FieldSpec; their associate builders and to JavaFile to start off with. I'll demonstrate how to generate source code for a Class, constructor, methods, javadoc, code and logic withing a method using several techniques.
We'll also cover the format placeholder specifiers like $S, $T, $N and $L which take auto generating java sourc code to the next level. Did I mention JavaPoet understands Types!
Click on the link below to see the video ...
Title: JavaPoet: Automatic source code generation (Part 1)
video link: • JavaPoet: Automatic Java source code ...
Title: JavaPoet: Automatic Java source code generation (Part 2)
video link: • JavaPoet: Automatic Java source code ...
Get the source code here ...
https://drive.google.com/file/d/0B_yu...
If you want to see my other tutorial which uses a Custom Maven Plugin (using JavaPoet) in a JavaFX application, click below ..
Title: JavaFX - Switching Scenes like the Boss (Part 2)!
video link: • JavaFX - Switching Scenes Like A Boss...
For those interested in learning more about JavaPoet (which performs the auto-generated code in the plugin),
click the link below ...
https://github.com/square/javapoet
Ask me A Question ...
[email protected]
Subscribe to MVP Java ...
/ @mvpjava
Follow me ...
Google+ : http://bit.ly/1Jsnnfj
Facebook: / mvpjava
Twitter : / mvpjava