[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2008) Query should use parameterized type for results
Dan Allen (JIRA)
jira-events at lists.jboss.org
Sun Sep 30 01:54:40 EDT 2007
Query should use parameterized type for results
-----------------------------------------------
Key: JBSEAM-2008
URL: http://jira.jboss.com/jira/browse/JBSEAM-2008
Project: JBoss Seam
Issue Type: Feature Request
Components: Tools
Affects Versions: 2.0.0.CR1
Reporter: Dan Allen
Priority: Minor
Fix For: 2.0.0.GA
I don't see any reason why Query cannot be defined as Query<T, E> rather than Query<T>. The general design of Query is that it operates on a static base query (only the conditions are dynamic). Therefore, the item type in the result list should be anticipated. In any case, if it is not, you can always define it using the generic type Object.
To cite an example, we start with:
public class EntityQuery<E> extends Query<EntityManager, E> {}
We can use it as:
public class CategoryQuery extends EntityQuery<Category> {
}
CategoryQuery q = new CategoryQuery();
for ( Category c : q.getResultList() ) {
// didn't need to cast!
}
On the other hand, if the query component is defined without the type, it will still work. The type will be treated as java.lang.Object.
public class CategoryQuery extends EntityQuery {
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list