INT-3218 Spring 4 Compatibility

Use `Arrays.asList()` instead of `Collections.arrayToList()` in
places where a generic type needs to be supplied by the caller.

This maintains compile-time compatibility with both Spring 3 and 4,
where Spring 4 added the generic type to the utility class.

The four occurrences where this was needed are not impacted
by the fact that `Arrays.asList()` returns an unmodifiable list.
This commit is contained in:
Gary Russell
2013-11-26 17:30:12 -05:00
parent a08b033b7c
commit 5f555e31b3
4 changed files with 20 additions and 15 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.integration.event.inbound;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -31,7 +32,6 @@ import org.springframework.integration.Message;
import org.springframework.integration.endpoint.ExpressionMessageProducerSupport;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
/**
* An inbound Channel Adapter that implements {@link ApplicationListener} and
@@ -69,9 +69,9 @@ public class ApplicationEventListeningMessageProducer extends ExpressionMessageP
* @see ApplicationEventMulticaster#addApplicationListener
* @see #supportsEventType
*/
@SuppressWarnings("unchecked")
public void setEventTypes(Class<? extends ApplicationEvent>... eventTypes) {
Set<Class<? extends ApplicationEvent>> eventSet = new HashSet<Class<? extends ApplicationEvent>>(CollectionUtils.arrayToList(eventTypes));
Set<Class<? extends ApplicationEvent>> eventSet = new HashSet<Class<? extends ApplicationEvent>>(
Arrays.asList(eventTypes));
eventSet.remove(null);
this.eventTypes = (eventSet.size() > 0 ? eventSet : null);