Java Reference
In-Depth Information
}
}
else if(t instanceof ParameterizedType)
{
...
}
else if(t instanceof WildcardType)
{
...
}
else if(t instanceof GenericArrayType)
{
...
}
else
{
System.out.println("<<<unknown type!!!!!>>>");
}
}
...
private static void handleMethods(Method[] methods)
{
for(Method method: methods)
{
System.out.println(" " + method.getName() + ":");
int mod = method.getModifiers();
System.out.println(" modifiers: " +
Modifier.toString(mod));
System.out.println(" generic parameters: ");
Type[] params = method.getGenericParameterTypes();
int i = 0;
for(Type param : params)
{
i++;
printNTimes(' ', 8);
System.out.println(i + ". parameter:");
printType(param, 10);
}
System.out.println(" generic return type: ");
Type returnType = method.getGenericReturnType();
printType(returnType, 8);
System.out.println(" generic exceptions: ");
Type[] exceptions = method.getGenericExceptionTypes();
i = 0;
for(Type exception : exceptions)
{
i++;
printNTimes(' ', 8);
System.out.println(i + ". exception:");
printType(exception, 10);
}
}
}
}
 
Search WWH ::




Custom Search