This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.redkale.test.type;
|
package org.redkale.test.type;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.*;
|
||||||
import org.redkale.util.TypeToken;
|
import org.redkale.util.TypeToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,10 +15,15 @@ import org.redkale.util.TypeToken;
|
|||||||
public class TypeTokenTest {
|
public class TypeTokenTest {
|
||||||
|
|
||||||
public static void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
Class declaringClass = TwoService.class;
|
Class declaringClass = ThreeService.class;
|
||||||
|
ParameterizedType declaringType = (ParameterizedType) declaringClass.getGenericSuperclass();
|
||||||
|
System.out.println("getRawType:" + declaringType.getRawType());
|
||||||
|
TypeVariable argType0 = (TypeVariable)declaringType.getActualTypeArguments()[0];
|
||||||
|
System.out.println("argType0.getBounds[0]:" + argType0.getBounds()[0]);
|
||||||
|
|
||||||
for (Method method : declaringClass.getMethods()) {
|
for (Method method : declaringClass.getMethods()) {
|
||||||
if (!"run".equals(method.getName())) continue;
|
if (!"run".equals(method.getName())) continue;
|
||||||
System.out.println("返回值应该是: " + TwoRound.class);
|
System.out.println("返回值应该是: " + ThreeRound.class);
|
||||||
System.out.println("返回值结果是: " + TypeToken.getGenericType(method.getGenericParameterTypes()[0], declaringClass));
|
System.out.println("返回值结果是: " + TypeToken.getGenericType(method.getGenericParameterTypes()[0], declaringClass));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user