protected void mapToProperty(MutableBeanMetadata bean, String propertyName, String val, ParserContext context) { if ("id".equals(propertyName)) { return; } if (!StringUtils.isEmpty(val)) { if (val.startsWith("#")) { bean.addProperty(propertyName, createRef(context, val.substring(1))); } else { bean.addProperty(propertyName, createValue(context, val)); } } }
protected void processBusAttribute(Element element, ParserContext ctx, MutableBeanMetadata bean, String val) { if (this.hasBusProperty()) { bean.addProperty("bus", getBusRef(ctx, val)); } else { bean.addArgument(getBusRef(ctx, val), null, 0); } }
protected boolean parseAttributes(Element element, ParserContext ctx, MutableBeanMetadata bean) { NamedNodeMap atts = element.getAttributes(); boolean setBus = false; for (int i = 0; i < atts.getLength(); i++) { Attr node = (Attr) atts.item(i); String val = node.getValue(); String pre = node.getPrefix(); String name = node.getLocalName(); String prefix = node.getPrefix(); // Don't process namespaces if (isNamespace(name, prefix)) { continue; } if ("createdFromAPI".equals(name) || "abstract".equals(name)) { bean.setScope(BeanMetadata.SCOPE_PROTOTYPE); } else { if ("depends-on".equals(name)) { bean.addDependsOn(val); } else if ("name".equals(name)) { processNameAttribute(element, ctx, bean, val); } else if ("bus".equals(name)) { processBusAttribute(element, ctx, bean, val); } else if (!"id".equals(name) && isAttribute(pre, name)) { mapAttribute(bean, element, name, val, ctx); } } } return setBus; } protected void processBusAttribute(Element element, ParserContext ctx,
factory.setFactoryComponent(createPassThrough(ctx, new JAXBBeanFactory(getContext(c), c))); factory.setFactoryMethod("createJAXBBean"); factory.addArgument(createValue(ctx, writer.toString()), String.class.getName(), 0); bean.addProperty(propertyName, factory); Unmarshaller u = getContext(c).createUnmarshaller(); Object obj; if (c != null) {
public Metadata createValue(ParserContext context, QName qName) { MutableBeanMetadata v = context.createMetadata(MutableBeanMetadata.class); v.setRuntimeClass(QName.class); v.addArgument(createValue(context, qName.getNamespaceURI()), null, 0); v.addArgument(createValue(context, qName.getLocalPart()), null, 1); return v; }
protected void setFirstChildAsProperty(Element element, ParserContext ctx, MutableBeanMetadata bean, String propertyName) { Element first = DOMUtils.getFirstElement(element); if (first == null) { throw new IllegalStateException(propertyName + " property must have child elements!"); } String id; if (first.getNamespaceURI().equals(XMLNS_BLUEPRINT)) { String name = first.getLocalName(); if ("ref".equals(name)) { id = first.getAttribute(COMPONENT_ID); if (id == null) { throw new IllegalStateException("<ref> elements must have a \"component-id\" attribute!"); } bean.addProperty(propertyName, createRef(ctx, id)); } else { //Rely on BP to handle these ones. bean.addProperty(propertyName, ctx.parseElement(Metadata.class, bean, first)); } } else { bean.addProperty(propertyName, ctx.parseElement(Metadata.class, bean, first)); } }
protected boolean parseAttributes(Element element, ParserContext ctx, MutableBeanMetadata bean) { NamedNodeMap atts = element.getAttributes(); boolean setBus = false; for (int i = 0; i < atts.getLength(); i++) { Attr node = (Attr) atts.item(i); String val = node.getValue(); String pre = node.getPrefix(); String name = node.getLocalName(); String prefix = node.getPrefix(); // Don't process namespaces if (isNamespace(name, prefix)) { continue; } if ("createdFromAPI".equals(name) || "abstract".equals(name)) { bean.setScope(BeanMetadata.SCOPE_PROTOTYPE); } else { if ("depends-on".equals(name)) { bean.addDependsOn(val); } else if ("name".equals(name)) { processNameAttribute(element, ctx, bean, val); } else if ("bus".equals(name)) { processBusAttribute(element, ctx, bean, val); } else if (!"id".equals(name) && isAttribute(pre, name)) { mapAttribute(bean, element, name, val, ctx); } } } return setBus; } protected void processBusAttribute(Element element, ParserContext ctx,
factory.setFactoryComponent(createPassThrough(ctx, new JAXBBeanFactory(getContext(c), c))); factory.setFactoryMethod("createJAXBBean"); factory.addArgument(createValue(ctx, writer.toString()), String.class.getName(), 0); bean.addProperty(propertyName, factory); Unmarshaller u = getContext(c).createUnmarshaller(); Object obj; if (c != null) {
public Metadata createValue(ParserContext context, QName qName) { MutableBeanMetadata v = context.createMetadata(MutableBeanMetadata.class); v.setRuntimeClass(QName.class); v.addArgument(createValue(context, qName.getNamespaceURI()), null, 0); v.addArgument(createValue(context, qName.getLocalPart()), null, 1); return v; }
protected void setFirstChildAsProperty(Element element, ParserContext ctx, MutableBeanMetadata bean, String propertyName) { Element first = DOMUtils.getFirstElement(element); if (first == null) { throw new IllegalStateException(propertyName + " property must have child elements!"); } String id; if (first.getNamespaceURI().equals(XMLNS_BLUEPRINT)) { String name = first.getLocalName(); if ("ref".equals(name)) { id = first.getAttribute(COMPONENT_ID); if (id == null) { throw new IllegalStateException("<ref> elements must have a \"component-id\" attribute!"); } bean.addProperty(propertyName, createRef(ctx, id)); } else { //Rely on BP to handle these ones. bean.addProperty(propertyName, ctx.parseElement(Metadata.class, bean, first)); } } else { bean.addProperty(propertyName, ctx.parseElement(Metadata.class, bean, first)); } }
protected boolean parseAttributes(Element element, ParserContext ctx, MutableBeanMetadata bean) { NamedNodeMap atts = element.getAttributes(); boolean setBus = false; for (int i = 0; i < atts.getLength(); i++) { Attr node = (Attr) atts.item(i); String val = node.getValue(); String pre = node.getPrefix(); String name = node.getLocalName(); String prefix = node.getPrefix(); // Don't process namespaces if (isNamespace(name, prefix)) { continue; } if ("createdFromAPI".equals(name) || "abstract".equals(name)) { bean.setScope(BeanMetadata.SCOPE_PROTOTYPE); } else { if ("depends-on".equals(name)) { bean.addDependsOn(val); } else if ("name".equals(name)) { processNameAttribute(element, ctx, bean, val); } else if ("bus".equals(name)) { processBusAttribute(element, ctx, bean, val); } else if (!"id".equals(name) && isAttribute(pre, name)) { mapAttribute(bean, element, name, val, ctx); } } } return setBus; } protected void processBusAttribute(Element element, ParserContext ctx,
factory.setFactoryComponent(createPassThrough(ctx, new JAXBBeanFactory(getContext(c), c))); factory.setFactoryMethod("createJAXBBean"); factory.addArgument(createValue(ctx, writer.toString()), String.class.getName(), 0); bean.addProperty(propertyName, factory); u = getContext(c).createUnmarshaller(); u.setEventHandler(null); Object obj;
protected void mapToProperty(MutableBeanMetadata bean, String propertyName, String val, ParserContext context) { if ("id".equals(propertyName)) { return; } if (!StringUtils.isEmpty(val)) { if (val.startsWith("#")) { bean.addProperty(propertyName, createRef(context, val.substring(1))); } else { bean.addProperty(propertyName, createValue(context, val)); } } }
protected void processBusAttribute(Element element, ParserContext ctx, MutableBeanMetadata bean, String val) { if (this.hasBusProperty()) { bean.addProperty("bus", getBusRef(ctx, val)); } else { bean.addArgument(getBusRef(ctx, val), null, 0); } }
public Metadata createValue(ParserContext context, QName qName) { MutableBeanMetadata v = context.createMetadata(MutableBeanMetadata.class); v.setRuntimeClass(QName.class); v.addArgument(createValue(context, qName.getNamespaceURI()), null, 0); v.addArgument(createValue(context, qName.getLocalPart()), null, 1); return v; }
protected void setFirstChildAsProperty(Element element, ParserContext ctx, MutableBeanMetadata bean, String propertyName) { Element first = DOMUtils.getFirstElement(element); if (first == null) { throw new IllegalStateException(propertyName + " property must have child elements!"); } String id; if (first.getNamespaceURI().equals(XMLNS_BLUEPRINT)) { String name = first.getLocalName(); if ("ref".equals(name)) { id = first.getAttribute(COMPONENT_ID); if (id == null) { throw new IllegalStateException("<ref> elements must have a \"component-id\" attribute!"); } bean.addProperty(propertyName, createRef(ctx, id)); } else { //Rely on BP to handle these ones. bean.addProperty(propertyName, ctx.parseElement(Metadata.class, bean, first)); } } else { bean.addProperty(propertyName, ctx.parseElement(Metadata.class, bean, first)); } }
protected boolean parseAttributes(Element element, ParserContext ctx, MutableBeanMetadata bean) { NamedNodeMap atts = element.getAttributes(); boolean setBus = false; for (int i = 0; i < atts.getLength(); i++) { Attr node = (Attr) atts.item(i); String val = node.getValue(); String pre = node.getPrefix(); String name = node.getLocalName(); String prefix = node.getPrefix(); // Don't process namespaces if (isNamespace(name, prefix)) { continue; } if ("createdFromAPI".equals(name) || "abstract".equals(name)) { bean.setScope(BeanMetadata.SCOPE_PROTOTYPE); } else { if ("depends-on".equals(name)) { bean.addDependsOn(val); } else if ("name".equals(name)) { processNameAttribute(element, ctx, bean, val); } else if ("bus".equals(name)) { processBusAttribute(element, ctx, bean, val); } else if (!"id".equals(name) && isAttribute(pre, name)) { mapAttribute(bean, element, name, val, ctx); } } } return setBus; } protected void processBusAttribute(Element element, ParserContext ctx,
factory.setFactoryComponent(createPassThrough(ctx, new JAXBBeanFactory(getContext(c), c))); factory.setFactoryMethod("createJAXBBean"); factory.addArgument(createValue(ctx, writer.toString()), String.class.getName(), 0); bean.addProperty(propertyName, factory); u = getContext(c).createUnmarshaller(); u.setEventHandler(null); Object obj;