org.reflections.Store Java Examples

The following examples show how to use org.reflections.Store. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScanPrinterUtils.java    From disconf with Apache License 2.0 6 votes vote down vote up
/**
 * 打印出StoreMap的数据
 */
public static void printStoreMap(Reflections reflections) {

    LOGGER.info("Now we will print store map......");

    Store store = reflections.getStore();
    Map<String/* indexName */, Multimap<String, String>> storeMap = store.getStoreMap();
    for (String indexName : storeMap.keySet()) {

        LOGGER.info("====================================");
        LOGGER.info("indexName:" + indexName);

        Multimap<String, String> multimap = storeMap.get(indexName);

        for (String firstName : multimap.keySet()) {
            Collection<String> lastNames = multimap.get(firstName);
            LOGGER.info("\t\t" + firstName + ": " + lastNames);
        }

    }
}
 
Example #2
Source File: ScanPrinterUtils.java    From disconf with Apache License 2.0 6 votes vote down vote up
/**
 * 打印出StoreMap的数据
 */
public static void printStoreMap(Reflections reflections) {

    LOGGER.info("Now we will print store map......");

    Store store = reflections.getStore();
    Map<String/* indexName */, Multimap<String, String>> storeMap = store.getStoreMap();
    for (String indexName : storeMap.keySet()) {

        LOGGER.info("====================================");
        LOGGER.info("indexName:" + indexName);

        Multimap<String, String> multimap = storeMap.get(indexName);

        for (String firstName : multimap.keySet()) {
            Collection<String> lastNames = multimap.get(firstName);
            LOGGER.info("\t\t" + firstName + ": " + lastNames);
        }

    }
}
 
Example #3
Source File: DocStringExtractor.java    From armeria with Apache License 2.0 5 votes vote down vote up
private Map<String, String> getAllDocStrings0(ClassLoader classLoader) {
    final Configuration configuration = new ConfigurationBuilder()
            .filterInputsBy(new FilterBuilder().includePackage(path))
            .setUrls(ClasspathHelper.forPackage(path, classLoader))
            .addClassLoader(classLoader)
            .setScanners(new ResourcesScanner());
    if (configuration.getUrls() == null || configuration.getUrls().isEmpty()) {
        // No resource folders were found.
        return ImmutableMap.of();
    }

    final Reflections reflections = new Reflections(configuration);
    final Store store = reflections.getStore();
    if (!store.keySet().contains(ResourcesScanner.class.getSimpleName())) {
        // No resources were found.
        return ImmutableMap.of();
    }

    final Map<String, byte[]> files = reflections
            .getResources(this::acceptFile).stream()
            .map(f -> {
                try {
                    final URL url = classLoader.getResource(f);
                    if (url == null) {
                        throw new IllegalStateException("not found: " + f);
                    }
                    return Maps.immutableEntry(f, Resources.toByteArray(url));
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            })
            .collect(toImmutableMap(Entry::getKey, Entry::getValue));

    return getDocStringsFromFiles(files);
}
 
Example #4
Source File: ReflectionScanner.java    From brooklyn-server with Apache License 2.0 4 votes vote down vote up
public Store getStore() {
    return reflections.getStore();
}