/** * Set the names of the beans that should automatically get wrapped with proxies. * A name can specify a prefix to match by ending with "*", e.g. "myBean,tx*" * will match the bean named "myBean" and all beans whose name start with "tx". * <p><b>NOTE:</b> In case of a FactoryBean, only the objects created by the * FactoryBean will get proxied. This default behavior applies as of Spring 2.0. * If you intend to proxy a FactoryBean instance itself (a rare use case, but * Spring 1.2's default behavior), specify the bean name of the FactoryBean * including the factory-bean prefix "&": e.g. "&myFactoryBean". * @see org.springframework.beans.factory.FactoryBean * @see org.springframework.beans.factory.BeanFactory#FACTORY_BEAN_PREFIX */ public void setBeanNames(String... beanNames) { Assert.notEmpty(beanNames, "'beanNames' must not be empty"); this.beanNames = new ArrayList<>(beanNames.length); for (String mappedName : beanNames) { this.beanNames.add(StringUtils.trimWhitespace(mappedName)); } }
private void addNoRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String noRollbackForValue) { String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(noRollbackForValue); for (String typeName : exceptionTypeNames) { rollbackRules.add(new NoRollbackRuleAttribute(StringUtils.trimWhitespace(typeName))); } }
private void addRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String rollbackForValue) { String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(rollbackForValue); for (String typeName : exceptionTypeNames) { rollbackRules.add(new RollbackRuleAttribute(StringUtils.trimWhitespace(typeName))); } }
private static String resolvePlaceholders(String attributeValue, PropertyResolver propertyResolver) { String resolvedValue = attributeValue; if (propertyResolver != null) { resolvedValue = propertyResolver.resolvePlaceholders(resolvedValue); resolvedValue = trimWhitespace(resolvedValue); } return resolvedValue; }
private static String resolvePlaceholders(String attributeValue, PropertyResolver propertyResolver) { String resolvedValue = attributeValue; if (propertyResolver != null) { resolvedValue = propertyResolver.resolvePlaceholders(resolvedValue); resolvedValue = trimWhitespace(resolvedValue); } return resolvedValue; }
/** * Set the regular expressions defining methods to match. * Matching will be the union of all these; if any match, the pointcut matches. * @see #setPattern */ public void setPatterns(String... patterns) { Assert.notEmpty(patterns, "'patterns' must not be empty"); this.patterns = new String[patterns.length]; for (int i = 0; i < patterns.length; i++) { this.patterns[i] = StringUtils.trimWhitespace(patterns[i]); } initPatternRepresentation(this.patterns); }
/** * Set the regular expressions defining methods to match for exclusion. * Matching will be the union of all these; if any match, the pointcut matches. * @see #setExcludedPattern */ public void setExcludedPatterns(String... excludedPatterns) { Assert.notEmpty(excludedPatterns, "'excludedPatterns' must not be empty"); this.excludedPatterns = new String[excludedPatterns.length]; for (int i = 0; i < excludedPatterns.length; i++) { this.excludedPatterns[i] = StringUtils.trimWhitespace(excludedPatterns[i]); } initExcludedPatternRepresentation(this.excludedPatterns); }
/** * Given an args pointcut body (could be {@code args} or {@code at_args}), * add any candidate variable names to the given list. */ private void maybeExtractVariableNamesFromArgs(@Nullable String argsSpec, List<String> varNames) { if (argsSpec == null) { return; } String[] tokens = StringUtils.tokenizeToStringArray(argsSpec, ","); for (int i = 0; i < tokens.length; i++) { tokens[i] = StringUtils.trimWhitespace(tokens[i]); String varName = maybeExtractVariableName(tokens[i]); if (varName != null) { varNames.add(varName); } } }
public void setArgumentNamesFromStringArray(String... args) { this.argumentNames = new String[args.length]; for (int i = 0; i < args.length; i++) { this.argumentNames[i] = StringUtils.trimWhitespace(args[i]); if (!isVariableName(this.argumentNames[i])) { throw new IllegalArgumentException( "'argumentNames' property of AbstractAspectJAdvice contains an argument name '" + this.argumentNames[i] + "' that is not a valid Java identifier"); } } if (this.argumentNames != null) { if (this.aspectJAdviceMethod.getParameterCount() == this.argumentNames.length + 1) { // May need to add implicit join point arg name... Class<?> firstArgType = this.aspectJAdviceMethod.getParameterTypes()[0]; if (firstArgType == JoinPoint.class || firstArgType == ProceedingJoinPoint.class || firstArgType == JoinPoint.StaticPart.class) { String[] oldNames = this.argumentNames; this.argumentNames = new String[oldNames.length + 1]; this.argumentNames[0] = "THIS_JOIN_POINT"; System.arraycopy(oldNames, 0, this.argumentNames, 1, oldNames.length); } } } }
private void addNoRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String noRollbackForValue) { String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(noRollbackForValue); for (String typeName : exceptionTypeNames) { rollbackRules.add(new NoRollbackRuleAttribute(StringUtils.trimWhitespace(typeName))); } }
private void addRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String rollbackForValue) { String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(rollbackForValue); for (String typeName : exceptionTypeNames) { rollbackRules.add(new RollbackRuleAttribute(StringUtils.trimWhitespace(typeName))); } }
private void setCombinedGroups() { this.groups = new HashMap<>(); this.groups.putAll(this.defaultUserGroups); this.groups.putAll(this.nonDefaultUserGroups); this.configuredGroups.entrySet().stream() .filter(e -> StringUtils.hasText(e.getValue()) || !groups.containsKey(e.getKey())) .forEach(e -> groups.put(e.getKey(), e.getValue())); this.groups = this.groups.entrySet().stream() .collect(new MapCollector<>(e -> StringUtils.trimWhitespace(e.getKey()), e -> StringUtils.trimWhitespace(e.getValue()))); }
@Test public void testTrimWhitespace() { assertEquals(null, StringUtils.trimWhitespace(null)); assertEquals("", StringUtils.trimWhitespace("")); assertEquals("", StringUtils.trimWhitespace(" ")); assertEquals("", StringUtils.trimWhitespace("\t")); assertEquals("a", StringUtils.trimWhitespace(" a")); assertEquals("a", StringUtils.trimWhitespace("a ")); assertEquals("a", StringUtils.trimWhitespace(" a ")); assertEquals("a b", StringUtils.trimWhitespace(" a b ")); assertEquals("a b c", StringUtils.trimWhitespace(" a b c ")); }
String key = StringUtils.trimWhitespace((String) entry.getKey()); if (key.startsWith(prefix + SEPARATOR)) { String property = key.substring(prefix.length() + SEPARATOR.length()); if (CLASS_KEY.equals(property)) { className = StringUtils.trimWhitespace((String) entry.getValue()); parent = StringUtils.trimWhitespace((String) entry.getValue()); String val = StringUtils.trimWhitespace((String) entry.getValue()); isAbstract = TRUE_VALUE.equals(val); scope = StringUtils.trimWhitespace((String) entry.getValue()); String val = StringUtils.trimWhitespace((String) entry.getValue()); scope = ("".equals(val) || TRUE_VALUE.equals(val) ? GenericBeanDefinition.SCOPE_SINGLETON : GenericBeanDefinition.SCOPE_PROTOTYPE); String val = StringUtils.trimWhitespace((String) entry.getValue()); lazyInit = TRUE_VALUE.equals(val); String ref = StringUtils.trimWhitespace((String) entry.getValue());
for (int i = 0; i < tokens.length; i++) { String token = StringUtils.trimWhitespace(tokens[i].trim());
if (node instanceof Attr) { Attr attr = (Attr) node; String argName = StringUtils.trimWhitespace(parserContext.getDelegate().getLocalName(attr)); String argValue = StringUtils.trimWhitespace(attr.getValue());
String key = StringUtils.trimWhitespace((String) entry.getKey()); if (key.startsWith(prefix + SEPARATOR)) { String property = key.substring(prefix.length() + SEPARATOR.length()); if (CLASS_KEY.equals(property)) { className = StringUtils.trimWhitespace((String) entry.getValue()); parent = StringUtils.trimWhitespace((String) entry.getValue()); String val = StringUtils.trimWhitespace((String) entry.getValue()); isAbstract = TRUE_VALUE.equals(val); scope = StringUtils.trimWhitespace((String) entry.getValue()); String val = StringUtils.trimWhitespace((String) entry.getValue()); scope = ("".equals(val) || TRUE_VALUE.equals(val) ? GenericBeanDefinition.SCOPE_SINGLETON : GenericBeanDefinition.SCOPE_PROTOTYPE); String val = StringUtils.trimWhitespace((String) entry.getValue()); lazyInit = TRUE_VALUE.equals(val); String ref = StringUtils.trimWhitespace((String) entry.getValue());
for (int i = 0; i < tokens.length; i++) { String token = StringUtils.trimWhitespace(tokens[i].trim());
if (node instanceof Attr) { Attr attr = (Attr) node; String argName = StringUtils.trimWhitespace(parserContext.getDelegate().getLocalName(attr)); String argValue = StringUtils.trimWhitespace(attr.getValue());
public void setBeanNames(String[] beanNames) { this.beanNames = new ArrayList(beanNames.length); for (int i = 0; i < beanNames.length; i++) { this.beanNames.add(StringUtils.trimWhitespace(beanNames[i])); } }