StaticImplicitMethodsFeatureForTypeProvider.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:xtext-extras 作者:
protected Map<String, Collection<String>> denormalize(Multimap<Class<?>, Class<?>> classMapping) {
    Multimap<String, String> result = LinkedHashMultimap.create();
    for(Map.Entry<Class<?>, Class<?>> entry: classMapping.entries()) {
        Class<?> key = entry.getKey();
        Class<?> keyObjectType = ReflectionUtil.getObjectType(key);
        Class<?> value = entry.getValue();
        for(Method method: value.getDeclaredMethods()) {
            if (Modifier.isStatic(method.getModifiers()) && method.getParameterTypes().length > 0) {
                Class<?> paramType = method.getParameterTypes()[0];
                Class<?> paramObjectType = ReflectionUtil.getObjectType(paramType);     
                if (keyObjectType.isAssignableFrom(paramObjectType)) {
                    result.put(paramObjectType.getCanonicalName(), value.getCanonicalName());
                }
            }
        }
    }
    return ImmutableMultimap.copyOf(result).asMap();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号