Source:
<code>private void postProcessGateway(BeanDefinitionBuilder builder, Element element) { for (String attributeName : referenceAttributes) { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, attributeName); } BeanDefinitionBuilder methodMetadataBuilder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.integration.gateway.GatewayMethodMetadata"); List<Element> invocationHeaders = DomUtils.getChildElementsByTagName(element, "default-header"); if (!CollectionUtils.isEmpty(invocationHeaders)) { this.setMethodInvocationHeaders(methodMetadataBuilder, invocationHeaders); } IntegrationNamespaceUtils.setValueIfAttributeDefined(methodMetadataBuilder, element, "default-payload-expression", "payloadExpression"); <START> builder.addPropertyValue("globalMethodMetadata", methodMetadataBuilder.getBeanDefinition()); <END> List<Element> elements = DomUtils.getChildElementsByTagName(element, "method"); ManagedMap<String, BeanDefinition> methodMetadataMap = null; if (elements != null && elements.size() > 0) { methodMetadataMap = new ManagedMap<String, BeanDefinition>(); } for (Element methodElement : elements) { String methodName = methodElement.getAttribute("name"); methodMetadataBuilder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.integration.gateway.GatewayMethodMetadata"); methodMetadataBuilder.addPropertyValue("requestChannelName", methodElement.getAttribute("request-channel")); methodMetadataBuilder.addPropertyValue("replyChannelName", methodElement.getAttribute("reply-channel")); methodMetadataBuilder.addPropertyValue("requestTimeout", methodElement.getAttribute("request-timeout")); methodMetadataBuilder.addPropertyValue("replyTimeout", methodElement.getAttribute("reply-timeout")); IntegrationNamespaceUtils.setValueIfAttributeDefined(methodMetadataBuilder, methodElement, "payload-expression"); invocationHeaders = DomUtils.getChildElementsByTagName(methodElement, "header"); if (!CollectionUtils.isEmpty(invocationHeaders)) { this.setMethodInvocationHeaders(methodMetadataBuilder, invocationHeaders); } methodMetadataMap.put(methodName, methodMetadataBuilder.getBeanDefinition()); } builder.addPropertyValue("methodMetadataMap", methodMetadataMap); }</code><technical_language>Right. a if</technical_language>

Target:
private void postProcessGateway(BeanDefinitionBuilder builder, Element element) { for (String attributeName : referenceAttributes) { IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, attributeName); } List<Element> invocationHeaders = DomUtils.getChildElementsByTagName(element, "default-header"); if (!CollectionUtils.isEmpty(invocationHeaders) || StringUtils.hasText(element.getAttribute("default-payload-expression"))) { BeanDefinitionBuilder methodMetadataBuilder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.integration.gateway.GatewayMethodMetadata"); this.setMethodInvocationHeaders(methodMetadataBuilder, invocationHeaders); IntegrationNamespaceUtils.setValueIfAttributeDefined(methodMetadataBuilder, element, "default-payload-expression", "payloadExpression"); builder.addPropertyValue("globalMethodMetadata", methodMetadataBuilder.getBeanDefinition()); } List<Element> elements = DomUtils.getChildElementsByTagName(element, "method"); ManagedMap<String, BeanDefinition> methodMetadataMap = null; if (elements != null && elements.size() > 0) { methodMetadataMap = new ManagedMap<String, BeanDefinition>(); } for (Element methodElement : elements) { String methodName = methodElement.getAttribute("name"); BeanDefinitionBuilder methodMetadataBuilder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.integration.gateway.GatewayMethodMetadata"); methodMetadataBuilder.addPropertyValue("requestChannelName", methodElement.getAttribute("request-channel")); methodMetadataBuilder.addPropertyValue("replyChannelName", methodElement.getAttribute("reply-channel")); methodMetadataBuilder.addPropertyValue("requestTimeout", methodElement.getAttribute("request-timeout")); methodMetadataBuilder.addPropertyValue("replyTimeout", methodElement.getAttribute("reply-timeout")); IntegrationNamespaceUtils.setValueIfAttributeDefined(methodMetadataBuilder, methodElement, "payload-expression"); invocationHeaders = DomUtils.getChildElementsByTagName(methodElement, "header"); if (!CollectionUtils.isEmpty(invocationHeaders)) { this.setMethodInvocationHeaders(methodMetadataBuilder, invocationHeaders); } methodMetadataMap.put(methodName, methodMetadataBuilder.getBeanDefinition()); } builder.addPropertyValue("methodMetadataMap", methodMetadataMap); }