本文整理匯總了Java中org.reflections.adapters.JavassistAdapter類的典型用法代碼示例。如果您正苦於以下問題:Java JavassistAdapter類的具體用法?Java JavassistAdapter怎麽用?Java JavassistAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JavassistAdapter類屬於org.reflections.adapters包,在下文中一共展示了JavassistAdapter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: jarInputStream
import org.reflections.adapters.JavassistAdapter; //導入依賴的package包/類
@Test
public void jarInputStream() {
JavassistAdapter javassistAdapter = new JavassistAdapter();
for (URL jar : ClasspathHelper.forClassLoader()) {
try {
for (Vfs.File file : Iterables.limit(new JarInputDir(jar).getFiles(), 5)) {
if (file.getName().endsWith(".class")) {
String className = javassistAdapter.getClassName(javassistAdapter.getOrCreateClassObject(file));
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
示例2: getMetadataAdapter
import org.reflections.adapters.JavassistAdapter; //導入依賴的package包/類
/** returns the metadata adapter.
* if javassist library exists in the classpath, this method returns {@link JavassistAdapter} otherwise defaults to {@link JavaReflectionAdapter}.
* <p>the {@link JavassistAdapter} is preferred in terms of performance and class loading. */
public MetadataAdapter getMetadataAdapter() {
if (metadataAdapter != null) return metadataAdapter;
else {
try {
return (metadataAdapter = new JavassistAdapter());
} catch (Throwable e) {
if (Reflections.log != null)
Reflections.log.warn("could not create JavassistAdapter, using JavaReflectionAdapter", e);
return (metadataAdapter = new JavaReflectionAdapter());
}
}
}