Java 类org.reflections.adapters.JavaReflectionAdapter 实例源码

项目:reflections    文件:ConfigurationBuilder.java   
/** 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());
        }
    }
}