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: 3.5, 4.0
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: [email protected]
For additional commands, e-mail: [email protected]