/** * 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; }
/** * 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; }
/** * 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); } }
/** * 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); } }
int keys = 0; int values = 0; for (String index : store.keySet()) { keys += store.get(index).keySet().size(); values += store.get(index).size();
int keys = 0; int values = 0; for (String index : store.keySet()) { keys += store.get(index).keySet().size(); values += store.get(index).size();
int keys = 0; int values = 0; for (String index : store.keySet()) { keys += store.get(index).keySet().size(); values += store.get(index).size();
int keys = 0; int values = 0; for (String index : store.keySet()) { keys += store.get(index).keySet().size(); values += store.get(index).size();
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; } }
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; } }
/** * 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; }
/** * 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; }
/** * 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); } }
int keys = 0; int values = 0; for (String index : store.keySet()) { keys += store.get(index).keySet().size(); values += store.get(index).size();
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; }
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); } }
int keys = 0; int values = 0; for (String index : store.keySet()) { keys += store.get(index).keySet().size(); values += store.get(index).size();
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; } }
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; } }
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; } }