Hi,

2008/11/8 Todor Boev <[EMAIL PROTECTED]>

> It would be nice to have an annotation like this
>
> @Handler(name="test", namespace="com.acme.test")
> public class TestHandler extends PrimitiveHandler {
>  ...
> }
>
> or maybe even
>
> @Handler(annotation=Test.class)
> public class TestHandler extends PrimitiveHandler {
>  ...
> }
>
> @Test(attribute1="val1", attribute2="val2")
> public TestPojo {
>  ...
> }
>
> is it hard to add one? :)


No, a "simple and naive" detection algorithm is implemented to detect
"iPOJO-related" annotations. An annotation is detected and computed as
follow:
- the annotation package must be the handler namespace.
- the annotation name must be the handler name
- the annotation package must contain the 'ipojo' word or the 'handler'
word.
- annotation attributes are mapped to iPOJO attribute
- an annotation on field adds the 'field' attribute containing the field
name
- an annotation on method adds the 'method' containing the method name

So, let's imagine an handler with the following characteristics:
- name : test
- namespace: com.acme.ipojo.test

The annotation qualified name is : com.acme.ipojo.test.Test (@Test from the
com.acme.ipojo.test package).
@Test(attribute1="val1", attribute2="val2")
public TestPojo {
 ...
}

This snippet is equivalent to the following XML description:
<com.acme.test.test attribute1="val1" attribute2="val2"/>



>
>
> A second request: Would you please fill up the Annotations section in the
> "How to write your own
> handler" tutorial? I managed to make my own annotation by following this
> little note
>
> "Note : In order to use iPOJO annotations processing, the namespace must be
> a valid package name and
> the name must be a valid annotation name (without the '@'). Refer to the
> annotations section"
>
> but i wonder what other mysterious features are still not described :)


I will do it soon (should be done before the end of November). An iPOJO
based tutorial is under preparation, so I will extend this section at the
same time.


Regards,

Clement



>
> Cheers,
> Todor
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to