class StaxPayloadMethodArgumentResolver extends TransformerObjectSupport implements MethodArgumentResolver {

	@Override
	public Object resolveArgument(MessageContext messageContext, MethodParameter parameter)
			throws TransformerException, XMLStreamException {
		Source source = messageContext.getRequest().getPayloadSource();
		if (source == null) {
			return null;
		}
		Class<?> parameterType = parameter.getParameterType();
		if (XMLStreamReader.class.equals(parameterType)) {
			return resolveStreamReader(source);
		} else if (XMLEventReader.class.equals(parameterType)) {
			return resolveEventReader(source);
		}
		throw new UnsupportedOperationException();
	}

}