当前位置: 首页>>代码示例>>Java>>正文


Java Conventions.attributeNameToPropertyName方法代码示例

本文整理汇总了Java中org.springframework.core.Conventions.attributeNameToPropertyName方法的典型用法代码示例。如果您正苦于以下问题:Java Conventions.attributeNameToPropertyName方法的具体用法?Java Conventions.attributeNameToPropertyName怎么用?Java Conventions.attributeNameToPropertyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.core.Conventions的用法示例。


在下文中一共展示了Conventions.attributeNameToPropertyName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseChildElements

import org.springframework.core.Conventions; //导入方法依赖的package包/类
private void parseChildElements(Element element, String parentId, String redissonRef, BeanDefinitionBuilder redissonDef, ParserContext parserContext) {
    if (element.hasChildNodes()) {
        CompositeComponentDefinition compositeDef
                = new CompositeComponentDefinition(parentId,
                        parserContext.extractSource(element));
        parserContext.pushContainingComponent(compositeDef);
        List<Element> childElts = DomUtils.getChildElements(element);
        for (Element elt : childElts) {
            if(BeanDefinitionParserDelegate
                    .QUALIFIER_ELEMENT.equals(elt.getLocalName())) {
                continue;//parsed elsewhere
            }
            String localName = parserContext.getDelegate().getLocalName(elt);
            localName = Conventions.attributeNameToPropertyName(localName);
            if (ConfigType.contains(localName)) {
                parseConfigTypes(elt, localName, redissonDef, parserContext);
            } else if (AddressType.contains(localName)) {
                parseAddressTypes(elt, localName, redissonDef, parserContext);
            } else if (helper.isRedissonNS(elt)) {
                elt.setAttribute(REDISSON_REF, redissonRef);
                parserContext.getDelegate().parseCustomElement(elt);
            }
        }
        parserContext.popContainingComponent();
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:27,代码来源:RedissonDefinitionParser.java

示例2: parseNested

import org.springframework.core.Conventions; //导入方法依赖的package包/类
@Override
protected void parseNested(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, BeanDefinition bd) {
    bd.setFactoryBeanName(element.getAttribute(
            RedissonNamespaceParserSupport.REDISSON_REF_ATTRIBUTE));
    String typeName
            = Conventions.attributeNameToPropertyName(element.getLocalName());
    bd.setFactoryMethodName("get" + StringUtils.capitalize(typeName));
    
    helper.addConstructorArgs(element, KEY_ATTRIBUTE,
            String.class, builder);
    helper.addConstructorArgs(element, TOPIC_ATTRIBUTE,
            String.class, builder);
    helper.addConstructorArgs(element, PATTERN_ATTRIBUTE,
            String.class, builder);
    helper.addConstructorArgs(element, SERVICE_ATTRIBUTE,
            String.class, builder);
    helper.addConstructorArgs(element, CODEC_REF_ATTRIBUTE,
            Codec.class, builder);
    if (RDestroyable.class.isAssignableFrom(getBeanClass(element))) {
        ((AbstractBeanDefinition) bd).setDestroyMethodName("destroy");
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:23,代码来源:RedissonGenericObjectDefinitionParser.java

示例3: parseAttributes

import org.springframework.core.Conventions; //导入方法依赖的package包/类
public void parseAttributes(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    NamedNodeMap attributes = element.getAttributes();
    for (int x = 0; x < attributes.getLength(); x++) {
        Attr attribute = (Attr) attributes.item(x);
        if (isEligibleAttribute(attribute)) {
            String propertyName
                    = attribute.getLocalName().endsWith(REF_SUFFIX)
                            ? attribute.getLocalName()
                                    .substring(0, attribute.getLocalName()
                                            .length() - REF_SUFFIX.length())
                            : attribute.getLocalName();
            propertyName = Conventions
                    .attributeNameToPropertyName(propertyName);
            Assert.state(StringUtils.hasText(propertyName),
                    "Illegal property name returned from"
                            + " 'extractPropertyName(String)': cannot be"
                            + " null or empty.");
            if (attribute.getLocalName().endsWith(REF_SUFFIX)) {
                builder.addPropertyReference(propertyName,
                        attribute.getValue());
            } else {
                builder.addPropertyValue(propertyName, attribute.getValue());
            }
        }
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:27,代码来源:RedissonNamespaceParserSupport.java

示例4: getBeanClassName

import org.springframework.core.Conventions; //导入方法依赖的package包/类
@Override
protected String getBeanClassName(Element element) {
    String elementName
            = Conventions.attributeNameToPropertyName(
                    element.getLocalName());
    return RedissonNamespaceParserSupport.IMPL_CLASS_PATH_PREFIX
            + StringUtils.capitalize(elementName);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:9,代码来源:RedissonMultiLockDefinitionParser.java

示例5: getBeanClass

import org.springframework.core.Conventions; //导入方法依赖的package包/类
@Override
protected Class<?> getBeanClass(Element element) {
    String elementName
            = Conventions.attributeNameToPropertyName(
                    element.getLocalName());
    try {
        return Class.forName(RedissonNamespaceParserSupport.API_CLASS_PATH_PREFIX
                + (StringUtils.capitalize(FAIL_LOCK.equals(elementName)
                        ? "lock"
                        : elementName)));
    } catch (ClassNotFoundException ex) {
        throw new IllegalArgumentException(ex);
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:15,代码来源:RedissonGenericObjectDefinitionParser.java

示例6: parseNested

import org.springframework.core.Conventions; //导入方法依赖的package包/类
@Override
protected void parseNested(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, BeanDefinition bd) {
    bd.setFactoryBeanName(element.getAttribute(
            RedissonNamespaceParserSupport.READ_WRITE_LOCK_REF_ATTRIBUTE));
    String typeName
            = Conventions.attributeNameToPropertyName(element.getLocalName());
    bd.setFactoryMethodName(typeName);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:9,代码来源:RedissonReadAndWriteLockDefinitionParser.java

示例7: getName

import org.springframework.core.Conventions; //导入方法依赖的package包/类
public String getName(Node node) {
    return Conventions.attributeNameToPropertyName(node.getLocalName());
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:4,代码来源:RedissonNamespaceParserSupport.java

示例8: process

import org.springframework.core.Conventions; //导入方法依赖的package包/类
public boolean process(Element parent, Attr attribute, BeanDefinitionBuilder builder) {
	String name = attribute.getLocalName();
	String propertyName = Conventions.attributeNameToPropertyName(name);
	builder.addPropertyValue(propertyName, attribute.getValue());
	return true;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:7,代码来源:ConventionsCallback.java

示例9: decorate

import org.springframework.core.Conventions; //导入方法依赖的package包/类
@Override
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
	if (node instanceof Attr) {
		Attr attr = (Attr) node;
		String argName = StringUtils.trimWhitespace(parserContext.getDelegate().getLocalName(attr));
		String argValue = StringUtils.trimWhitespace(attr.getValue());

		ConstructorArgumentValues cvs = definition.getBeanDefinition().getConstructorArgumentValues();
		boolean ref = false;

		// handle -ref arguments
		if (argName.endsWith(REF_SUFFIX)) {
			ref = true;
			argName = argName.substring(0, argName.length() - REF_SUFFIX.length());
		}

		ValueHolder valueHolder = new ValueHolder(ref ? new RuntimeBeanReference(argValue) : argValue);
		valueHolder.setSource(parserContext.getReaderContext().extractSource(attr));

		// handle "escaped"/"_" arguments
		if (argName.startsWith(DELIMITER_PREFIX)) {
			String arg = argName.substring(1).trim();

			// fast default check
			if (!StringUtils.hasText(arg)) {
				cvs.addGenericArgumentValue(valueHolder);
			}
			// assume an index otherwise
			else {
				int index = -1;
				try {
					index = Integer.parseInt(arg);
				} catch (NumberFormatException ex) {
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' specifies an invalid integer", attr);
				}
				if (index < 0) {
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' specifies a negative index", attr);
				}

				if (cvs.hasIndexedArgumentValue(index)){
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' with index "+ index+" already defined using <constructor-arg>." +
							" Only one approach may be used per argument.", attr);
				}

				cvs.addIndexedArgumentValue(index, valueHolder);
			}
		}
		// no escaping -> ctr name
		else {
			String name = Conventions.attributeNameToPropertyName(argName);
			if (containsArgWithName(name, cvs)){
				parserContext.getReaderContext().error(
						"Constructor argument '" + argName + "' already defined using <constructor-arg>." +
						" Only one approach may be used per argument.", attr);
			}
			valueHolder.setName(Conventions.attributeNameToPropertyName(argName));
			cvs.addGenericArgumentValue(valueHolder);
		}
	}
	return definition;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:65,代码来源:SimpleConstructorNamespaceHandler.java

示例10: decorate

import org.springframework.core.Conventions; //导入方法依赖的package包/类
@Override
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
	if (node instanceof Attr) {
		Attr attr = (Attr) node;
		String argName = StringUtils.trimWhitespace(parserContext.getDelegate().getLocalName(attr));
		String argValue = StringUtils.trimWhitespace(attr.getValue());

		ConstructorArgumentValues cvs = definition.getBeanDefinition().getConstructorArgumentValues();
		boolean ref = false;

		// handle -ref arguments
		if (argName.endsWith(REF_SUFFIX)) {
			ref = true;
			argName = argName.substring(0, argName.length() - REF_SUFFIX.length());
		}

		ValueHolder valueHolder = new ValueHolder(ref ? new RuntimeBeanReference(argValue) : argValue);
		valueHolder.setSource(parserContext.getReaderContext().extractSource(attr));

		// handle "escaped"/"_" arguments
		if (argName.startsWith(DELIMITER_PREFIX)) {
			String arg = argName.substring(1).trim();

			// fast default check
			if (!StringUtils.hasText(arg)) {
				cvs.addGenericArgumentValue(valueHolder);
			}
			// assume an index otherwise
			else {
				int index = -1;
				try {
					index = Integer.parseInt(arg);
				}
				catch (NumberFormatException ex) {
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' specifies an invalid integer", attr);
				}
				if (index < 0) {
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' specifies a negative index", attr);
				}

				if (cvs.hasIndexedArgumentValue(index)){
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' with index "+ index+" already defined using <constructor-arg>." +
							" Only one approach may be used per argument.", attr);
				}

				cvs.addIndexedArgumentValue(index, valueHolder);
			}
		}
		// no escaping -> ctr name
		else {
			String name = Conventions.attributeNameToPropertyName(argName);
			if (containsArgWithName(name, cvs)){
				parserContext.getReaderContext().error(
						"Constructor argument '" + argName + "' already defined using <constructor-arg>." +
						" Only one approach may be used per argument.", attr);
			}
			valueHolder.setName(Conventions.attributeNameToPropertyName(argName));
			cvs.addGenericArgumentValue(valueHolder);
		}
	}
	return definition;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:66,代码来源:SimpleConstructorNamespaceHandler.java

示例11: extractPropertyName

import org.springframework.core.Conventions; //导入方法依赖的package包/类
protected String extractPropertyName(String attributeName) {
    return Conventions.attributeNameToPropertyName(attributeName);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:4,代码来源:GigaMapBeanDefinitionParser.java

示例12: extractPropertyName

import org.springframework.core.Conventions; //导入方法依赖的package包/类
private String extractPropertyName(String attributeName) {
    return Conventions.attributeNameToPropertyName(attributeName);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:4,代码来源:GigaSpaceDocumentTypeBeanDefinitionParser.java

示例13: decorate

import org.springframework.core.Conventions; //导入方法依赖的package包/类
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
	if (node instanceof Attr) {
		Attr attr = (Attr) node;
		String argName = StringUtils.trimWhitespace(parserContext.getDelegate().getLocalName(attr));
		String argValue = StringUtils.trimWhitespace(attr.getValue());

		ConstructorArgumentValues cvs = definition.getBeanDefinition().getConstructorArgumentValues();
		boolean ref = false;

		// handle -ref arguments
		if (argName.endsWith(REF_SUFFIX)) {
			ref = true;
			argName = argName.substring(0, argName.length() - REF_SUFFIX.length());
		}

		ValueHolder valueHolder = new ValueHolder(ref ? new RuntimeBeanReference(argValue) : argValue);
		valueHolder.setSource(parserContext.getReaderContext().extractSource(attr));

		// handle "escaped"/"_" arguments
		if (argName.startsWith(DELIMITER_PREFIX)) {
			String arg = argName.substring(1).trim();

			// fast default check
			if (!StringUtils.hasText(arg)) {
				cvs.addGenericArgumentValue(valueHolder);
			}
			// assume an index otherwise
			else {
				int index = -1;
				try {
					index = Integer.parseInt(arg);
				} catch (NumberFormatException ex) {
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' specifies an invalid integer", attr);
				}
				if (index < 0) {
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' specifies a negative index", attr);
				}

				if (cvs.hasIndexedArgumentValue(index)){
					parserContext.getReaderContext().error(
							"Constructor argument '" + argName + "' with index "+ index+" already defined using <constructor-arg>." +
							" Only one approach may be used per argument.", attr);
				}

				cvs.addIndexedArgumentValue(index, valueHolder);
			}
		}
		// no escaping -> ctr name
		else {
			String name = Conventions.attributeNameToPropertyName(argName);
			if (containsArgWithName(name, cvs)){
				parserContext.getReaderContext().error(
						"Constructor argument '" + argName + "' already defined using <constructor-arg>." +
						" Only one approach may be used per argument.", attr);
			}
			valueHolder.setName(Conventions.attributeNameToPropertyName(argName));
			cvs.addGenericArgumentValue(valueHolder);
		}
	}
	return definition;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:64,代码来源:SimpleConstructorNamespaceHandler.java

示例14: extractPropertyName

import org.springframework.core.Conventions; //导入方法依赖的package包/类
/**
 * Extract a JavaBean property name from the supplied attribute name.
 * <p>The default implementation uses the
 * {@link Conventions#attributeNameToPropertyName(String)}
 * method to perform the extraction.
 * <p>The name returned must obey the standard JavaBean property name
 * conventions. For example for a class with a setter method
 * '{@code setBingoHallFavourite(String)}', the name returned had
 * better be '{@code bingoHallFavourite}' (with that exact casing).
 * @param attributeName the attribute name taken straight from the
 * XML element being parsed (never {@code null})
 * @return the extracted JavaBean property name (must never be {@code null})
 */
protected String extractPropertyName(String attributeName) {
	return Conventions.attributeNameToPropertyName(attributeName);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:AbstractSimpleBeanDefinitionParser.java

示例15: extractPropertyName

import org.springframework.core.Conventions; //导入方法依赖的package包/类
/**
 * Extract a JavaBean property name from the supplied attribute name.
 * <p>The default implementation uses the
 * {@link Conventions#attributeNameToPropertyName(String)}
 * method to perform the extraction.
 * <p>The name returned must obey the standard JavaBean property name
 * conventions. For example for a class with a setter method
 * '<code>setBingoHallFavourite(String)</code>', the name returned had
 * better be '<code>bingoHallFavourite</code>' (with that exact casing).
 *
 * @param attributeName the attribute name taken straight from the
 *                      XML element being parsed (never <code>null</code>)
 * @return the extracted JavaBean property name (must never be <code>null</code>)
 */
protected String extractPropertyName(String attributeName) {
    return Conventions.attributeNameToPropertyName(attributeName);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:BeanDefinitionParser.java


注:本文中的org.springframework.core.Conventions.attributeNameToPropertyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。