class SoapHeaderElementMethodArgumentResolver implements MethodArgumentResolver {

	@Override
	public boolean supportsParameter(MethodParameter parameter) {
		SoapHeader soapHeader = parameter.getParameterAnnotation(SoapHeader.class);
		if (soapHeader == null) {
			return false;
		}

		Class<?> parameterType = parameter.getParameterType();

		// Simple SoapHeaderElement parameter
		if (SoapHeaderElement.class.equals(parameterType)) {
			return true;
		}

		// List<SoapHeaderElement> parameter
		if (List.class.equals(parameterType)) {
			Type genericType = parameter.getGenericParameterType();
			if (genericType instanceof ParameterizedType) {
				ParameterizedType parameterizedType = (ParameterizedType) genericType;
				Type[] typeArguments = parameterizedType.getActualTypeArguments();
				if (typeArguments.length == 1 && SoapHeaderElement.class.equals(typeArguments[0])) {
					return true;
				}
			}
		}
		return false;
	}

}