diff --git a/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java b/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java index 02d415a..5860db5 100644 --- a/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java +++ b/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/IntegrationFlows.java @@ -32,7 +32,7 @@ public final class IntegrationFlows { /** * @param messageChannelName the name of existing {@link org.springframework.messaging.MessageChannel} bean. * The new {@link org.springframework.integration.channel.DirectChannel} bean will be - * created on context startup, if there is on bean with this name. + * created on context startup, if there is no bean with this name. * @return new {@link IntegrationFlowBuilder} */ public static IntegrationFlowBuilder from(String messageChannelName) { diff --git a/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/channel/MessageChannelSpec.java b/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/channel/MessageChannelSpec.java index 1ee32bc..639d632 100644 --- a/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/channel/MessageChannelSpec.java +++ b/spring-integration-java-dsl/src/main/java/org/springframework/integration/dsl/channel/MessageChannelSpec.java @@ -16,11 +16,15 @@ package org.springframework.integration.dsl.channel; +import java.util.ArrayList; import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; import org.springframework.integration.channel.AbstractMessageChannel; import org.springframework.integration.dsl.core.IntegrationComponentSpec; import org.springframework.messaging.support.ChannelInterceptor; +import org.springframework.util.Assert; /** * @author Artem Bilan @@ -29,32 +33,32 @@ public abstract class MessageChannelSpec, C e protected C channel; - private Class[] datatypes; + private final List> datatypes = new ArrayList>(); - private ChannelInterceptor[] interceptors; + private final List interceptors = new LinkedList(); @Override protected S id(String id) { return super.id(id); } - public S datatypes(Class... datatypes) { - this.datatypes = datatypes; + public S datatype(Class... datatypes) { + Assert.noNullElements(datatypes); + this.datatypes.addAll(Arrays.asList(datatypes)); return _this(); } - public S interceptors(ChannelInterceptor... interceptors) { - this.interceptors = interceptors; + public S interceptor(ChannelInterceptor... interceptors) { + Assert.noNullElements(interceptors); + this.interceptors.addAll(Arrays.asList(interceptors)); return _this(); } @Override protected C doGet() { - this.channel.setDatatypes(this.datatypes); + this.channel.setDatatypes(this.datatypes.toArray(new Class[this.datatypes.size()])); this.channel.setBeanName(this.id); - if (this.interceptors != null) { - this.channel.setInterceptors(Arrays.asList(this.interceptors)); - } + this.channel.setInterceptors(this.interceptors); return this.channel; }