]
George Gastaldi commented on SOLDER-110:
----------------------------------------
Here is a snippet to get the actual type arguments from a class:
{code:java}
private Type[] getConverterTypeGenerics(Class<?> clazz) {
Type[] genericInterfaces = clazz.getGenericInterfaces();
for (Type type : genericInterfaces) {
if (type instanceof ParameterizedType) {
return ((ParameterizedType) type).getActualTypeArguments();
}
}
return null;
}
{code}
@DefaultBean does not work on generic types
-------------------------------------------
Key: SOLDER-110
URL:
https://issues.jboss.org/browse/SOLDER-110
Project: Seam Solder
Issue Type: Bug
Affects Versions: 3.0.0.Final
Reporter: George Gastaldi
DefaultBean should work on generic types also, check the example below:
{code:java}
public interface Converter<S, T> {
T convert(S source);
}
@DefaultBean(Converter.class)
public class DozerConverter implements Converter<Object, Object> {
@Inject
public DozerConverter(InjectionPoint ip) {
}
@Override
public Object convert(Object source) {
}
}
public class ConverterTest {
@Inject
private Converter<String, Integer> converter;
...
}
{code}
When running the test, it fails with a org.jboss.weld.exceptions.DeploymentException:
WELD-001408 Unsatisfied dependencies for type [Converter<String, Integer>] with
qualifiers [@Default] at injection point [[field] @Inject private
org.jboss.seam.solder.test.converter.ConverterTest.converter], since the generic types are
different (but possible, since the default bean it´s supposed to handle object to object
conversion).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: