dev@jaxb.java.net

Plugin to extend another class

From: Stern, Michael W <MSTERN_at_amfam.com>
Date: Tue, 30 Jan 2007 10:35:29 -0600

Hey all,
 
I was just wondering if it is a possibility to write a plugin to make a
generated class extend another (non-generated) class. The main reason
for wanting to do this, is to allow adding behavior to the generated
JAXB models. The superclass will contain the business methods & logic,
the model (sub-class) will contain the attributes. This is my first
attempt at a plugin, and I have a test one working, and have been
looking at the _extends() methods on JDefinedClass, but they don't seem
to give the ability I was hoping for.
 
I am in pursuit of a Rich Domain Model, and am trying to avoid the
anemic model that using JAXB classes tends to promote. I got the Simple
regenerator plugin
<https://jaxb2-commons.dev.java.net/simple-regenerator/> working, but
would like to to see if there is a way to do this a little more
elegantly.
 
Additionally it would be nice to see a little more fine grained control
over creating interfaces, but that is a topic for another day. If you
need more information on what I am trying to do, I have a class diagram
as well.