lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarosław Bojar (JIRA) <j...@apache.org>
Subject [jira] [Updated] (SOLR-2844) SolrJ: Make DocmentObjectBinder accept getter only fields (adapter pattern)
Date Mon, 21 May 2012 15:08:42 GMT

     [ https://issues.apache.org/jira/browse/SOLR-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jarosław Bojar updated SOLR-2844:
---------------------------------

    Attachment: SOLR-2844.patch

Another patch for @Field annotations on getters. This version also finds matching setter method
and sets DocField.setter field correctly.
                
> SolrJ: Make DocmentObjectBinder accept getter only fields (adapter pattern)
> ---------------------------------------------------------------------------
>
>                 Key: SOLR-2844
>                 URL: https://issues.apache.org/jira/browse/SOLR-2844
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - java
>            Reporter: Jens Wike
>            Priority: Minor
>             Fix For: 4.1
>
>         Attachments: SOLR-2844.patch, SOLR-2844.patch
>
>
> Our primary use case for SolrJ is to feed data into solr. We commonly use an adapter
design pattern in our presentation or export layer in the application. E.g. an adapter to
flatten structured relational data for books for an solr import might look like this:
> class Book {
>   BookEntity book;
>   public String getTitle() { return book.getTitle(); }
>   public String getAuthorName() { return book.getAuthor().getName(); }
>   public Double getMinimumPrice( { return priceService.calculateMinimumPrice(book); }
> }
> This is not working currently, because a setter has to be specified. So the workaround
is to write this code:
> class Book {
>   BookEntity book;
>   public String getTitle() { return book.getTitle(); }
>   @Field public void setTitle(String s) { }
>   public String getAuthorName() { return book.getAuthor().getName(); }
>   @Field public void setAutherName(String s) { }
>   public Double getMinimumPrice( { return priceService.calculateMinimumPrice(book); }
>   @Field public void setMinimumPrice(Double d) { }
> }
> So the scope of this improvement is to get rid of the dummy setters and to support @Field
on getters directly.
> I will add a patch proposal for this later on.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message