本文整理了Java中org.reflections.vfs.Vfs.setDefaultURLTypes()
方法的一些代码示例,展示了Vfs.setDefaultURLTypes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vfs.setDefaultURLTypes()
方法的具体详情如下:
包路径:org.reflections.vfs.Vfs
类名称:Vfs
方法名:setDefaultURLTypes
[英]sets the static default url types. can be used to statically plug in urlTypes
[中]设置静态默认url类型。可用于静态插入urlTypes
代码示例来源:origin: io.kotlintest/kotlintest
/**
* OSX contains file:// resources on the classpath including .mar and .jnilib files.
* <p>
* Reflections use of Vfs doesn't recognize these URLs and logs warns when it sees them. By registering those file
* endings, we supress the warns.
*/
public static void registerUrlTypes() {
final List<Vfs.UrlType> urlTypes = Lists.newArrayList();
// include a list of file extensions / filenames to be recognized
urlTypes.add(new EmptyIfFileEndingsUrlType(".mar", ".jnilib"));
urlTypes.addAll(Arrays.asList(Vfs.DefaultUrlTypes.values()));
Vfs.setDefaultURLTypes(urlTypes);
}
代码示例来源:origin: org.apache.kafka/connect-runtime
public static void registerUrlTypes() {
final List<UrlType> urlTypes = new LinkedList<>();
urlTypes.add(new EmptyUrlType(ENDINGS));
urlTypes.addAll(Arrays.asList(Vfs.DefaultUrlTypes.values()));
Vfs.setDefaultURLTypes(urlTypes);
}
代码示例来源:origin: org.deeplearning4j/deeplearning4j-nn
/**
* OSX contains file:// resources on the classpath including .mar and .jnilib files.
*
* Reflections use of Vfs doesn't recognize these URLs and logs warns when it sees them. By registering those file endings, we suppress the warns.
*/
public static void registerUrlTypes() {
final List<Vfs.UrlType> urlTypes = Lists.newArrayList();
// include a list of file extensions / filenames to be recognized
urlTypes.add(new EmptyIfFileEndingsUrlType(".mar", ".jnilib", ".so", ".dll"));
urlTypes.addAll(Arrays.asList(Vfs.DefaultUrlTypes.values()));
Vfs.setDefaultURLTypes(urlTypes);
}
代码示例来源:origin: org.apache.isis.core/isis-core-applib
@Programmatic
@Override
public <T> Set<Class<? extends T>> findSubTypesOfClasses(Class<T> type) {
Vfs.setDefaultURLTypes(getUrlTypes());
final Reflections reflections = new Reflections(
ClasspathHelper.forClassLoader(Thread.currentThread().getContextClassLoader()),
ClasspathHelper.forClass(Object.class),
new SubTypesScanner(false)
);
return reflections.getSubTypesOf(type);
}
代码示例来源:origin: org.seedstack.seed/seed-core
private synchronized Kernel createKernel(KernelConfiguration kernelConfiguration,
DiagnosticManager diagnosticManager) {
// Kernel instantiation
Kernel kernel = NuunCore.createKernel(kernelConfiguration);
FallbackUrlType fallbackUrlType = new FallbackUrlType();
List<Vfs.UrlType> urlTypes = new ArrayList<>(detectedUrlTypes);
urlTypes.add(fallbackUrlType);
LOGGER.debug("Registered URL types for classpath scan: " + urlTypes);
// Kernel initialization (it is assumed that only this class alter Vfs default url types)
Vfs.setDefaultURLTypes(urlTypes);
kernel.init();
Vfs.setDefaultURLTypes(savedUrlTypes);
// Log if any URL were not scanned
int failedUrlCount = fallbackUrlType.getFailedUrls().size();
if (failedUrlCount > 0) {
for (String failedUrl : fallbackUrlType.getFailedUrls()) {
LOGGER.warn("URL not scanned: {}", failedUrl);
}
}
diagnosticManager.registerDiagnosticInfoCollector("kernel", () -> {
Map<String, Object> result = new HashMap<>();
result.put("scannedUrls", kernel.scannedURLs());
result.put("failedUrls", fallbackUrlType.getFailedUrls());
return result;
});
return kernel;
}
代码示例来源:origin: org.apache.isis.core/isis-core-runtime
Iterables.addAll(moduleAndFrameworkPackages, modulePackages);
Vfs.setDefaultURLTypes(ClassDiscoveryServiceUsingReflections.getUrlTypes());
代码示例来源:origin: org.apache.isis.core/isis-core-runtime
public void appendServices(final SortedMap<String, SortedSet<String>> positionedServices) {
initIfRequired();
final List<String> packagePrefixList = asList(packagePrefixes);
Set<Class<?>> domainServiceTypes = AppManifest.Registry.instance().getDomainServiceTypes();
if(domainServiceTypes == null) {
// if no appManifest
Vfs.setDefaultURLTypes(ClassDiscoveryServiceUsingReflections.getUrlTypes());
final Reflections reflections = new Reflections(packagePrefixList);
domainServiceTypes = reflections.getTypesAnnotatedWith(DomainService.class);
}
final List<Class<?>> domainServiceClasses = Lists.newArrayList(Iterables.filter(domainServiceTypes, instantiatable()));
for (final Class<?> cls : domainServiceClasses) {
final String order = DomainServiceMenuOrder.orderOf(cls);
// we want the class name in order to instantiate it
// (and *not* the value of the @DomainServiceLayout(named=...) annotation attribute)
final String fullyQualifiedClassName = cls.getName();
final String name = nameOf(cls);
ServicesInstallerUtils.appendInPosition(positionedServices, order, fullyQualifiedClassName);
}
}
代码示例来源:origin: org.apache.isis.core/isis-core-applib
@Programmatic
@Override
public <T> Set<Class<? extends T>> findSubTypesOfClasses(Class<T> type, String packagePrefix) {
if(type == FixtureScript.class) {
Set fixtureScriptTypes = AppManifest.Registry.instance().getFixtureScriptTypes();
if (fixtureScriptTypes != null) {
return fixtureScriptTypes;
}
}
// no appManifest or not asking for FixtureScripts
Vfs.setDefaultURLTypes(getUrlTypes());
final Reflections reflections = new Reflections(
ClasspathHelper.forClassLoader(Thread.currentThread().getContextClassLoader()),
ClasspathHelper.forClass(Object.class),
ClasspathHelper.forPackage(packagePrefix),
new SubTypesScanner(false)
);
return reflections.getSubTypesOf(type);
}
内容来源于网络,如有侵权,请联系作者删除!