Java Code Examples for org.springframework.util.StringUtils.trimArrayElements()

The following are Jave code examples for showing how to use trimArrayElements() of the org.springframework.util.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: JRediClients   File: RedissonNamespaceParserSupport.java   View Source Code Vote up 5 votes
public String[] parseAliase(Element element) {
    if (element == null) {
        return null;
    }
    String[] aliases = null;
    String name = element.getAttribute(NAME_ATTRIBUTE);
    if (StringUtils.hasLength(name)) {
        aliases = StringUtils.trimArrayElements(
                StringUtils.commaDelimitedListToStringArray(name));
    }
    return aliases;
}
 
Example 2
Project: lams   File: StringArrayPropertyEditor.java   View Source Code Vote up 5 votes
@Override
public void setAsText(String text) throws IllegalArgumentException {
	String[] array = StringUtils.delimitedListToStringArray(text, this.separator, this.charsToDelete);
	if (trimValues) {
		array = StringUtils.trimArrayElements(array);
	}
	if (this.emptyArrayAsNull && array.length == 0) {
		setValue(null);
	}
	else {
		setValue(array);
	}
}
 
Example 3
Project: lams   File: AbstractBeanDefinitionParser.java   View Source Code Vote up 5 votes
@Override
public final BeanDefinition parse(Element element, ParserContext parserContext) {
	AbstractBeanDefinition definition = parseInternal(element, parserContext);
	if (definition != null && !parserContext.isNested()) {
		try {
			String id = resolveId(element, definition, parserContext);
			if (!StringUtils.hasText(id)) {
				parserContext.getReaderContext().error(
						"Id is required for element '" + parserContext.getDelegate().getLocalName(element)
								+ "' when used as a top-level tag", element);
			}
			String[] aliases = new String[0];
			String name = element.getAttribute(NAME_ATTRIBUTE);
			if (StringUtils.hasLength(name)) {
				aliases = StringUtils.trimArrayElements(StringUtils.commaDelimitedListToStringArray(name));
			}
			BeanDefinitionHolder holder = new BeanDefinitionHolder(definition, id, aliases);
			registerBeanDefinition(holder, parserContext.getRegistry());
			if (shouldFireEvents()) {
				BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
				postProcessComponentDefinition(componentDefinition);
				parserContext.registerComponent(componentDefinition);
			}
		}
		catch (BeanDefinitionStoreException ex) {
			parserContext.getReaderContext().error(ex.getMessage(), element);
			return null;
		}
	}
	return definition;
}