@Test public void testCollectIllegalArgument() { Collection<BindingStrategy> strategies = underTest.collect(Lists.newArrayList(Dto4.class)); Assertions.assertThat(strategies) .isNotNull(); Assertions.assertThat(strategies) .isEmpty(); }
Collection<BindingStrategy> collect(Collection<Class<?>> dtoClasses) { Map<Type[], Key<?>> autoAssemblerGenerics = new HashMap<>(); Map<Type[], Key<?>> autoTupleAssemblerGenerics = new HashMap<>(); for (Class<?> dtoClass : dtoClasses) { DtoOf dtoOf = dtoClass.getAnnotation(DtoOf.class); if (dtoOf != null) { if (dtoOf.value().length == 1) { Type[] params = new Type[]{dtoOf.value()[0], dtoClass}; autoAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } else if (dtoOf.value().length > 1) { Type[] params = {Tuples.typeOfTuple(dtoOf.value()), dtoClass}; autoTupleAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } } } Collection<BindingStrategy> bs = new ArrayList<>(); for (Class<? extends Assembler> defaultAssemblersClass : defaultAssemblersClasses) { Class<?> aggregateType = TypeToken.of(defaultAssemblersClass) .resolveType(defaultAssemblersClass.getTypeParameters()[0]) .getRawType(); if (aggregateType.isAssignableFrom(Tuple.class) && !autoTupleAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoTupleAssemblerGenerics)); } else if (!aggregateType.isAssignableFrom(Tuple.class) && !autoAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoAssemblerGenerics)); } } return bs; }
DefaultAssemblerCollector { Collection<BindingStrategy> collect(Collection<Class<?>> dtoClasses) { Map<Type[], Key<?>> autoAssemblerGenerics = new HashMap<>(); Map<Type[], Key<?>> autoTupleAssemblerGenerics = new HashMap<>(); for (Class<?> dtoClass : dtoClasses) { DtoOf dtoOf = dtoClass.getAnnotation(DtoOf.class); if (dtoOf != null) { if (dtoOf.value().length == 1) { Type[] params = new Type[]{dtoOf.value()[0], dtoClass}; autoAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } else if (dtoOf.value().length > 1) { Type[] params = {Tuples.typeOfTuple(dtoOf.value()), dtoClass}; autoTupleAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } } } Collection<BindingStrategy> bs = new ArrayList<>(); for (Class<? extends Assembler> defaultAssemblersClass : defaultAssemblersClasses) { Class<?> aggregateType = TypeToken.of(defaultAssemblersClass) .resolveType(defaultAssemblersClass.getTypeParameters()[0]) .getRawType(); if (aggregateType.isAssignableFrom(Tuple.class) && !autoTupleAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoTupleAssemblerGenerics)); } else if (!aggregateType.isAssignableFrom(Tuple.class) && !autoAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoAssemblerGenerics)); } } return bs; } }
DefaultAssemblerCollector { Collection<BindingStrategy> collect(Collection<Class<?>> dtoClasses) { Map<Type[], Key<?>> autoAssemblerGenerics = new HashMap<>(); Map<Type[], Key<?>> autoTupleAssemblerGenerics = new HashMap<>(); for (Class<?> dtoClass : dtoClasses) { DtoOf dtoOf = dtoClass.getAnnotation(DtoOf.class); if (dtoOf != null) { if (dtoOf.value().length == 1) { Type[] params = new Type[]{dtoOf.value()[0], dtoClass}; autoAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } else if (dtoOf.value().length > 1) { Type[] params = {Tuples.typeOfTuple(dtoOf.value()), dtoClass}; autoTupleAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } } } Collection<BindingStrategy> bs = new ArrayList<>(); for (Class<? extends Assembler> defaultAssemblersClass : defaultAssemblersClasses) { Class<?> aggregateType = TypeToken.of(defaultAssemblersClass) .resolveType(defaultAssemblersClass.getTypeParameters()[0]) .getRawType(); if (aggregateType.isAssignableFrom(Tuple.class) && !autoTupleAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoTupleAssemblerGenerics)); } else if (!aggregateType.isAssignableFrom(Tuple.class) && !autoAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoAssemblerGenerics)); } } return bs; } DefaultAssemblerCollector(Application application, Map<Key<?>, Class<?>> bindings,
            Collection<Class<? extends Assembler>> defaultAssemblersClasses); }
