Package com.alibaba.citrus.generictype

Examples of com.alibaba.citrus.generictype.ClassTypeInfo


import com.alibaba.citrus.generictype.MethodInfo;

public class GenericTest {
    public static void main(String[] args) throws Exception {
        // Class3
        ClassTypeInfo class3 = factory.getClassType(Class3.class);

        System.out.printf("Context class:                   %s\n", class3);

        // Class1.getArrayList()
        MethodInfo getArrayList = factory.getMethod(Class1.class.getMethod("getArrayList"));

        System.out.printf("Method:                          %s\n", getArrayList);

        // ArrayList<A>
        ClassTypeInfo returnType = (ClassTypeInfo) getArrayList.getReturnType();

        System.out.printf("Return type of method:           %s\n", returnType);

        // resolve ArrayList<A>
        ClassTypeInfo resolvedType = returnType.resolve(class3);

        System.out.printf("Resolved returnType:             %s\n", resolvedType);
        System.out.printf("Argument of resolved returnType: %s\n", resolvedType.getActualTypeArguments().get(0));
    }
View Full Code Here


    private final TypeInfo      doType;

    public GenericDao() {
        this.daoType = factory.getClassType(getClass());

        ClassTypeInfo resolvedDaoType = (ClassTypeInfo) daoType.getSupertype(GenericDao.class).resolve(daoType);

        this.doType = resolvedDaoType.getActualTypeArgument("DO");
    }
View Full Code Here

    }

    /** 取得指定{@link Field}对应的{@link FieldInfo}对象。 */
    @Override
    public final FieldInfo getField(Field field) {
        ClassTypeInfo declaringType = getClassType(field.getDeclaringClass());
        TypeInfo type = getType(field.getGenericType());

        return new FieldImpl(field, declaringType, type);
    }
View Full Code Here

                                          Type[] exceptionTypes, Class<?> declaringClass, BuildingCache buildingCache) {
        TypeVariableInfo[] vars = buildTypeVariables(method.declaration, method, buildingCache);
        TypeInfo returnTypeInfo = returnType == null ? TypeInfo.PRIMITIVE_VOID : buildType(returnType, buildingCache);
        TypeInfo[] parameterTypeInfos = buildTypes(parameterTypes, buildingCache);
        TypeInfo[] exceptionTypeInfos = buildTypes(exceptionTypes, buildingCache);
        ClassTypeInfo declaringType = buildRawType(declaringClass, buildingCache);

        method.init(vars, returnTypeInfo, parameterTypeInfos, exceptionTypeInfos, declaringType);
    }
View Full Code Here

    /**
     * ȡ��ָ��{@link Field}��Ӧ��{@link FieldInfo}����
     */
    @Override
    public final FieldInfo getField(Field field) {
        ClassTypeInfo declaringType = getClassType(field.getDeclaringClass());
        TypeInfo type = getType(field.getGenericType());

        return new FieldImpl(field, declaringType, type);
    }
View Full Code Here

                                          Type[] exceptionTypes, Class<?> declaringClass, BuildingCache buildingCache) {
        TypeVariableInfo[] vars = buildTypeVariables(method.declaration, method, buildingCache);
        TypeInfo returnTypeInfo = returnType == null ? TypeInfo.PRIMITIVE_VOID : buildType(returnType, buildingCache);
        TypeInfo[] parameterTypeInfos = buildTypes(parameterTypes, buildingCache);
        TypeInfo[] exceptionTypeInfos = buildTypes(exceptionTypes, buildingCache);
        ClassTypeInfo declaringType = buildRawType(declaringClass, buildingCache);

        method.init(vars, returnTypeInfo, parameterTypeInfos, exceptionTypeInfos, declaringType);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.generictype.ClassTypeInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.