本文整理汇总了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());
}
}
}