[infinispan-issues] [JBoss JIRA] (ISPN-2826) CacheQuery.list() returns List<Object>, which is hard to cast

Ray Tsang (JIRA) jira-events at lists.jboss.org
Thu Feb 14 19:45:56 EST 2013


Ray Tsang created ISPN-2826:
-------------------------------

             Summary: 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


More information about the infinispan-issues mailing list