Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Annotations processing + type introspection + code generation Date: Mon, 12 Sep 2011 20:21:58 +0200 Lines: 33 Message-ID: <9d70ubFj6fU1@mid.individual.net> References: <9d6rupF6dkU1@mid.individual.net> <64f52727-b962-4d6b-b445-f04321d863b7@l10g2000yqe.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net i+qI6Fu6vGmDw4/HZ2cANw+GXBIyQlV+vkxw3Uv95UjBnbdZY= Cancel-Lock: sha1:ME4y0J1wEsC5CKHdYqRS6ZGVC4U= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 In-Reply-To: <64f52727-b962-4d6b-b445-f04321d863b7@l10g2000yqe.googlegroups.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7912 On 12.09.2011 20:00, Alex J wrote: > On Sep 12, 8:56 pm, Robert Klemme wrote: >> [snip] >> Why do you want to generate code? I mean, you could process annotations >> at runtime. Create appropriate classes for the handling and configure >> appropriate graphs of objects which do the work (or even use reflection). > > I need to generate *source* code, the boilerplate code is complex > enough, unfortunately bytecode is not an option. > > One of the reason why I need generated code is that the boilerplate > code is quite sofisticated, learning generated docs and debugging the > generated code most likely will be required. > > There are other reasons, but I think that this one would be > sufficient. Hm... If you need to generate a lot identical code there is something wrong: that identical code could be better implemented directly and used. So that leaves adapters and stuff Mark mentioned for generation. I am not convinced yet that it is a good idea to generate loads of complex code. Can you shed some more light on the nature of the application you are going to implement? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/