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


Java StringUtils.tokenizeToStringArray方法代码示例

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


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

示例1: decorate

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {

    // 设置bean scope为version-refresh
    definition.getBeanDefinition().setScope(VersionRefreshScope.SCOPE_NAME);

    String[] dependsOn = null;
    if (node instanceof Element) {
        Element ele = (Element) node;
        if (ele.hasAttribute(DEPENDS_ON)) {
            dependsOn = StringUtils.tokenizeToStringArray(ele.getAttribute(DEPENDS_ON), ",");
        }
    }

    // 注册属性依赖
    DependencyConfigUtils.registerDependency(parserContext.getRegistry(), definition.getBeanName(), dependsOn);

    return definition;
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:20,代码来源:VersionRefreshBeanDefinitionDecorator.java

示例2: doParse

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
protected void doParse(Element element, BeanDefinitionBuilder bean) {
    boolean fallbackToSystemLocale = false;
    String[] basenames = null;

    if (element.hasAttribute(FALLBACK_TO_SYSTEM_LOCALE)) {
        fallbackToSystemLocale = Boolean.valueOf(element.getAttribute(FALLBACK_TO_SYSTEM_LOCALE));
    }
    if (element.hasAttribute(BASENAMES)) {
        basenames = StringUtils.tokenizeToStringArray(element.getAttribute(BASENAMES), ",");
    }

    bean.addPropertyValue("fallbackToSystemLocale", fallbackToSystemLocale);
    bean.addPropertyValue("basenames", basenames);
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:15,代码来源:ConfigMessageSourceBeanDefinitionParser.java

示例3: getLocationsFromHeader

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Similar to {@link #getHeaderLocations(Dictionary)} but looks at a
 * specified header directly.
 * 
 * @param header header to look at
 * @param defaultValue default locations if none is specified
 * @return
 */
public static String[] getLocationsFromHeader(String header, String defaultValue) {

	String[] ctxEntries;
	if (StringUtils.hasText(header) && !(';' == header.charAt(0))) {
		// get the config locations
		String locations = StringUtils.tokenizeToStringArray(header, DIRECTIVE_SEPARATOR)[0];
		// parse it into individual token
		ctxEntries = StringUtils.tokenizeToStringArray(locations, CONTEXT_LOCATION_SEPARATOR);

		// replace * with a 'digestable' location
		for (int i = 0; i < ctxEntries.length; i++) {
			if (CONFIG_WILDCARD.equals(ctxEntries[i]))
				ctxEntries[i] = defaultValue;
		}
	}
	else {
		ctxEntries = new String[0];
	}

	return ctxEntries;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:30,代码来源:ConfigUtils.java

示例4: parse

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Parse the given pattern expression.
 */
private void parse(String expression) throws IllegalArgumentException {
	String[] fields = StringUtils.tokenizeToStringArray(expression, " ");
	if (fields.length != 6) {
		throw new IllegalArgumentException(String.format(
				"Cron expression must consist of 6 fields (found %d in \"%s\")", fields.length, expression));
	}
	setNumberHits(this.seconds, fields[0], 0, 60);
	setNumberHits(this.minutes, fields[1], 0, 60);
	setNumberHits(this.hours, fields[2], 0, 24);
	setDaysOfMonth(this.daysOfMonth, fields[3]);
	setMonths(this.months, fields[4]);
	setDays(this.daysOfWeek, replaceOrdinals(fields[5], "SUN,MON,TUE,WED,THU,FRI,SAT"), 8);
	if (this.daysOfWeek.get(7)) {
		// Sunday can be represented as 0 or 7
		this.daysOfWeek.set(0);
		this.daysOfWeek.clear(7);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CronSequenceGenerator.java

示例5: postProcessConfigItems

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public void postProcessConfigItems(long version, ConfigPropertySource propertySource) {
    if (propertySource == null) { // 当前版本无属性
        return;
    }

    // 初始化propertySourceName
    if (propertySourceName == null) {
        if (environment.containsProperty(SPRING_PROPERTY_SOURCES)) {
            propertySourceName = environment.getProperty(SPRING_PROPERTY_SOURCES);
        } else {
            propertySourceName = DEFAULT_PROPERTY_SOURCES;
        }
    }

    // 从配置中心动态更新propertySourceName
    if (propertySource.containsProperty(SPRING_PROPERTY_SOURCES)) {
        propertySourceName = (String) propertySource.getProperty(SPRING_PROPERTY_SOURCES);
    }

    String[] propertySourceNames = StringUtils.tokenizeToStringArray(propertySourceName, DELIMITERS);
    if (propertySourceNames != null) {
        for (String name : propertySourceNames) {
            if (StringUtils.isEmpty(name)) {
                continue;
            }
            name = name.trim();
            if (propertySource.containsProperty(name)) {
                processPropertySource(propertySource, name);
            }
        }
    }
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:34,代码来源:PropertiesFileConfigItemPostProcessor.java

示例6: getStringsFromLastExists

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Converts content of last existing file in files to string array
 * 
 * @throws IOException
 */
public static String[] getStringsFromLastExists(String delimiter, File... files) throws IOException {
	String[] ret = new String[0];
	for (File f : files) {
		if (!f.exists())
			continue;

		String str = new String(FileCopyUtils.copyToByteArray(f), "UTF-8");
		ret = StringUtils.tokenizeToStringArray(str, delimiter);
	}
	return ret;
}
 
开发者ID:EonTechnology,项目名称:server,代码行数:17,代码来源:ConfigHelper.java

示例7: getDirectiveValue

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Return the directive value as a String. If the directive does not exist
 * or is invalid (wrong format) a null string will be returned.
 * 
 * @param header
 * @param directive
 * @return
 */
public static String getDirectiveValue(String header, String directive) {
	Assert.notNull(header, "not-null header required");
	Assert.notNull(directive, "not-null directive required");
	String[] directives = StringUtils.tokenizeToStringArray(header, DIRECTIVE_SEPARATOR);

	for (int i = 0; i < directives.length; i++) {
		String[] splittedDirective = StringUtils.delimitedListToStringArray(directives[i].trim(), EQUALS);
		if (splittedDirective.length == 2 && splittedDirective[0].equals(directive))
			return splittedDirective[1];
	}

	return null;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:22,代码来源:ConfigUtils.java

示例8: parse

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public BeanDefinition parse(Element element, ParserContext parserContext)
{
    BeanDefinitionBuilder dwrController = BeanDefinitionBuilder.rootBeanDefinition(DwrController.class);
    List configurators = new ManagedList();
    configurators.add(new RuntimeBeanReference(DEFAULT_SPRING_CONFIGURATOR_ID));
    dwrController.addPropertyValue("configurators", configurators);

    String debug = element.getAttribute("debug");
    if (StringUtils.hasText(debug))
    {
        dwrController.addPropertyValue("debug", debug);
    }

    String beanName = element.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);
    String nameAttr = element.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE);
    String[] aliases = null;
    if (!StringUtils.hasText(beanName))
    {
        beanName = element.getAttribute("name");
    }
    else
    {
        String aliasName = element.getAttribute("name");
        if (StringUtils.hasText(aliasName))
        {
            aliases = StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.BEAN_NAME_DELIMITERS);
        }
    }

    parseControllerParameters(dwrController, element);
    
    BeanDefinitionHolder holder = new BeanDefinitionHolder(dwrController.getBeanDefinition(), beanName, aliases);
    BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());

    return dwrController.getBeanDefinition();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:DwrNamespaceHandler.java

示例9: doParse

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
private synchronized void doParse(Element element, ParserContext parserContext) {
    String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute("base-package"), ",; \t\n");
    AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
    if (!parserContext.getRegistry().containsBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME)) {
        Object eleSource = parserContext.extractSource(element);

        RootBeanDefinition configMapDef = new RootBeanDefinition(ConcurrentHashMap.class);
        configMapDef.setSource(eleSource);
        configMapDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        String configMapName = parserContext.getReaderContext().registerWithGeneratedName(configMapDef);

        RootBeanDefinition interceptorDef = new RootBeanDefinition(JetCacheInterceptor.class);
        interceptorDef.setSource(eleSource);
        interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        interceptorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
        String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);

        RootBeanDefinition advisorDef = new RootBeanDefinition(CacheAdvisor.class);
        advisorDef.setSource(eleSource);
        advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("adviceBeanName", interceptorName));
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("basePackages", basePackages));
        parserContext.getRegistry().registerBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME, advisorDef);

        CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
                eleSource);
        compositeDef.addNestedComponent(new BeanComponentDefinition(configMapDef, configMapName));
        compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
        compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheAdvisor.CACHE_ADVISOR_BEAN_NAME));
        parserContext.registerComponent(compositeDef);
    }
}
 