DefaultAssemblerCollector { Collection<BindingStrategy> collect(Collection<Class<?>> dtoClasses) { Map<Type[], Key<?>> autoAssemblerGenerics = new HashMap<>(); Map<Type[], Key<?>> autoTupleAssemblerGenerics = new HashMap<>(); for (Class<?> dtoClass : dtoClasses) { DtoOf dtoOf = dtoClass.getAnnotation(DtoOf.class); if (dtoOf != null) { if (dtoOf.value().length == 1) { Type[] params = new Type[]{dtoOf.value()[0], dtoClass}; autoAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } else if (dtoOf.value().length > 1) { Type[] params = {Tuples.typeOfTuple(dtoOf.value()), dtoClass}; autoTupleAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } } } Collection<BindingStrategy> bs = new ArrayList<>(); for (Class<? extends Assembler> defaultAssemblersClass : defaultAssemblersClasses) { Class<?> aggregateType = TypeToken.of(defaultAssemblersClass) .resolveType(defaultAssemblersClass.getTypeParameters()[0]) .getRawType(); if (aggregateType.isAssignableFrom(Tuple.class) && !autoTupleAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoTupleAssemblerGenerics)); } else if (!aggregateType.isAssignableFrom(Tuple.class) && !autoAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoAssemblerGenerics)); } } return bs; } DefaultAssemblerCollector(Application application, Map<Key<?>, Class<?>> bindings,
            Collection<Class<? extends Assembler>> defaultAssemblersClasses);  }
DefaultAssemblerCollector { Collection<BindingStrategy> collect(Collection<Class<?>> dtoClasses) { Map<Type[], Key<?>> autoAssemblerGenerics = new HashMap<>(); Map<Type[], Key<?>> autoTupleAssemblerGenerics = new HashMap<>(); for (Class<?> dtoClass : dtoClasses) { DtoOf dtoOf = dtoClass.getAnnotation(DtoOf.class); if (dtoOf != null) { if (dtoOf.value().length == 1) { Type[] params = new Type[]{dtoOf.value()[0], dtoClass}; autoAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } else if (dtoOf.value().length > 1) { Type[] params = {Tuples.typeOfTuple(dtoOf.value()), dtoClass}; autoTupleAssemblerGenerics.put(params, BusinessUtils.resolveDefaultQualifier( bindings, application.getConfiguration(dtoClass), DEFAULT_ASSEMBLER_KEY, dtoClass, TypeLiteral.get(Types.newParameterizedType(Assembler.class, params)) ).orElse(null)); } } } Collection<BindingStrategy> bs = new ArrayList<>(); for (Class<? extends Assembler> defaultAssemblersClass : defaultAssemblersClasses) { Class<?> aggregateType = TypeToken.of(defaultAssemblersClass) .resolveType(defaultAssemblersClass.getTypeParameters()[0]) .getRawType(); if (aggregateType.isAssignableFrom(Tuple.class) && !autoTupleAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoTupleAssemblerGenerics)); } else if (!aggregateType.isAssignableFrom(Tuple.class) && !autoAssemblerGenerics.isEmpty()) { bs.add(new GenericBindingStrategy<>(Assembler.class, defaultAssemblersClass, autoAssemblerGenerics)); } } return bs; } DefaultAssemblerCollector(Application application, Map<Key<?>, Class<?>> bindings,
            Collection<Class<? extends Assembler>> defaultAssemblersClasses);   }