class XmlRootElementPayloadMethodProcessor extends AbstractJaxb2PayloadMethodProcessor {

	@Override
	public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws JAXBException {
		Class<?> parameterType = parameter.getParameterType();

		if (parameterType.isAnnotationPresent(XmlRootElement.class)) {
			return unmarshalFromRequestPayload(messageContext, parameterType);
		} else {
			JAXBElement<?> element = unmarshalElementFromRequestPayload(messageContext, parameterType);
			return element != null ? element.getValue() : null;
		}
	}

}