Java Code Examples for sun.reflect.generics.tree.ClassSignature

The following examples show how to use sun.reflect.generics.tree.ClassSignature. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gadtry   Source File: JavaTypes.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 获取Class的泛型信息(Get generic information about class)
 *
 * @param javaClass Class
 * @return TypeArgument[]
 */
public static Map<String, TypeArgument[]> getClassGenericInfo(Class<?> javaClass)
{
    try {
        Map<String, TypeArgument[]> typeSignatureMap = new LinkedHashMap<>();
        ClassRepository classRepository = getReflectMethod(Class.class.getDeclaredMethod("getGenericInfo"), javaClass);

        if (classRepository == null) {
            return Collections.emptyMap();
        }
        //-----2
        ClassSignature tree = getReflectMethod(AbstractRepository.class.getDeclaredMethod("getTree"), classRepository);
        //FormalTypeParameter[] formalTypeParameters = tree.getFormalTypeParameters();  //type 个数  === type[]
        SimpleClassTypeSignature typeSignature = tree.getSuperclass().getPath().get(0);
        typeSignatureMap.put(typeSignature.getName(), typeSignature.getTypeArguments());

        for (ClassTypeSignature it : tree.getSuperInterfaces()) {
            typeSignature = it.getPath().get(0);
            typeSignatureMap.put(typeSignature.getName(), typeSignature.getTypeArguments());
        }
        return typeSignatureMap;
    }
    catch (Exception e) {
        throw throwsException(e);
    }
}
 
Example 2
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 3
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 4
Source Project: jdk8u60   Source File: ClassRepository.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 5
Source Project: java-n-IDE-for-Android   Source File: ClassRepository.java    License: Apache License 2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 6
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 7
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 8
Source Project: javaide   Source File: ClassRepository.java    License: GNU General Public License v3.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 9
Source Project: Bytecoder   Source File: ClassRepository.java    License: Apache License 2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 10
Source Project: openjdk-jdk9   Source File: ClassRepository.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 11
Source Project: jdk8u-jdk   Source File: ClassRepository.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 12
Source Project: hottub   Source File: ClassRepository.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 13
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 14
Source Project: openjdk-8   Source File: ClassRepository.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 15
Source Project: jdk8u_jdk   Source File: ClassRepository.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 16
Source Project: jdk8u-jdk   Source File: ClassRepository.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example 17
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}