[weld-issues] [JBoss JIRA] Commented: (WELDX-188) Provide utility to check if Type is assignable to another Type
Dan Allen (JIRA)
jira-events at lists.jboss.org
Mon Nov 8 12:09:02 EST 2010
[ https://jira.jboss.org/browse/WELDX-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561942#action_12561942 ]
Dan Allen commented on WELDX-188:
---------------------------------
I'm creating producer methods to satisfy injection points with narrowed types. I want to be able to determine if the type at the injection point is more specific than a type I've already registered. If so, I want to keep the most specific type as it will cover both cases.
Example:
@RequestParam("width") Integer w;
@RequestParam("height") Number h;
Integer is more specific and that's the producer I need.
This case is simple, but my provider must be able to deal generically w/ parameterized types at the injection point.
> Provide utility to check if Type is assignable to another Type
> --------------------------------------------------------------
>
> Key: WELDX-188
> URL: https://jira.jboss.org/browse/WELDX-188
> Project: Weld Extensions
> Issue Type: Feature Request
> Reporter: Dan Allen
> Priority: Minor
> Fix For: 1.0.0.Beta2
>
>
> Often times when writing an extension, you need to know if one Type is assignable from another Type. This is a more sophisticated version of Class#isAssignableFrom(Class) which takes into account paramaterized types.
> given
> parameterized type Bean<N extends Number>
> then
> type Bean<Number> is assignable from type Bean<Integer>
> One area where this is useful is when checking if a bean type is more specific than another bean type. It's not sufficient to assume the bean type is a simple class.
> Something similar to what is provided by: http://google-gson.googlecode.com/svn-history/r442/trunk/gson/src/main/java/com/google/gson/reflect/TypeToken.java
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the weld-issues
mailing list