sun.reflect.generics.tree.ClassSignature Java Examples

The following examples show how to use sun.reflect.generics.tree.ClassSignature. 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 File: JavaTypes.java    From gadtry with 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
Source File: ClassRepository.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #3
Source File: ClassRepository.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #4
Source File: ClassRepository.java    From jdk8u-jdk with 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 File: ClassRepository.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #6
Source File: ClassRepository.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #7
Source File: ClassRepository.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #8
Source File: ClassRepository.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #9
Source File: ClassRepository.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #10
Source File: ClassRepository.java    From openjdk-jdk9 with 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 File: ClassRepository.java    From dragonwell8_jdk with 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 File: ClassRepository.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #13
Source File: ClassRepository.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #14
Source File: ClassRepository.java    From openjdk-jdk8u with 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 File: ClassRepository.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #16
Source File: ClassRepository.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}
 
Example #17
Source File: ClassRepository.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected ClassSignature parse(String s) {
    return SignatureParser.make().parseClassSig(s);
}