@Test @SuppressWarnings("unchecked") public void testCollectSuperclasses() { Collection<BindingStrategy> bindingStrategies = underTest .collectFromAggregates(Lists.newArrayList(MySubAgg1.class, MySubAgg2.class)); assertThat(((Map<?, ?>) Deencapsulation.getField(bindingStrategies.iterator() .next(), "constructorParamsMap")).size()).isEqualTo(3); }
Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) { Collection<BindingStrategy> bindingStrategies = new ArrayList<>(); Map<Type[], Key<?>> allGenerics = new HashMap<>(); for (Class<? extends AggregateRoot<?>> aggregateClass : BusinessUtils.includeSuperClasses(aggregateClasses)) { Type[] generics = getTypes(aggregateClass); TypeLiteral<?> genericInterface = TypeLiteral.get(newParameterizedType(Repository.class, generics)); allGenerics.put(generics, resolveDefaultQualifier( bindings, application.getConfiguration(aggregateClass), DEFAULT_REPOSITORY_KEY, aggregateClass, genericInterface ).orElse(null) ); } for (Class<? extends Repository> defaultRepoImpl : defaultRepositoryImplementations) { bindingStrategies.add(new GenericBindingStrategy<>( Repository.class, defaultRepoImpl, allGenerics) ); } return bindingStrategies; }
DefaultRepositoryCollector { Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) { Collection<BindingStrategy> bindingStrategies = new ArrayList<>(); Map<Type[], Key<?>> allGenerics = new HashMap<>(); for (Class<? extends AggregateRoot<?>> aggregateClass : BusinessUtils.includeSuperClasses(aggregateClasses)) { Type[] generics = getTypes(aggregateClass); TypeLiteral<?> genericInterface = TypeLiteral.get(newParameterizedType(Repository.class, generics)); allGenerics.put(generics, resolveDefaultQualifier( bindings, application.getConfiguration(aggregateClass), DEFAULT_REPOSITORY_KEY, aggregateClass, genericInterface ).orElse(null) ); } for (Class<? extends Repository> defaultRepoImpl : defaultRepositoryImplementations) { bindingStrategies.add(new GenericBindingStrategy<>( Repository.class, defaultRepoImpl, allGenerics) ); } return bindingStrategies; } }
DefaultRepositoryCollector { Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) { Collection<BindingStrategy> bindingStrategies = new ArrayList<>(); Map<Type[], Key<?>> allGenerics = new HashMap<>(); for (Class<? extends AggregateRoot<?>> aggregateClass : BusinessUtils.includeSuperClasses(aggregateClasses)) { Type[] generics = getTypes(aggregateClass); TypeLiteral<?> genericInterface = TypeLiteral.get(newParameterizedType(Repository.class, generics)); allGenerics.put(generics, resolveDefaultQualifier( bindings, application.getConfiguration(aggregateClass), DEFAULT_REPOSITORY_KEY, aggregateClass, genericInterface ).orElse(null) ); } for (Class<? extends Repository> defaultRepoImpl : defaultRepositoryImplementations) { bindingStrategies.add(new GenericBindingStrategy<>( Repository.class, defaultRepoImpl, allGenerics) ); } return bindingStrategies; } DefaultRepositoryCollector(Application application,
            Map<Key<?>, Class<?>> bindings,
            Collection<Class<? extends Repository>> defaultRepositoryImplementations); }
DefaultRepositoryCollector { Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) { Collection<BindingStrategy> bindingStrategies = new ArrayList<>(); Map<Type[], Key<?>> allGenerics = new HashMap<>(); for (Class<? extends AggregateRoot<?>> aggregateClass : BusinessUtils.includeSuperClasses(aggregateClasses)) { Type[] generics = getTypes(aggregateClass); TypeLiteral<?> genericInterface = TypeLiteral.get(newParameterizedType(Repository.class, generics)); allGenerics.put(generics, resolveDefaultQualifier( bindings, application.getConfiguration(aggregateClass), DEFAULT_REPOSITORY_KEY, aggregateClass, genericInterface ).orElse(null) ); } for (Class<? extends Repository> defaultRepoImpl : defaultRepositoryImplementations) { bindingStrategies.add(new GenericBindingStrategy<>( Repository.class, defaultRepoImpl, allGenerics) ); } return bindingStrategies; } DefaultRepositoryCollector(Application application,
            Map<Key<?>, Class<?>> bindings,
            Collection<Class<? extends Repository>> defaultRepositoryImplementations);  }
DefaultRepositoryCollector { Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) { Collection<BindingStrategy> bindingStrategies = new ArrayList<>(); Map<Type[], Key<?>> allGenerics = new HashMap<>(); for (Class<? extends AggregateRoot<?>> aggregateClass : BusinessUtils.includeSuperClasses(aggregateClasses)) { Type[] generics = getTypes(aggregateClass); TypeLiteral<?> genericInterface = TypeLiteral.get(newParameterizedType(Repository.class, generics)); allGenerics.put(generics, resolveDefaultQualifier( bindings, application.getConfiguration(aggregateClass), DEFAULT_REPOSITORY_KEY, aggregateClass, genericInterface ).orElse(null) ); } for (Class<? extends Repository> defaultRepoImpl : defaultRepositoryImplementations) { bindingStrategies.add(new GenericBindingStrategy<>( Repository.class, defaultRepoImpl, allGenerics) ); } return bindingStrategies; } DefaultRepositoryCollector(Application application,
            Map<Key<?>, Class<?>> bindings,
            Collection<Class<? extends Repository>> defaultRepositoryImplementations);   }