private ComponentMetadata decorateProxyMethod(Node node, ComponentMetadata component, ParserContext context) { if (!(component instanceof ServiceReferenceMetadata)) { throw new ComponentDefinitionException("Attribute " + node.getNodeName() + " can only be used on a <reference> or <reference-list> element"); } if (!(component instanceof MutableServiceReferenceMetadata)) { throw new ComponentDefinitionException("Expected an instance of MutableServiceReferenceMetadata"); } int method = 0; String value = ((Attr) node).getValue(); String[] flags = value.trim().split(" "); for (String flag : flags) { if (PROXY_METHOD_DEFAULT.equals(flag)) { method += ExtendedReferenceListMetadata.PROXY_METHOD_DEFAULT; } else if (PROXY_METHOD_CLASSES.equals(flag)) { method += ExtendedReferenceListMetadata.PROXY_METHOD_CLASSES; } else if (PROXY_METHOD_GREEDY.equals(flag)) { method += ExtendedReferenceListMetadata.PROXY_METHOD_GREEDY; } else { throw new ComponentDefinitionException("Unknown proxy method: " + flag); } } if ((method & ExtendedReferenceListMetadata.PROXY_METHOD_GREEDY) != 0 && !(component instanceof ReferenceListMetadata)) { throw new ComponentDefinitionException("Greedy proxying is only available for <reference-list> element"); } ((MutableServiceReferenceMetadata) component).setProxyMethod(method); return component; }
private ComponentMetadata decorateProxyMethod(Node node, ComponentMetadata component, ParserContext context) { if (!(component instanceof ServiceReferenceMetadata)) { throw new ComponentDefinitionException("Attribute " + node.getNodeName() + " can only be used on a <reference> or <reference-list> element"); } if (!(component instanceof MutableServiceReferenceMetadata)) { throw new ComponentDefinitionException("Expected an instance of MutableServiceReferenceMetadata"); } int method = 0; String value = ((Attr) node).getValue(); String[] flags = value.trim().split(" "); for (String flag : flags) { if (PROXY_METHOD_DEFAULT.equals(flag)) { method += ExtendedReferenceListMetadata.PROXY_METHOD_DEFAULT; } else if (PROXY_METHOD_CLASSES.equals(flag)) { method += ExtendedReferenceListMetadata.PROXY_METHOD_CLASSES; } else if (PROXY_METHOD_GREEDY.equals(flag)) { method += ExtendedReferenceListMetadata.PROXY_METHOD_GREEDY; } else { throw new ComponentDefinitionException("Unknown proxy method: " + flag); } } if ((method & ExtendedReferenceListMetadata.PROXY_METHOD_GREEDY) != 0 && !(component instanceof ReferenceListMetadata)) { throw new ComponentDefinitionException("Greedy proxying is only available for <reference-list> element"); } ((MutableServiceReferenceMetadata) component).setProxyMethod(method); return component; }