I'm somewhat intrigued. I use some jde code templates that generate
abstract getter-setter with all the tags waiting to be filled in. This
does seem like it has less redundancy, which I like. I don't like that it
forces you to have an extra class. I'd rather see a solution that
generates the code for the bean from your code + your tags, modifying the
class you wrote.
david jencks
On 2002.03.04 16:46:00 -0500 Andreas Schaefer wrote:
> Hi Geeks
>
> I am tired of writing all the abstract getter/setter
> methods for the CMP Entity Beans in XDoclet
> but on the other hand I like that the Entity Bean
> source is the base and therefore you can add
> code as you like (opposite to other generation
> tools).
>
> To solve that problem I came up with this
> solution:
> 1) The Entity Bean inherite from a class which
> is generated which in turn can extends any
> other class.
> 2) adding a new tag:
> @jboss:data-field
> name="<Name of the Attribute(s)>"
> description="<Description of these attribute(s)>"
> type="R|W|RW"
> class="<full qualified data type>"
> column-name="<name of table attribute(s)>"
> is-pk="true|false"
>
> More descriptions:
> NAME can contain a list of attributes which shares the
> same settings for description, type, class and is-pk.
> DESCRIPTION is optional
> TYPE default is RW. The meaning is that R generates
> only a getter method, W generates only a setter emthod
> and RW both.
> CLASS is the full qualified data type class name which
> can also be a basic data type (int, float etc.)
> COLUMN-NAME contains a list of table attribute names
> which must match the NAME list and can be omitted which
> means that is contains the same names as in NAME
> IS-PK default is false. If set to true the attribute(s) are
> part of the PK.
>
> The only thing the coder must be aware is that he has to
> extends its Entity Bean from the "to be generated class".
>
> An Entity Bean would look like this:
>
> /**
> * @ejb:bean name="test/Manager"
> * display-name="Manager working on projects to support
> clients"
> * type="CMP"
> * jndi-name="ejb/test/Manager"
> *
> * @jboss:data-field name="Id"
> * class="int"
> * is-pk="true"
> *
>
> * @jboss:data-field name="FirstName,LastName,Address,City"
> * class="java.lang.String"
> *
> column-name="First_Name,Last_Name,Address,City"
> *
>
> * @jboss:data-field name="CreationDate"
> * type="R"
> * class="java.sql.Date"
> * column-name="Creation_Date"
> *
> * @ejb:transaction type="Required"
> *
> * @jboss:table-name table-name="Manager"
> *
> * @jboss:create-table create="true"
> *
> * @jboss:remove-table remove="true"
> **/
> public abstract class ManagerBean
> implements ManagerBaseBean
> {
>
> Now the ManagerBaseBean will contain the setter/getter method for
> attribute Id, FirstName,LastName,Address,Citty and the getter method
> for CreationDate and the protected member variables.
>
> This makes the creation of CMP Entity Beans pretty easy and also
> easy to change because you don't have to go over many lines of code
> to figure out what attributes you have.
>
> What do you think ?
>
> Have fun
>
> xxxxxxxxxxxxxxxxx
> Andreas Schaefer
> Senior Consultant
> JBoss Group, LLC
> xxxxxxxxxxxxxxxxx
>
>
>
> _______________________________________________
> Xdoclet-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
>
>
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel