wuxw7
2018-06-13 28441b3922e6188f643d145a32c55d4fa285af84
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
42
43
44
45
package com.java110.log.type;
 
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
 
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
 
/**
 * Created by wuxw on 2017/4/14.
 */
public class TypeTest
 
    extends TestCase
    {
        /**
         * Create the test case
         *
         * @param testName name of the test case
         */
    public TypeTest( String testName )
        {
            super( testName );
        }
 
        /**
         * @return the suite of tests being tested
         */
    public static Test suite()
    {
        return new TestSuite( TypeTest.class );
    }
 
        /**
         *
         * @since 1.7
         * @throws Exception
         */
    public void testType() throws Exception{
       Object obj = Class.forName("com.java110.log.type.CustDispatchListener").newInstance();
        Type[] types = obj.getClass().getGenericInterfaces();
       System.out.println(((ParameterizedType)types[0]).getActualTypeArguments()[0].getTypeName());
    }
}