Hi,

I would like to add code to the getters and setters in a generated bean, but
I do not believe there is a facility for this in the codegen currently.  The
MethodDeclaration built by the StructureClassHolder.addXXXProperty(..)
methods are effectively immutable.  As far as I can tell, attempting to
change them results in an IllegalStateException from AST.  I can see two
ways to approach this problem:

1.  Allow access to the AST CompilationUnit in some sort of
PostProcessingDecorator similar to the ClassDecorator to allow the developer
to use the two AST modification strategies:
    a.  Modification API (CompilationUnit.recordModifications(), modify AST
nodes, CompilationUnit.rewrite(..))
    b.  ASTRewrite API.

I prefer this approach because it allows for more broad spectrum flexibility
in post processing the generated code.  I can understand how we might be
concerned that this would allow a user to deface a class enough that the
binding breaks.

2.  Give the ClassDecorator access to the BlockBuilder for getters and
setters via valueAdded(..) or some similar mechanism.  While this constrains
the potential abuses of refactoring a bit more, building code a statement at
a time is a little clumsy.

And of course there is the possibility that I am missing something entirely,
and this is possible with the existing codebase...

Thanks for any input,
Jon
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to