This commit is contained in:
15
test/org/redkale/test/type/OneBean.java
Normal file
15
test/org/redkale/test/type/OneBean.java
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class OneBean {
|
||||
|
||||
public int id;
|
||||
}
|
||||
14
test/org/redkale/test/type/OneRound.java
Normal file
14
test/org/redkale/test/type/OneRound.java
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class OneRound {
|
||||
|
||||
}
|
||||
22
test/org/redkale/test/type/OneService.java
Normal file
22
test/org/redkale/test/type/OneService.java
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
import org.redkale.service.RetResult;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <OR>
|
||||
* @param <OB>
|
||||
*/
|
||||
public class OneService<OR extends OneRound, OB extends OneBean> {
|
||||
|
||||
public RetResult run(OR round, OB bean) {
|
||||
return RetResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
15
test/org/redkale/test/type/ThreeBean.java
Normal file
15
test/org/redkale/test/type/ThreeBean.java
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class ThreeBean extends TwoBean {
|
||||
|
||||
public String desc;
|
||||
}
|
||||
14
test/org/redkale/test/type/ThreeRound.java
Normal file
14
test/org/redkale/test/type/ThreeRound.java
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class ThreeRound extends TwoRound {
|
||||
|
||||
}
|
||||
20
test/org/redkale/test/type/ThreeService.java
Normal file
20
test/org/redkale/test/type/ThreeService.java
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <K>
|
||||
* @param <ER>
|
||||
* @param <EB>
|
||||
*/
|
||||
public class ThreeService<K extends CharSequence, ER extends ThreeRound, EB extends ThreeBean> extends OneService<ER, EB> {
|
||||
|
||||
public String key(K key) {
|
||||
return "" + key;
|
||||
}
|
||||
}
|
||||
15
test/org/redkale/test/type/TwoBean.java
Normal file
15
test/org/redkale/test/type/TwoBean.java
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class TwoBean extends OneBean {
|
||||
|
||||
public String name;
|
||||
}
|
||||
14
test/org/redkale/test/type/TwoRound.java
Normal file
14
test/org/redkale/test/type/TwoRound.java
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class TwoRound extends OneRound {
|
||||
|
||||
}
|
||||
16
test/org/redkale/test/type/TwoService.java
Normal file
16
test/org/redkale/test/type/TwoService.java
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <TR>
|
||||
* @param <TB>
|
||||
*/
|
||||
public class TwoService<TR extends TwoRound, TB extends TwoBean> extends OneService<TR, TB> {
|
||||
|
||||
}
|
||||
26
test/org/redkale/test/type/TypeTokenTest.java
Normal file
26
test/org/redkale/test/type/TypeTokenTest.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.test.type;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import org.redkale.util.TypeToken;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
public class TypeTokenTest {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
Class declaringClass = TwoService.class;
|
||||
for (Method method : declaringClass.getMethods()) {
|
||||
if (!"run".equals(method.getName())) continue;
|
||||
System.out.println(TypeToken.getGenericType(method.getGenericParameterTypes()[0], declaringClass));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user