I try to write blogs whenever I get spare time

Just to let you know what I am trying to learn and what I am doing now.

The idea of auto generation of boiler-plate codes of Java EE (part 1)

The Java EE is a great framework for building large scale and distributed enterprise softwares. A java enterprise software has many boiler-plate codes that need not to be coded by yourself. They can be generated by smart IDE's like Netbeans just with your few mouse-clicks. But, the code Netbeans generates is kind of a mere skeleton code of those classes. If you need customization in all those netbeans generated classes, it is better to write a generator that will generate customized classes according to your requirement. It's a very simple thing to do.

First, let us assume we need to generate the following classes for a single entity:
1. a entity bean,
2. a session bean,
3. a detail file of the entity bean (that will hold the form level abstraction of the entity bean),
4. a converter class that would convert the detail class to the entity class and vice versa.
5. and a form that would represnt the attributes of the entity bean (in the front end).

For all these, at first you need to write a data source in which you would store the name of the entity, it's attribute list, properties of the attributes etc. An XML is a feasible solution here to write these data. So, write an XML file by defining significant tags in it. Then, write the DTD (Data Type Definintion) file for this XML, in which the type of your tags would be defined. If you are not very familiar with these validation stuffs of XML, you can check these DTD tutorial.

0 comments:

Post a Comment