Noble Paul നോബിള് नोब्ळ् schrieb:
On Sun, Feb 21, 2010 at 11:04 PM, Norman Wiechmann <n.wiechm...@gmx.net> wrote:
Hi,
I'm wondering if there is a reason why the @Field annotation is restricted
to setters?
The preferred way is to apply the annotation to fields. it is provided
on setters also if you prefer the set/get xxx() route.
Ok, but fields are not my prefered way. I don't want to store all values
required for the index into extra fields. As described in my first mail,
I intend to use the annotation to generate index fields only, not to
read them. So there is no need to have always a field. Sometimes I would
like to create an solr annotated wrapper to the business object and
sometimes I would like to annotate my business object directly.
In my case I would like to index beans from java using the solrj client
implementation. Transforming documents to beans is not required because I
use queries to Solr from JavaScript only.
To avoid the creation of setter methods just to use the @Field annotation I
extended SolrServer to overwrite getBinder() and added an
DocumentObjectBinder implementation that supports @Field annotations at bean
property getter methods.
For me it feels very unusual to add annotations to setters. It does not
match with the experience I have from other libraries like JPA or JAXB.
Best, Norman