users@codemodel.java.net

Re: Annotation Param: Using external enumerations as value

From: Hannes Niederhausen <el_bosso_at_gmx.de>
Date: Sun, 12 Sep 2010 12:17:18 +0200

Thank you. It works and is a real life saver for me :)

regards
Hannes

On Sun, Sep 12, 2010 at 10:48 AM, Aleksei Valikov <valikov_at_gmx.net> wrote:
> Hi,
>
>>> You need either Enum instance or JEnumConstant (which you can only
>>> produce for JDefinedClass at the moment). So if you don't have the
>>> class of your enum and it's not a generated class - then you can only
>>> accomplish your task by hacking at the moment.
>>
>> I guess with hacking, you mean modifying the codemodel code. It would
>> be nice to be able to create an enum ref.
>
> I meant reflected access to JAnnotationUse.addValue(...)
>
>> For now I could use the solution suggested in the thread "Annotation:
>> Parameter and public static final field".
>> I would use JAnnotationUse.param(String name, JExpression value) using
>> JExpr.direct("Enum.VALUE") but it seems its not in the repository yet.
>
> I was waiting for the issue, I'll commit it now. By the way, I'd
> rather use codeModel.ref("com.acme.Enum").fieldRef("VALUE") than
> direct expressions.
>
>> BTW: Is the current snapshot available via Maven?
>
> Yes, from the Sonatype repo:
>
> https://oss.sonatype.org/content/repositories/snapshots/com/sun/codemodel/
>
> Here's coninuous integration:
>
> http://hudson.highsource.org/view/codemodel/job/codemodel-trunk-1.5/
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_codemodel.dev.java.net
> For additional commands, e-mail: users-help_at_codemodel.dev.java.net
>
>



-- 
Onotoa - Simply create your Topic Maps schemas.
Web:             http://onotoa.topicmapslab.de
User Group: http://groups.google.com/group/onotoa
Code:           http://code.google.com/p/onotoa/
http://www.topicmapslab.de/people/Hannes_Niederhausen
 ======================================
  Topic Maps Lab
  http://www.topicmapslab.de
  ======================================
  ======================================
  TMRA - International Conferences on
  Topic Maps Research and Applications
  TMRA 2010
  "Information wants to be a topic map"
  29.Sep - 01.Oct 2010, Leipzig, Germany
  http://www.tmra.de/2010/
  ======================================