if (aType instanceof Class) {
aClass = (Class) aType;
}
else if (aType instanceof WildcardTypeImpl) {
WildcardTypeImpl aWildcard = (WildcardTypeImpl) aType;
// trying to suss out super v extends w/o resorting to string munging.
if (aWildcard.getLowerBounds().length == 0 && aWildcard.getUpperBounds().length > 0) {
// no lower bounds afaik indicates ? extends Foo
aClass = ((Class)aWildcard.getUpperBounds()[0]);
}
else if (aWildcard.getLowerBounds().length > 0) {
// lower & upper bounds I believe indicates something of the form Foo super Bar
aClass = ((Class)aWildcard.getLowerBounds()[0]);
}
else {
// shoot, we'll try the string hack that Adrian posted on the mailing list.
try {
aClass = Class.forName(aType.toString().split(" ")[2].substring(0, aTypes[0].toString().split(" ")[2].length()-1));