[
https://issues.jboss.org/browse/ISPN-2826?page=com.atlassian.jira.plugin....
]
Sanne Grinovero commented on ISPN-2826:
---------------------------------------
Hi Ray, thanks for the idea, but without large changes in functionality that can't be
fixed: technically your query could target multiple types which have no types in common:
{code}
CacheQuery query = searchManager.getQuery(luceneQuery, Book.class, Airplanes.class,
Users.class);
{code}
So even if we used extended generics all over, there would be mixed results. Also, one can
not infer the type from the original Cache<?,?> generic values as, even when knowing
it's a Cache<String,Book> one might want to use projections to extract the
titles in one-shot.
I agree we should improve the API, but we'd likely need additional methods.
CacheQuery.list() returns List<Object>, which is hard to cast
-------------------------------------------------------------
Key: ISPN-2826
URL:
https://issues.jboss.org/browse/ISPN-2826
Project: Infinispan
Issue Type: Feature Request
Components: Querying
Reporter: Ray Tsang
Assignee: Sanne Grinovero
In example for Books in
https://docs.jboss.org/author/display/ISPN/Querying+Infinispan
~~ snip snip ~~
CacheQuery query = searchManager.getQuery(luceneQuery, Book.class);
// and there are your results!
List<Book> objectList = query.list();
~~ snip snip ~~
This doesn't actually work. CacheQuery.list() returns List<Object>
Thus, you will need to cast: List<Book> books = (List<Book>) cq.list();
But this wouldn't work... Instead you'll end up doing: List<Book> books =
(List<Book>)(List<?>) cq.list();
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira