[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2478) Make Component.getInstance(class) typesafe
Matt Drees (JIRA)
jira-events at lists.jboss.org
Fri Jan 11 00:36:22 EST 2008
[ http://jira.jboss.com/jira/browse/JBSEAM-2478?page=comments#action_12394650 ]
Matt Drees commented on JBSEAM-2478:
------------------------------------
I don't think this would work for manager components like org.jboss.seam.transaction.Transaction. E.g.,
(UserTransaction) Component.getInstance(Transaction.class);
Note that Transaction is not a UserTransaction.
Of course, I'd love a way to avoid that stupid cast. It might require a new method to preserve backward-compatibility, unfortunately.
Maybe something like Component.getImplementation(UserTransaction.class).
> Make Component.getInstance(class) typesafe
> ------------------------------------------
>
> Key: JBSEAM-2478
> URL: http://jira.jboss.com/jira/browse/JBSEAM-2478
> Project: JBoss Seam
> Issue Type: Feature Request
> Components: Core
> Reporter: Christian Bauer
> Priority: Minor
>
> I don't know why these return Object, looks to me like we can make these generic and avoid the cast:
> public static Object getInstance(Class<?> clazz)
> {
> return getInstance(clazz, true);
> }
> public static Object getInstance(Class<?> clazz, boolean create)
> {
> return getInstance( getComponentName(clazz), create );
> }
> public static Object getInstance(Class<?> clazz, ScopeType scope)
> {
> return getInstance(clazz, scope, true);
> }
> public static Object getInstance(Class<?> clazz, ScopeType scope, boolean create)
> {
> return getInstance( getComponentName(clazz), scope, create );
> }
--
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