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 ; }
Creates an annotation index for the given entity type