当前位置: 首页>>代码示例>>Java>>正文


Java Indexer.index方法代码示例

本文整理汇总了Java中org.jboss.jandex.Indexer.index方法的典型用法代码示例。如果您正苦于以下问题:Java Indexer.index方法的具体用法?Java Indexer.index怎么用?Java Indexer.index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.jandex.Indexer的用法示例。


在下文中一共展示了Indexer.index方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: index

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
@Produces
@DeploymentScoped
@Default
IndexView index() {
    Indexer indexer = new Indexer();
    Map<ArchivePath, Node> c = context.getCurrentArchive().getContent();
    try {
        for (Map.Entry<ArchivePath, Node> each : c.entrySet()) {
            if (each.getKey().get().endsWith(CLASS_SUFFIX)) {
                indexer.index(each.getValue().getAsset().openStream());
            }
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    return indexer.complete();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:DeploymentProducer.java

示例2: createIndex

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
/**
 * Creates an annotation index for the given entity type
 */
public synchronized static Index createIndex(Class<?> type) {
    Index index = indices.get(type);
    if (index == null) {
        try {
            Indexer indexer = new Indexer();
            Class<?> currentType = type;
            while ( currentType != null ) {
                String className = currentType.getName().replace(".", "/") + ".class";
                InputStream stream = type.getClassLoader()
                        .getResourceAsStream(className);
                indexer.index(stream);
                currentType = currentType.getSuperclass();
            }
            index = indexer.complete();
            indices.put(type, index);
        } catch (IOException e) {
            throw new RuntimeException("Failed to initialize Indexer", e);
        }
    }
    return index;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-config-api,代码行数:25,代码来源:IndexFactory.java

示例3: loadDependentIndexFromArchive

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
protected IndexView loadDependentIndexFromArchive(File archive) throws IOException {
    try (JarFile jar = new JarFile(archive)) {

        ZipEntry entry = jar.getEntry("META-INF/" + Jandexer.INDEX_NAME);
        if (entry != null) {
            return loadIndex(jar.getInputStream(entry));

        }
        Indexer indexer = new Indexer();

        Enumeration<JarEntry> entries = jar.entries();

        while (entries.hasMoreElements()) {
            JarEntry each = entries.nextElement();
            if (each.getName().endsWith(".class") && !each.getName().equals("module-info.class")) {
                try (InputStream in = jar.getInputStream(each)) {
                    indexer.index(in);
                }
            }

        }

        return indexer.complete();
    }
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm-fraction-plugin,代码行数:26,代码来源:ConfigurableDocumentationGenerator.java

示例4: calculateModuleIndex

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
private Index calculateModuleIndex(final Module module) throws ModuleLoadException, IOException {
    final Indexer indexer = new Indexer();
    final PathFilter filter = PathFilters.getDefaultImportFilter();
    final Iterator<Resource> iterator = module.iterateResources(filter);
    while (iterator.hasNext()) {
        Resource resource = iterator.next();
        if(resource.getName().endsWith(".class")) {
            try (InputStream in = resource.openStream()) {
                indexer.index(in);
            } catch (Exception e) {
                ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(resource.getName(), resource.getURL().toExternalForm(), e);
            }
        }
    }
    return indexer.complete();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:17,代码来源:CompositeIndexProcessor.java

示例5: indexForClass

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
/**
 * Creates a jandex index for the specified classes
 *
 * @param classLoaderService class loader service
 * @param classes the classes to index
 *
 * @return an annotation repository w/ all the annotation discovered in the specified classes
 */
public static Index indexForClass(ClassLoaderService classLoaderService, Class<?>... classes) {
	Indexer indexer = new Indexer();
	for ( Class<?> clazz : classes ) {
		InputStream stream = classLoaderService.locateResourceStream(
				clazz.getName().replace( '.', '/' ) + ".class"
		);
		try {
			indexer.index( stream );
		}
		catch ( IOException e ) {
			StringBuilder builder = new StringBuilder();
			builder.append( "[" );
			int count = 0;
			for ( Class<?> c : classes ) {
				builder.append( c.getName() );
				if ( count < classes.length - 1 ) {
					builder.append( "," );
				}
				count++;
			}
			builder.append( "]" );
			throw new HibernateException( "Unable to create annotation index for " + builder.toString() );
		}
	}
	return indexer.complete();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:JandexHelper.java

示例6: indexClass

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
private void indexClass(Indexer indexer, String className) {
	InputStream stream = metadata.getServiceRegistry().getService( ClassLoaderService.class ).locateResourceStream(
			className
	);
	try {
		indexer.index( stream );
	}
	catch ( IOException e ) {
		throw new HibernateException( "Unable to open input stream for class " + className, e );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:AnnotationMetadataSourceProcessorImpl.java

示例7: createIndex

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
Index createIndex(Archive<?> archive) throws IOException {
    Indexer indexer = new Indexer();

    Map<ArchivePath, Node> c = archive.getContent();
    for (Map.Entry<ArchivePath, Node> each : c.entrySet()) {
        if (each.getKey().get().endsWith(".class")) {
            indexer.index(each.getValue().getAsset().openStream());
        }
    }


    return indexer.complete();
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:14,代码来源:AdvertisingMetadataProcessorTest.java

示例8: addToIndex

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
private void addToIndex(Indexer indexer, ResourcePoolEntry entry) {
    try {
        indexer.index( entry.content() );
    }
    catch(Exception ex) {
        throw new RuntimeException( ex );
    }
}
 
开发者ID:hibernate,项目名称:hibernate-demos,代码行数:9,代码来源:AddIndexPlugin.java

示例9: indexClassURL

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
private static void indexClassURL(URL classURL, Indexer indexer, ServletContext context){

        try {

            if(!isClassFile(classURL))
                return;

            indexer.index(classURL.openStream());

        }catch (Throwable ex){

            log.error(String.format("Error indexing class: %s",classURL.toString()),ex);
            return;

        }

    }
 
开发者ID:Emerjoin,项目名称:Hi-Framework,代码行数:18,代码来源:BootstrapUtils.java

示例10: getIndexForClass

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
private Index getIndexForClass(URLClassLoader classLoader, String className) throws IOException {
	Indexer indexer = new Indexer();
	indexer.index(classLoader.getResourceAsStream(className));
	return indexer.complete();
}
 
开发者ID:ContaAzul,项目名称:jaxrs-path-analyzer,代码行数:6,代码来源:PathAnalyzer.java

示例11: index

import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
/**
 * Indexes a class by it's name.
 * 
 * @param indexer
 *            Indexer to use.
 * @param cl
 *            Class loader to use.
 * @param className
 *            Full qualified name of the class.
 */
public static void index(final Indexer indexer, final ClassLoader cl, final String className) {
    final InputStream stream = cl.getResourceAsStream(className.replace('.', '/') + ".class");
    try {
        indexer.index(stream);
    } catch (final IOException ex) {
        throw new RuntimeException(ex);
    }
}
 
开发者ID:fuinorg,项目名称:units4j,代码行数:19,代码来源:Units4JUtils.java


注:本文中的org.jboss.jandex.Indexer.index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。