org.reflections.Store.keySet()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(89)

本文整理了Java中org.reflections.Store.keySet()方法的一些代码示例,展示了Store.keySet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Store.keySet()方法的具体详情如下:
包路径:org.reflections.Store
类名称:Store
方法名:keySet

Store.keySet介绍

[英]return all indices
[中]返回所有索引

代码示例

代码示例来源:origin: ronmamo/reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.reflections/reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: ronmamo/reflections

/**
 * expand super types after scanning, for super types that were not scanned.
 * this is helpful in finding the transitive closure without scanning all 3rd party dependencies.
 * it uses {@link ReflectionUtils#getSuperTypes(Class)}.
 * <p>
 * for example, for classes A,B,C where A supertype of B, B supertype of C:
 * <ul>
 *     <li>if scanning C resulted in B (B->C in store), but A was not scanned (although A supertype of B) - then getSubTypes(A) will not return C</li>
 *     <li>if expanding supertypes, B will be expanded with A (A->B in store) - then getSubTypes(A) will return C</li>
 * </ul>
 */
public void expandSuperTypes() {
  if (store.keySet().contains(index(SubTypesScanner.class))) {
    Multimap<String, String> mmap = store.get(index(SubTypesScanner.class));
    Sets.SetView<String> keys = Sets.difference(mmap.keySet(), Sets.newHashSet(mmap.values()));
    Multimap<String, String> expand = HashMultimap.create();
    for (String key : keys) {
      final Class<?> type = forName(key, loaders());
      if (type != null) {
        expandSupertypes(expand, key, type);
      }
    }
    mmap.putAll(expand);
  }
}

代码示例来源:origin: org.reflections/reflections

/**
 * expand super types after scanning, for super types that were not scanned.
 * this is helpful in finding the transitive closure without scanning all 3rd party dependencies.
 * it uses {@link ReflectionUtils#getSuperTypes(Class)}.
 * <p>
 * for example, for classes A,B,C where A supertype of B, B supertype of C:
 * <ul>
 *     <li>if scanning C resulted in B (B->C in store), but A was not scanned (although A supertype of B) - then getSubTypes(A) will not return C</li>
 *     <li>if expanding supertypes, B will be expanded with A (A->B in store) - then getSubTypes(A) will return C</li>
 * </ul>
 */
public void expandSuperTypes() {
  if (store.keySet().contains(index(SubTypesScanner.class))) {
    Multimap<String, String> mmap = store.get(index(SubTypesScanner.class));
    Sets.SetView<String> keys = Sets.difference(mmap.keySet(), Sets.newHashSet(mmap.values()));
    Multimap<String, String> expand = HashMultimap.create();
    for (String key : keys) {
      final Class<?> type = forName(key);
      if (type != null) {
        expandSupertypes(expand, key, type);
      }
    }
    mmap.putAll(expand);
  }
}

代码示例来源:origin: ronmamo/reflections

