congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Indexer
Code IndexAdd Tabnine to your IDE (free)

How to use
Indexer
in
org.jboss.jandex

Best Java code snippets using org.jboss.jandex.Indexer (Showing top 20 results out of 315)

Refine searchRefine arrow

  • DataInputStream
origin: wildfly/wildfly

} else {
  Indexer indexer = new Indexer();
  consumer = (name, classFile) -> {
    try (InputStream in = classFile.openStream()) {
      ClassInfo classInfo = indexer.index(in);
      allKnownClasses.add(name);
      if (classInfo != null && hasBeanDefiningAnnotation(classInfo, beanDefiningAnnotations)) {
origin: mbechler/serianalyzer

/**
 * @return the index
 */
public Index getIndex () {
  if ( this.index == null ) {
    this.index = this.indexer.complete();
  }
  return this.index;
}
origin: io.thorntail/config-api-runtime

/**
 * 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;
}
origin: weld/core

private void addToIndex(InputStream inputStream) {
  try {
    indexer.index(inputStream);
  } catch (IOException ex) {
    CommonLogger.LOG.couldNotOpenStreamForURL(inputStream, ex);
  }
}
origin: org.hibernate/com.springsource.org.hibernate

@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 );
}
origin: wildfly/jandex

      ClassInfo info;
      try {
        info = indexer.index(stream);
      } finally {
        safeClose(stream);
Index index = indexer.complete();
int bytes = writer.write(index);
origin: spring-projects/sts4

private static IndexView createJarIndex(File indexFile, File jarFile) {
  try {
    return JarIndexer.createJarIndex(jarFile, new Indexer(), indexFile, false, false,
        false, System.out, System.err).getIndex();
  } catch (Exception e) {
    log.error("Failed to index '" + jarFile + "'", e);
    return null;
  }
}
origin: org.wildfly.swarm/config-api-runtime

/**
 * 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;
}
origin: org.jboss.weld.servlet/weld-servlet-shaded

private void addToIndex(InputStream inputStream) {
  try {
    indexer.index(inputStream);
  } catch (IOException ex) {
    CommonLogger.LOG.couldNotOpenStreamForURL(inputStream, ex);
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

@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 );
}
origin: wildfly/jandex

@Override
public void execute() throws BuildException {
  if (!run) {
    return;
  }
  if (modify && newJar) {
    throw new BuildException("Specifying both modify and newJar does not make sense.");
  }
  Indexer indexer = new Indexer();
  for(FileSet fileset : filesets) {
    String[] files = fileset.getDirectoryScanner(getProject()).getIncludedFiles();
    for(String file : files) {
      if (file.endsWith(".jar")) {
        try {
          JarIndexer.createJarIndex(new File(fileset.getDir().getAbsolutePath() + "/" +file), indexer, modify, newJar,verbose);
        } catch (IOException e) {
          throw new BuildException(e);
        }
      }
    }
  }
}
origin: org.wildfly.swarm/container-runtime

private void resolveRuntimeIndex(Module module, List<Index> indexes) throws ModuleLoadException {
  Indexer indexer = new Indexer();
  Iterator<Resource> resources = module.iterateResources(PathFilters.acceptAll());
  while (resources.hasNext()) {
    Resource each = resources.next();
    if (each.getName().endsWith(".class")) {
      try {
        ClassInfo clsInfo = indexer.index(each.openStream());
      } catch (IOException e) {
        //System.err.println("error: " + each.getName() + ": " + e.getMessage());
      }
    }
  }
  indexes.add(indexer.complete());
}
origin: weld/core

private void addToIndex(InputStream inputStream) {
  try {
    indexer.index(inputStream);
  } catch (IOException ex) {
    CommonLogger.LOG.couldNotOpenStreamForURL(inputStream, ex);
  }
}
origin: org.jboss.weld.se/weld-se

  private Index buildIndex() {
    return indexer.complete();
  }
}
origin: stackoverflow.com

Indexer indxK = new Indexer();
Indexer indxT = new Indexer();
origin: spring-projects/sts4

private static IndexView indexFolder(File folder) {
  Indexer indexer = new Indexer();
  for (Iterator<File> itr = com.google.common.io.Files.fileTreeTraverser().breadthFirstTraversal(folder)
      .iterator(); itr.hasNext();) {
    File file = itr.next();
    if (file.isFile() && file.getName().endsWith(".class")) {
      try {
        final InputStream stream = new FileInputStream(file);
        try {
          indexer.index(stream);
        } finally {
          try {
            stream.close();
          } catch (Exception ignore) {
          }
        }
      } catch (Exception e) {
        log.error("Failed to index file " + file, e);
      }
    }
  }
  return indexer.complete();
}
origin: org.fuin/utils4j

/**
 * Indexes a single file, except it was already analyzed.
 * 
 * @param indexer
 *            Indexer to use.
 * @param knownFiles
 *            List of files already analyzed. New files will be added within this method.
 * @param classFile
 *            Class file to analyze.
 * 
 * @return TRUE if the file was indexed or FALSE if it was ignored.
 */
public static boolean indexClassFile(final Indexer indexer, final List<File> knownFiles,
    final File classFile) {
  if (knownFiles.contains(classFile)) {
    return false;
  }
  knownFiles.add(classFile);
  try (final InputStream in = classFile.toURI().toURL().openStream()) {
    indexer.index(in);
  } catch (final IOException ex) {
    throw new RuntimeException("Error indexing file: " + classFile, ex);
  }
  return true;
}
origin: weld/core

  private Index buildIndex() {
    return indexer.complete();
  }
}
origin: wildfly/jandex

private Index getIndex(long start) throws IOException {
  Indexer indexer = new Indexer();
  Result result = (source.isDirectory()) ? indexDirectory(source, indexer) : JarIndexer.createJarIndex(source, indexer, outputFile, modify, jarFile, verbose);
  double time = (System.currentTimeMillis() - start) / 1000.00;
  System.out.printf("Wrote %s in %.4f seconds (%d classes, %d annotations, %d instances, %d bytes)\n", result.getName(), time, result.getClasses(), result.getAnnotations(), result.getInstances(), result.getBytes());
  return result.getIndex();
}
origin: org.hibernate/com.springsource.org.hibernate

Indexer indexer = new Indexer();
for ( Class<?> clazz : classes ) {
  InputStream stream = classLoaderService.locateResourceStream(
  );
  try {
    indexer.index( stream );
return indexer.complete();
org.jboss.jandexIndexer

Javadoc

Analyzes and indexes the annotation and key structural information of a set of classes. The indexer will purposefully skip any class that is not Java 5 or later. It will also do a basic/quick structural scan on any class it determines does not have annotations.

The Indexer operates on input streams that point to class file data. Input streams do not need to be buffered, as the indexer already does this. There is also no limit to the number of class file streams the indexer can process, other than available memory.

The Indexer attempts to minimize the final memory state of the index, but to do this it must maintain additional in-process state (intern tables etc) until the index is complete.

Numerous optimizations are taken during indexing to attempt to minimize the CPU and I/O cost, however, the Java class file format was not designed for partial searching, which ultimately limits the efficiency of processing them.

Thread-Safety This class is not thread-safe can not be shared between threads. The index it produces however is thread-safe.

Most used methods

  • index
  • complete
  • <init>
  • addImplementor
  • addSubclass
  • applySignatures
  • bitsToInt
  • bitsToLong
  • buildClassesQueue
  • buildOwnerMap
  • convertClassFieldDescriptor
  • convertParameterized
  • convertClassFieldDescriptor,
  • convertParameterized,
  • copyTypeParameters,
  • decodeClassEntry,
  • decodeDoubleEntry,
  • decodeFloatEntry,
  • decodeIntegerEntry,
  • decodeLongEntry,
  • decodeNameAndTypeEntry,
  • decodeUtf8Entry

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setScale (BigDecimal)
  • startActivity (Activity)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now