cy
2022-11-18 08013d9f35bdfaa462916716f5c77b438af874fb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import com.integrated.zyyt.ZyytConstant;
import com.integrated.zyyt.enetity.StationInfo;
import com.integrated.zyyt.enetity.business.Zyyt;
import com.integrated.zyyt.enetity.business.ZyytStationInfo;
import org.springframework.core.ResolvableType;
 
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
 
/**
 * @ClassName FanXingTest
 * @Author cy
 * @Date 2022/11/16
 * @Description
 * @Version 1.0
 **/
public class FanXingTest {
    private List<String> typelist1 = new ArrayList<>();
 
    public static void main(String[] args) throws NoSuchFieldException {
        ResolvableType t = ResolvableType.forField(FanXingTest.class.getDeclaredField("typelist1"));
        System.out.println(t.getGeneric(0).resolve());
 
        Zyyt<StationInfo> infoZyyt = new ZyytStationInfo(ZyytConstant.URL_AUTHON,ZyytConstant.URL_DJTJB_QUERY,
                false,
                ZyytConstant.CLIENT_DJTJB,
                ZyytConstant.SECRET_DJTJB,
                ZyytConstant.X_EOS_SOURCESYSKEY_DJTJB,
                null);
 
        Type genType = infoZyyt.getClass().getGenericSuperclass();
        Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
        System.out.println(((Class) params[0]).getName());
 
 
        ResolvableType t2 = ResolvableType.forField(infoZyyt.getClass().getDeclaredField("queryData"));
        System.out.println(t2.getGeneric(0).resolve());
    }
}