On Jun 27, 2012, at 2:54 PM, Hardy Ferentschik wrote:
On 26 Jun 2012, at 22:29, Sanne Grinovero <sanne(a)hibernate.org> wrote:
> On 26 June 2012 21:17, Hardy Ferentschik <hardy(a)hibernate.org> wrote:
>>
>> On 26 Jun 2012, at 21:37, Sanne Grinovero <sanne(a)hibernate.org> wrote:
>>
>>> Ok that sounds all nice. But we need programmatic definition of
>>> annotations too, you remember Hibernate Search right?
>>
>> How is that conceptually different than XML defined ones?
>
> Not conceptually, but in practice, does Jandex support this directly
> or should we add a thin layer of indirection?
Kind of directly. You create pseudo annotations the same ways as for XML configuration.
Yes, we will have to write some code, but is not adding a new layer. It is just using the
Jandex API. Maybe the best is to look at the code in the metamodel branch, because we are
actually talking about something which is already done!
org.hibernate.metamodel.internal.source.annotations.xml.mocker
and
_org.hibernate.metamodel.internal.source.annotations.AnnotationMetadataSourceProcessorImpl#AnnotationMetadataSourceProcessorImpl_
One argument I forgot, because I was more focused around why we should get rid of Commons
Annotations, is that we actually want to expose the Jandex index when processing
annotations (aka using the information in the annotations vs actually discovering them).
Using Jandex allows us to clearly separate between annotation discovery and annotation
processing. This makes code much easier to write and understand. You can for example just
ask the Jandex index to give you all annotations of a certain type (independent of class
hierarchies etc). You need much less reflection code when processing the annotations.
You would give all this away if you hide it behind the XClass abstraction. You cannot
take any advantage of the Jandex API, but you are stuck with the reflect and process
approach we currently use.
> Plus, you're suggesting we re-wire dependencies in other modules too
> right? (like Search)
Absolutely!
--hardy
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev
-------------------------
Best Regards,
Strong Liu <stliu at hibernate.org>
http://about.me/stliu/bio