int keys = 0;
int values = 0;
for (String index : store.keySet()) {
  keys += store.get(index).keySet().size();
  values += store.get(index).size();

代码示例来源:origin: org.reflections/reflections

int keys = 0;
int values = 0;
for (String index : store.keySet()) {
  keys += store.get(index).keySet().size();
  values += store.get(index).size();

代码示例来源:origin: org.reflections/reflections

int keys = 0;
int values = 0;
for (String index : store.keySet()) {
  keys += store.get(index).keySet().size();
  values += store.get(index).size();

代码示例来源:origin: ronmamo/reflections

int keys = 0;
int values = 0;
for (String index : store.keySet()) {
  keys += store.get(index).keySet().size();
  values += store.get(index).size();

代码示例来源:origin: ronmamo/reflections

private Document createDocument(final Reflections reflections) {
    Store map = reflections.getStore();

    Document document = DocumentFactory.getInstance().createDocument();
    Element root = document.addElement("Reflections");
    for (String indexName : map.keySet()) {
      Element indexElement = root.addElement(indexName);
      for (String key : map.get(indexName).keySet()) {
        Element entryElement = indexElement.addElement("entry");
        entryElement.addElement("key").setText(key);
        Element valuesElement = entryElement.addElement("values");
        for (String value : map.get(indexName).get(key)) {
          valuesElement.addElement("value").setText(value);
        }
      }
    }
    return document;
  }
}

代码示例来源:origin: org.reflections/reflections

private Document createDocument(final Reflections reflections) {
    Store map = reflections.getStore();

    Document document = DocumentFactory.getInstance().createDocument();
    Element root = document.addElement("Reflections");
    for (String indexName : map.keySet()) {
      Element indexElement = root.addElement(indexName);
      for (String key : map.get(indexName).keySet()) {
        Element entryElement = indexElement.addElement("entry");
        entryElement.addElement("key").setText(key);
        Element valuesElement = entryElement.addElement("values");
        for (String value : map.get(indexName).get(key)) {
          valuesElement.addElement("value").setText(value);
        }
      }
    }
    return document;
  }
}

代码示例来源:origin: ai.h2o/reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

/**
 * expand super types after scanning, for super types that were not scanned.
 * this is helpful in finding the transitive closure without scanning all 3rd party dependencies.
 * it uses {@link ReflectionUtils#getSuperTypes(Class)}.
 * <p>
 * for example, for classes A,B,C where A supertype of B, B supertype of C:
 * <ul>
 *     <li>if scanning C resulted in B (B->C in store), but A was not scanned (although A supertype of B) - then getSubTypes(A) will not return C</li>
 *     <li>if expanding supertypes, B will be expanded with A (A->B in store) - then getSubTypes(A) will return C</li>
 * </ul>
 */
public void expandSuperTypes() {
  if (store.keySet().contains(index(SubTypesScanner.class))) {
    Multimap<String, String> mmap = store.get(index(SubTypesScanner.class));
    Sets.SetView<String> keys = Sets.difference(mmap.keySet(), Sets.newHashSet(mmap.values()));
    Multimap<String, String> expand = HashMultimap.create();
    for (String key : keys) {
      final Class<?> type = forName(key);
      if (type != null) {
        expandSupertypes(expand, key, type);
      }
    }
    mmap.putAll(expand);
  }
}

代码示例来源:origin: ai.h2o/reflections

int keys = 0;
int values = 0;
for (String index : store.keySet()) {
  keys += store.get(index).keySet().size();
  values += store.get(index).size();

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

public Reflections merge(final Reflections reflections) {
 if (reflections.store != null) {
  for (String indexName : reflections.store.keySet()) {
   Multimap<String, String> index = reflections.store.get(indexName);
   for (String key : index.keySet()) {
    for (String string : index.get(key)) {
     store.getOrCreate(indexName).put(key , string);
    }
   }
  }
 }
 return this;
}

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

public void expandSuperTypes() {
 if (store.keySet().contains(index(SubTypesScanner.class))) {
  final Multimap<String, String> mmap = store.get(index(SubTypesScanner.class));
  final Collection<String> values = mmap.values();
  final Set<String> keys = Sets.difference(mmap.keySet() , new HashSet<>(values));
  final Multimap<String, String> expand = new MultimapImpl<>();
  for (final String key : keys) {
   expandSupertypes(expand , key , forName(key));
  }
  mmap.putAll(expand);
 }
}

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

int keys = 0;
int values = 0;
for (String index : store.keySet()) {
 keys += store.get(index).keySet().size();
 values += store.get(index).size();

代码示例来源:origin: ai.h2o/reflections

private Document createDocument(final Reflections reflections) {
    Store map = reflections.getStore();

    Document document = DocumentFactory.getInstance().createDocument();
    Element root = document.addElement("Reflections");
    for (String indexName : map.keySet()) {
      Element indexElement = root.addElement(indexName);
      for (String key : map.get(indexName).keySet()) {
        Element entryElement = indexElement.addElement("entry");
        entryElement.addElement("key").setText(key);
        Element valuesElement = entryElement.addElement("values");
        for (String value : map.get(indexName).get(key)) {
          valuesElement.addElement("value").setText(value);
        }
      }
    }
    return document;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

private Document createDocument(final Reflections reflections) {
    Store map = reflections.getStore();

    Document document = DocumentFactory.getInstance().createDocument();
    Element root = document.addElement("Reflections");
    for (String indexName : map.keySet()) {
      Element indexElement = root.addElement(indexName);
      for (String key : map.get(indexName).keySet()) {
        Element entryElement = indexElement.addElement("entry");
        entryElement.addElement("key").setText(key);
        Element valuesElement = entryElement.addElement("values");
        for (String value : map.get(indexName).get(key)) {
          valuesElement.addElement("value").setText(value);
        }
      }
    }
    return document;
  }
}

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

private Document createDocument(final Reflections reflections) {
  Store map = reflections.getStore();

  Document document = DocumentFactory.getInstance().createDocument();
  Element root = document.addElement("Reflections");
  for (String indexName : map.keySet()) {
   Element indexElement = root.addElement(indexName);
   for (String key : map.get(indexName).keySet()) {
    Element entryElement = indexElement.addElement("entry");
    entryElement.addElement("key").setText(key);
    Element valuesElement = entryElement.addElement("values");
    for (String value : map.get(indexName).get(key)) {
     valuesElement.addElement("value").setText(value);
    }
   }
  }
  return document;
 }
}

相关文章