[forge-dev] ejb plugin: how add nested complex annotations to java class?

Lincoln Baxter, III lincolnbaxter at gmail.com
Tue Sep 4 01:55:11 EDT 2012


Sorry,

Try using one of these:

Annotation<O> setLiteralValue(String value);
Annotation<O> setLiteralValue(String name, String value);


anno.setLiteralValue("@MyOtherAnno")

Ugly but it should work for now. Don't forget to
clazz.addImport(MyOtherAnno.class);

~Lincoln

On Mon, Sep 3, 2012 at 5:20 AM, JFlower <fiorenzino at gmail.com> wrote:

> Hi Lincoln,
>
> some news about this?
>
> Fiorenzo
>
> 2012/8/29 Lincoln Baxter, III <lincolnbaxter at gmail.com>
>
> You should be able to do this. Let me look into it in the morning and see
>> if I can figure out what is wrong (bed time now.)
>>
>> On Tue, Aug 28, 2012 at 8:47 PM, JFlower <fiorenzino at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I should add a nested (complex) annotation to MDB class, like this:
>>> @MessageDriven(name = "MDBName", activationConfig = {
>>>   @ActivationConfigProperty(propertyName = "destinationType",
>>> propertyValue = "javax.jms.Queue"),
>>>   @ActivationConfigProperty(propertyName = "destination", propertyValue
>>> = "blah"),
>>>  @ActivationConfigProperty(propertyName = "acknowledgeMode",
>>> propertyValue = "Auto-acknowledge"),
>>>   @ActivationConfigProperty(propertyName = "maxSession", propertyValue
>>> = "1"),
>>>  @ActivationConfigProperty(propertyName = "transactionTimeout",
>>> propertyValue = "10800"),
>>>   @ActivationConfigProperty(propertyName = "dLQMaxResent",
>>> propertyValue = "0")
>>> })
>>>
>>> i can't find something like this in forge code...
>>>
>>> I tried with :
>>> JavaClass ejb =((JavaResource) resource).getJavaSource();
>>> ejb.addAnnotation(EjbType.MESSAGEDRIVEN.getAnnotation())
>>>
>>> .setStringValue( "name", resource.getName().substring(0, resource.getName().lastIndexOf(".")))
>>>  *.setStringValue( "activationConfig",*
>>> *
>>>           + "\"{ @ActivationConfigProperty(propertyName =
>>> \"destinationType\", propertyValue = \"" + destinationType + "\") "*
>>> * + "@ActivationConfigProperty(propertyName = \"destination\",
>>> propertyValue = \"" + destinationName + "\")}");*
>>>
>>> This code does not generate errors, but doesn't add properties to
>>> @MessageDriven annotation.
>>>
>>> Someone can help me?
>>>
>>> thanks
>>>
>>> Fiorenzo
>>>
>>> _______________________________________________
>>> forge-dev mailing list
>>> forge-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>
>>>
>>
>>
>> --
>> Lincoln Baxter, III
>> http://ocpsoft.org
>> "Simpler is better."
>>
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>
>>
>
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
>
>


-- 
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20120904/1b0695e1/attachment.html 


More information about the forge-dev mailing list