开发者ID:alibaba,项目名称:jetcache,代码行数:34,代码来源:CacheAnnotationParser.java

示例10: setInterceptorHandlers

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public void setInterceptorHandlers(String interceptorHandlers) {
    String[] handlerNames = StringUtils.tokenizeToStringArray(interceptorHandlers,
            ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);

    for (String name : handlerNames) {
        if (CacheHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new CacheHandler());
            cacheEnabled = true;
        } else if (RwRouteHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new RwRouteHandler());
            rwRouteEnabled = true;
        } else if (DatabaseRouteHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new DatabaseRouteHandler());
            dbShardEnabled = true;
        } else if (PaginationHandler.NAME.equals(name)) {
            this.interceptorHandlers.add(new PaginationHandler());
        }
    }
    //排序
    Collections.sort(this.interceptorHandlers, new Comparator<InterceptorHandler>() {
        @Override
        public int compare(InterceptorHandler o1, InterceptorHandler o2) {
            return Integer.compare(o1.interceptorOrder(), o2.interceptorOrder());
        }
    });

}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:28,代码来源:MybatisInterceptor.java

示例11: maybeExtractVariableNamesFromArgs

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * 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(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);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AspectJAdviceParameterNameDiscoverer.java

示例12: maybeBindPrimitiveArgsFromPointcutExpression

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Match up args against unbound arguments of primitive types
 */
