本文整理汇总了Java中org.jboss.jandex.Indexer.complete方法的典型用法代码示例。如果您正苦于以下问题:Java Indexer.complete方法的具体用法?Java Indexer.complete怎么用?Java Indexer.complete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.jandex.Indexer
的用法示例。
在下文中一共展示了Indexer.complete方法的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();
}
示例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;
}
示例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();
}
示例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();
}
示例6: prepare
import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
@Override
@SuppressWarnings( { "unchecked" })
public void prepare(MetadataSources sources) {
// create a jandex index from the annotated classes
Indexer indexer = new Indexer();
for ( Class<?> clazz : sources.getAnnotatedClasses() ) {
indexClass( indexer, clazz.getName().replace( '.', '/' ) + ".class" );
}
// add package-info from the configured packages
for ( String packageName : sources.getAnnotatedPackages() ) {
indexClass( indexer, packageName.replace( '.', '/' ) + "/package-info.class" );
}
Index index = indexer.complete();
List<JaxbRoot<JaxbEntityMappings>> mappings = new ArrayList<JaxbRoot<JaxbEntityMappings>>();
for ( JaxbRoot<?> root : sources.getJaxbRootList() ) {
if ( root.getRoot() instanceof JaxbEntityMappings ) {
mappings.add( (JaxbRoot<JaxbEntityMappings>) root );
}
}
if ( !mappings.isEmpty() ) {
index = parseAndUpdateIndex( mappings, index );
}
if ( index.getAnnotations( PseudoJpaDotNames.DEFAULT_DELIMITED_IDENTIFIERS ) != null ) {
// todo : this needs to move to AnnotationBindingContext
// what happens right now is that specifying this in an orm.xml causes it to effect all orm.xmls
metadata.setGloballyQuotedIdentifiers( true );
}
bindingContext = new AnnotationBindingContextImpl( metadata, index );
}
示例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();
}
示例8: testAssertThat
import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
@Test
public void testAssertThat() {
// TEST
final Indexer indexer = new Indexer();
final Index actual = indexer.complete();
final JandexAssert result = JandexAssert.assertThat(actual);
// VERIFY
assertThat(result).isNotNull();
}
示例9: 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();
}
示例10: indexAllClasses
import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
/**
* Creates an index for all class files in the given list.
*
* @param classFiles
* List of ".class" files.
*
* @return Index.
*/
public static final Index indexAllClasses(final List<File> classFiles) {
final Indexer indexer = new Indexer();
indexAllClasses(indexer, classFiles);
return indexer.complete();
}
示例11: index
import org.jboss.jandex.Indexer; //导入方法依赖的package包/类
/**
* Returns a Jandex index for a class by it's name.
*
* @param cl
* Class loader to use.
* @param className
* Full qualified name of the class.
*
* @return Jandex index.
*/
public static Index index(final ClassLoader cl, final String className) {
final Indexer indexer = new Indexer();
index(indexer, cl, className);
return indexer.complete();
}