SimpleMarshallerMappingsFromAnnotationsLoader.java 文件源码

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

项目:r01fb 作者:
private void _processPackages(final Set<String> packages) {
    if (CollectionUtils.hasData(_packages)) {
        // [1] - Find all types annotated with @XmlRootElement 
        Set<Class<?>> allPckgsTypes = Sets.newHashSet(); 

List<URL> urls = new ArrayList<URL>();
//urls.addAll(ClasspathHelper.forPackage("javax.xml.bind.annotation"));
        for (String p : packages) {
            //Reflections typeScanner = new Reflections(p);
    urls.addAll(ClasspathHelper.forPackage(p)); // see https://code.google.com/p/reflections/issues/detail?id=53
    log.debug("Scanning package {} for @XmlRootElement annotated types",p);
        }
Reflections typeScanner = new Reflections(new ConfigurationBuilder()
                                                    .setUrls(urls));                    
Set<Class<?>> pckgTypes = typeScanner.getTypesAnnotatedWith(XmlRootElement.class);
if (CollectionUtils.hasData(pckgTypes)) {
        for (Class<?> type : pckgTypes) log.trace(">Type {}",type);
    allPckgsTypes.addAll(pckgTypes);
} else {
    log.debug("NO types annotated with @XmlRootElement");
}
        // [2] - Process...
        _processTypes(allPckgsTypes);
    }
 }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号