private void maybeBindPrimitiveArgsFromPointcutExpression() {
	int numUnboundPrimitives = countNumberOfUnboundPrimitiveArguments();
	if (numUnboundPrimitives > 1) {
		throw new AmbiguousBindingException("Found '" + numUnboundPrimitives +
				"' unbound primitive arguments with no way to distinguish between them.");
	}
	if (numUnboundPrimitives == 1) {
		// Look for arg variable and bind it if we find exactly one...
		List<String> varNames = new ArrayList<String>();
		String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
		for (int i = 0; i < tokens.length; i++) {
			if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
				PointcutBody body = getPointcutBody(tokens, i);
				i += body.numTokensConsumed;
				maybeExtractVariableNamesFromArgs(body.text, varNames);
			}
		}
		if (varNames.size() > 1) {
			throw new AmbiguousBindingException("Found " + varNames.size() +
					" candidate variable names but only one candidate binding slot when matching primitive args");
		}
		else if (varNames.size() == 1) {
			// 1 primitive arg, and one candidate...
			for (int i = 0; i < this.argumentTypes.length; i++) {
				if (isUnbound(i) && this.argumentTypes[i].isPrimitive()) {
					bindParameterName(i, varNames.get(0));
					break;
				}
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:AspectJAdviceParameterNameDiscoverer.java

示例13: setCacheNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public void setCacheNames(String cacheNames) {
    if (org.apache.commons.lang3.StringUtils.isBlank(cacheNames)) {
        return;
    }
    String[] tmpcacheNames = StringUtils.tokenizeToStringArray(cacheNames,
            ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);
    this.cacheNames = new ArrayList<>(Arrays.asList(tmpcacheNames));
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:9,代码来源:Level1CacheSupport.java

示例14: setIgnoreUripattern

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Value("${web.token.ignore.uri.pattern}")
public void setIgnoreUripattern(String ignoreUripattern) {
	if (!StringUtils.isEmpty(ignoreUripattern))
		ignoreUriPatterns = StringUtils.tokenizeToStringArray(ignoreUripattern, ",");
}
 
开发者ID:7upcat,项目名称:agile-wroking-backend,代码行数:6,代码来源:WebTokenHandlerInterceptor.java

示例15: parseComponentDefinitionElement

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Parses the supplied <code>&lt;bean&gt;</code> element. May return <code>null</code> if there were errors during
 * parse. Errors are reported to the {@link org.springframework.beans.factory.parsing.ProblemReporter}.
 */
private BeanDefinitionHolder parseComponentDefinitionElement(Element ele, BeanDefinition containingBean) {

	// extract bean name
	String id = ele.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);
	String nameAttr = ele.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE);

	List<String> aliases = new ArrayList<String>(4);
	if (StringUtils.hasLength(nameAttr)) {
		String[] nameArr =
				StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.MULTI_VALUE_ATTRIBUTE_DELIMITERS);
		aliases.addAll(Arrays.asList(nameArr));
	}

	String beanName = id;

	if (!StringUtils.hasText(beanName) && !aliases.isEmpty()) {
		beanName = (String) aliases.remove(0);
		if (log.isDebugEnabled()) {
			log.debug("No XML 'id' specified - using '" + beanName + "' as bean name and " + aliases
					+ " as aliases");
		}
	}

	if (containingBean == null) {

		if (checkNameUniqueness(beanName, aliases, usedNames)) {
			error("Bean name '" + beanName + "' is already used in this file", ele);
		}

		if (ParsingUtils.isReservedName(beanName, ele, parserContext)) {
			error("Blueprint reserved name '" + beanName + "' cannot be used", ele);
		}
	}

	AbstractBeanDefinition beanDefinition = parseBeanDefinitionElement(ele, beanName, containingBean);
	if (beanDefinition != null) {
		if (!StringUtils.hasText(beanName)) {
			try {
				if (containingBean != null) {
					beanName =
							ParsingUtils.generateBlueprintBeanName(beanDefinition, parserContext.getRegistry(),
									true);
				} else {
					beanName =
							ParsingUtils.generateBlueprintBeanName(beanDefinition, parserContext.getRegistry(),
									false);
					// TODO: should we support 2.0 behaviour (see below):
					// 
					// Register an alias for the plain bean class name, if still possible,
					// if the generator returned the class name plus a suffix.
					// This is expected for Spring 1.2/2.0 backwards compatibility.
				}
				if (log.isDebugEnabled()) {
					log.debug("Neither XML 'id' nor 'name' specified - " + "using generated bean name [" + beanName
							+ "]");
				}
			} catch (Exception ex) {
				error(ex.getMessage(), ele, ex);
				return null;
			}
		}
		return new BeanDefinitionHolder(beanDefinition, beanName);
	}

	return null;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:71,代码来源:BlueprintParser.java


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