I guess the point I was missing is that the Events and Instances are created by
the OWB container so they are sure to be ParameterizedTypes.
You can't say...
@Inject Event myEvent?
or if you do you get a ParameterizedType anyway?
thanks
david jencks
On Oct 19, 2010, at 9:09 PM, David Jencks wrote:
> Hi Gurkan,
>
> Can't you get rid of the parameterization by
>
> public interface MyLoggingEvent extends Event<LoggingEvent> {}
>
> ...
>
> @Inject MyLoggingEvent myEvent;
>
> I haven't figured out how to test this but I would expect the Type for
> MyLoggingEvent to be a Class and not a ParameterizedType.
>
> thanks
> david jencks
>
> On Oct 19, 2010, at 5:28 AM, Gurkan Erdogdu wrote:
>
>> Hi David;
>>
>>
>> Yes correct. Checking injections for Event<Type> or Instance<Type>, for
>> example
>>
>> @Inject Event<LoggingEvent> myEvent;
>>
>> @Inject Instance<MyBean> instance;
>>
>> thanks;
>>
>> --Gurkan
>>
>>
>> ----- Original Message ----
>> From: David Jencks <[email protected]>
>> To: [email protected]
>> Sent: Tue, October 19, 2010 7:25:55 AM
>> Subject: Is this correct?
>>
>> Is this code in InjectionResolver line 258 correct? I would expect the
>> isAssignableFrom tests to be outside the deparameterizing of the type.
>>
>>
>>
>> private boolean isInstanceOrEventInjection(Type type)
>> {
>> Class<?> clazz = null;
>> boolean injectInstanceOrEventProvider = false;
>> if (type instanceof ParameterizedType)
>> {
>> ParameterizedType pt = (ParameterizedType) type;
>> clazz = (Class<?>) pt.getRawType();
>>
>> if(clazz.isAssignableFrom(Instance.class) ||
>> clazz.isAssignableFrom(Event.class))
>> {
>> injectInstanceOrEventProvider = true;
>> }
>> }
>>
>> return injectInstanceOrEventProvider;
>> }
>>
>>
>> thanks
>> david jencks
>>
>>
>