How about to make just it like this:
````java
public void setHeaderNames(String... headerNames) {
		this.headerNames = headerNames;
	}
````
In most cases it will be configured as `<bean>` and comma-delimited value for this property will be converted perfectly.
And further in the `toMessage` use `retainAll`:
````java
if (headers != null) {
	if (this.filterHeadersInToMessage) {
		headers.keySet().retainAll(Arrays.asList(this.headerNames));
	}
	messageBuilder.copyHeaders(headers);
}
````