private void expandSupertypes(Multimap<String, String> mmap, String key, Class<?> type) { for (Class<?> supertype : ReflectionUtils.getSuperTypes(type)) { if (mmap.put(supertype.getName(), key)) { if (log != null) log.debug("expanded subtype {} -> {}", supertype.getName(), key); expandSupertypes(mmap, supertype.getName(), supertype); } } }
private void expandSupertypes(Multimap<String, String> mmap, String key, Class<?> type) { for (Class<?> supertype : ReflectionUtils.getSuperTypes(type)) { if (mmap.put(supertype.getName(), key)) { if (log != null) log.debug("expanded subtype {} -> {}", supertype.getName(), key); expandSupertypes(mmap, supertype.getName(), supertype); } } }
/** * 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); } }
/** * 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); } }
private void expandSupertypes(Multimap<String, String> mmap, String key, Class<?> type) { for (Class<?> supertype : ReflectionUtils.getSuperTypes(type)) { if (mmap.put(supertype.getName(), key)) { if (log != null) log.debug("expanded subtype {} -> {}", supertype.getName(), key); expandSupertypes(mmap, supertype.getName(), supertype); } } }
private void expandSupertypes(Multimap<String, String> mmap , String key , Class<?> type) { for (Class<?> supertype : ReflectionUtils.getSuperTypes(type)) { if (mmap.put(supertype.getName() , key)) { if (LOGGER != null) LOGGER.fine("expanded subtype {} -> {} " + supertype.getName() + " - " + key); expandSupertypes(mmap , supertype.getName() , supertype); } } }
/** * 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); } }
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); } }