List of usage examples for org.springframework.beans.factory.support BeanDefinitionBuilder setAbstract
public BeanDefinitionBuilder setAbstract(boolean flag)
From source file:org.solmix.runtime.support.spring.AbstractBeanDefinitionParser.java
/**?Element,?Container*/ protected boolean parseAttributes(Element element, ParserContext ctx, BeanDefinitionBuilder 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; }//from w w w . j a va 2 s.c o m if ("createdFromAPI".equals(name)) { bean.setAbstract(true); } else if ("abstract".equals(name)) { bean.setAbstract(true); } else if ("depends-on".equals(name)) { bean.addDependsOn(val); } else if ("name".equals(name)) { parseNameAttribute(element, ctx, bean, val); } else if ("container".equals(name)) { setBus = parseContainerAttribute(element, ctx, bean, val); } else if ("id".equals(name)) { parseIdAttribute(bean, element, name, val, ctx); } else if (isAttribute(pre, name)) { parseAttribute(bean, element, name, val, ctx); } } return setBus; }
From source file:org.kuali.rice.krad.datadictionary.parse.CustomSchemaParser.java
/** * Adds the property value to the bean definition based on the name and value of the attribute. * * @param name - The name of the attribute. * @param value - The value of the attribute. * @param entries - The property entries for the over all tag. * @param bean - The bean definition being created. *///from w ww.ja v a 2 s.c o m protected void processSingleValue(String name, String value, Map<String, BeanTagAttributeInfo> entries, BeanDefinitionBuilder bean) { if (name.toLowerCase().compareTo("parent") == 0) { // If attribute is defining the parent set it in the bean builder. bean.setParentName(value); } else if (name.toLowerCase().compareTo("abstract") == 0) { // If the attribute is defining the parent as abstract set it in the bean builder. bean.setAbstract(Boolean.valueOf(value)); } else if (name.toLowerCase().compareTo("id") == 0) { //nothing - insures that its erased } else { // If the attribute is not a reserved case find the property name form the connected map and add the new // property value. if (name.contains("-ref")) { bean.addPropertyValue(name.substring(0, name.length() - 4), new RuntimeBeanReference(value)); } else { BeanTagAttributeInfo info = entries.get(name); String propertyName; if (info == null) { propertyName = name; } else { propertyName = info.getName(); } bean.addPropertyValue(propertyName, value); } } }
From source file:org.metaeffekt.dcc.commons.spring.xml.DCCConfigurationBeanDefinitionParser.java
private void parseAndRegisterUnits(Element profileElement, File origin, BeanDefinitionRegistry registry, ParserContext parserContext) {//from w w w . j av a2 s . c om List<Element> unitElements = DomUtils.getChildElementsByTagName(profileElement, ELEMENT_UNIT); for (Element unitElement : unitElements) { // first retrieve all XML attributes of the Unit element String unitId = extractMandatoryIdAttributeFromElement(unitElement, "Unit", registry); // TODO: currently not used as there is nowhere to set this on a ConfigurationUnit @SuppressWarnings("unused") String unitType = unitElement.getAttribute(ATTRIBUTE_UNIT_TYPE); boolean unitIsAbstract = Boolean.valueOf(unitElement.getAttribute(ATTRIBUTE_UNIT_ABSTRACT)); String unitExtends = parseString(unitElement, ATTRIBUTE_UNIT_EXTENDS, null, registry); ManagedList<AbstractBeanDefinition> requiredCapabilityReferences = parseRequiredCapabilities( unitElement, unitId, registry); ManagedList<AbstractBeanDefinition> providedCapabilityReferences = parseProvidedCapabilities( unitElement, unitId, registry); ManagedList<Attribute> attributes = parseAttributesElement(unitElement, parserContext); ManagedList<AbstractBeanDefinition> mappings = parseMappingsElement(unitElement, unitId, registry); ManagedList<AbstractBeanDefinition> commands = parseCommands(unitElement, unitId, registry); ManagedList<AbstractBeanDefinition> asserts = parseAsserts(unitElement, registry); BeanDefinitionBuilder unitBeanDefBuilder = null; if (StringUtils.isNotBlank(unitExtends)) { unitBeanDefBuilder = BeanDefinitionBuilder.childBeanDefinition(unitExtends); unitBeanDefBuilder.getRawBeanDefinition().setBeanClass(ConfigurationUnit.class); requiredCapabilityReferences.setMergeEnabled(true); providedCapabilityReferences.setMergeEnabled(true); attributes.setMergeEnabled(true); mappings.setMergeEnabled(true); commands.setMergeEnabled(true); asserts.setMergeEnabled(true); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_PARENT_ID, unitExtends); } else { unitBeanDefBuilder = BeanDefinitionBuilder.rootBeanDefinition(ConfigurationUnit.class); } String description = extractDescription(unitElement, registry); unitBeanDefBuilder.setAbstract(false); unitBeanDefBuilder.addPropertyValue(PROPERTY_ORIGIN, origin); unitBeanDefBuilder.addPropertyValue(PROPERTY_DESCRIPTION, description); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_ABSTRACT, unitIsAbstract); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_PROVIDED_CAPABILITIES, providedCapabilityReferences); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_REQUIRED_CAPABILITIES, requiredCapabilityReferences); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_ATTRIBUTES, attributes); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_MAPPINGS, mappings); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_COMMANDS, commands); unitBeanDefBuilder.addPropertyValue(PROPERTY_UNIT_ASSERTS, asserts); unitBeanDefBuilder.addConstructorArgValue(unitId); RuntimeBeanReference unitBeanRef = new RuntimeBeanReference(unitId); unitBeanRef.setSource(parserContext.getReaderContext().extractSource(unitElement)); registry.registerBeanDefinition(unitId, unitBeanDefBuilder.getBeanDefinition()); } }
From source file:org.springframework.data.gemfire.config.AbstractRegionParser.java
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, builder); builder.setAbstract(isRegionTemplate(element)); doParseRegion(element, parserContext, builder, isSubRegion(element)); }
From source file:org.springframework.data.gemfire.config.xml.AbstractRegionParser.java
/** * {@inheritDoc}// w ww .j a v a 2 s . com */ @Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, builder); builder.setAbstract(isRegionTemplate(element)); doParseRegion(element, parserContext, builder, isSubRegion(element)); }