Yes, that didn't sound right, sorry.
What I wanted to say is that the argument to getTypeInfo() should be the
one obtained with e.g. Field.getGenericType() or
Method.getGenericReturnType() and so on. Otherwise, the generic-specific
information won't be available. E.g. here is instance variable vs local
variable
List<String> sList = new ArrayList<String>();
Type gType = sList.getClass();
System.out.println("type: " + gType);
classInfo = (ClassInfo) configuration.getTypeInfo(gType);
System.out.println("type args: " +
classInfo.getActualTypeArguments());
gType = sListField.getType();
System.out.println("type: " + gType);
classInfo = (ClassInfo) configuration.getTypeInfo(gType);
System.out.println("type args: " +
classInfo.getActualTypeArguments());
Field sListField = getClass().getDeclaredField("sList");
gType = sListField.getGenericType();
System.out.println("type: " + gType);
classInfo = (ClassInfo) configuration.getTypeInfo(gType);
System.out.println("type args: " +
classInfo.getActualTypeArguments());
The output is
type: class java.util.ArrayList
type args: null
type: interface java.util.List
type args: null
type: java.util.List<java.lang.String>
type args: [Lorg.jboss.reflect.spi.TypeInfo;@7a78d3
Alexey
Ales Justin wrote:
>> configuration.getTypeInfo(...) may be a wrong way to load a
generic
type
but even if I declare a field of type JBossEnterpriseBeansMetaData and
But I don't understand this.
Cheers,
Ales