當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。