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


Java PatternMatchUtils类代码示例

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


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

示例1: getWebSocketBrokarage

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private ZuulWebSocketProperties.WsBrokerage getWebSocketBrokarage(URI uri) {
	String path = uri.toString();
	if (path.contains(":")) {
		path = UriComponentsBuilder.fromUriString(path).build().getPath();
	}

	for (Map.Entry<String, ZuulWebSocketProperties.WsBrokerage> entry : zuulWebSocketProperties
			.getBrokerages().entrySet()) {
		ZuulWebSocketProperties.WsBrokerage wsBrokerage = entry.getValue();
		if (wsBrokerage.isEnabled()) {
			for (String endPoint : wsBrokerage.getEndPoints()) {
				if (PatternMatchUtils.simpleMatch(toPattern(endPoint), path + "/")) {
					return wsBrokerage;
				}
			}
		}
	}

	return null;
}
 
开发者ID:mthizo247,项目名称:spring-cloud-netflix-zuul-websocket,代码行数:21,代码来源:ProxyWebSocketHandler.java

示例2: findImage

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
/**
 * Find image by its name, or id
 * @param name
 * @param imageId
 * @return
 */
public Image findImage(String name, String imageId) {
    Image res = null;
    if(imageId != null) {
        res = imagesByName.get(imageId);
    }
    String withoutTag = ImageName.withoutTagOrNull(name);
    if(res == null && withoutTag != null) {
        res = imagesByName.get(withoutTag);
    }
    if(res == null && (imageId != null || withoutTag != null)) {
        for(Image img: imagesWithPattern) {
            String pattern = img.getName();
            if(withoutTag != null && PatternMatchUtils.simpleMatch(pattern, withoutTag) ||
               imageId != null && PatternMatchUtils.simpleMatch(pattern, imageId)) {
                res = img;
                break;
            }
        }
    }
    return res;
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:28,代码来源:ImagesForUpdate.java

示例3: getErrorCodes

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
/**
 * Return the {@link SQLErrorCodes} instance for the given database.
 * <p>No need for a database metadata lookup.
 * @param dbName the database name (must not be {@code null})
 * @return the {@code SQLErrorCodes} instance for the given database
 * @throws IllegalArgumentException if the supplied database name is {@code null}
 */
public SQLErrorCodes getErrorCodes(String dbName) {
	Assert.notNull(dbName, "Database product name must not be null");

	SQLErrorCodes sec = this.errorCodesMap.get(dbName);
	if (sec == null) {
		for (SQLErrorCodes candidate : this.errorCodesMap.values()) {
			if (PatternMatchUtils.simpleMatch(candidate.getDatabaseProductNames(), dbName)) {
				sec = candidate;
				break;
			}
		}
	}
	if (sec != null) {
		checkCustomTranslatorRegistry(dbName, sec);
		if (logger.isDebugEnabled()) {
			logger.debug("SQL error codes for '" + dbName + "' found");
		}
		return sec;
	}

	// Could not find the database among the defined ones.
	if (logger.isDebugEnabled()) {
		logger.debug("SQL error codes for '" + dbName + "' not found");
	}
	return new SQLErrorCodes();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:SQLErrorCodesFactory.java

示例4: postProcessBeanDefinition

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
/**
 * Apply further settings to the given bean definition,
 * beyond the contents retrieved from scanning the component class.
 * @param beanDefinition the scanned bean definition
 * @param beanName the generated bean name for the given bean
 */
protected void postProcessBeanDefinition(AbstractBeanDefinition beanDefinition, String beanName) {
	beanDefinition.applyDefaults(this.beanDefinitionDefaults);
	if (this.autowireCandidatePatterns != null) {
		beanDefinition.setAutowireCandidate(PatternMatchUtils.simpleMatch(this.autowireCandidatePatterns, beanName));
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:ClassPathBeanDefinitionScanner.java

示例5: getWebSocketServerPath

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private String getWebSocketServerPath(ZuulWebSocketProperties.WsBrokerage wsBrokerage,
		URI uri) {
	String path = uri.toString();
	if (path.contains(":")) {
		path = UriComponentsBuilder.fromUriString(path).build().getPath();
	}

	for (String endPoint : wsBrokerage.getEndPoints()) {
		if (PatternMatchUtils.simpleMatch(toPattern(endPoint), path + "/")) {
			return endPoint;
		}
	}

	return null;
}
 
开发者ID:mthizo247,项目名称:spring-cloud-netflix-zuul-websocket,代码行数:16,代码来源:ProxyWebSocketHandler.java

示例6: getMatchingHeaderNames

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private List<String> getMatchingHeaderNames(String pattern, Map<String, Object> headers) {
	List<String> matchingHeaderNames = new ArrayList<String>();
	if (headers != null) {
		for (String key : headers.keySet()) {
			if (PatternMatchUtils.simpleMatch(pattern, key)) {
				matchingHeaderNames.add(key);
			}
		}
	}
	return matchingHeaderNames;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:MessageHeaderAccessor.java

示例7: hasAtLeastOneAnnotation

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
/**
 * Determine if an {@link AnnotatedNode} has one or more of the specified annotations.
 * N.B. the annotation type names are not normally fully qualified.
 * @param node the node to examine
 * @param annotations the annotations to look for
 * @return {@code true} if at least one of the annotations is found, otherwise
 * {@code false}
 */
public static boolean hasAtLeastOneAnnotation(AnnotatedNode node,
		String... annotations) {
	for (AnnotationNode annotationNode : node.getAnnotations()) {
		for (String annotation : annotations) {
			if (PatternMatchUtils.simpleMatch(annotation,
					annotationNode.getClassNode().getName())) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:AstUtils.java

示例8: findTrigger

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
/**
 * Find a matching trigger configuration.
 * @param name the bean name to match
 * @return a matching configuration if there is one
 */
public TriggerProperties findTrigger(String name) {
	for (SpecificTriggerProperties value : this.triggers.values()) {
		if (PatternMatchUtils.simpleMatch(value.getNames(), name)) {
			return value;
		}
	}
	return this;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:MetricExportProperties.java

示例9: isMatch

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private boolean isMatch(Metric<?> metric) {
	String[] includes = MetricCopyExporter.this.includes;
	String[] excludes = MetricCopyExporter.this.excludes;
	String name = metric.getName();
	if (ObjectUtils.isEmpty(includes)
			|| PatternMatchUtils.simpleMatch(includes, name)) {
		return !PatternMatchUtils.simpleMatch(excludes, name);
	}
	return false;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:MetricCopyExporter.java

示例10: executeLocalJobs

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private void executeLocalJobs(JobParameters jobParameters)
		throws JobExecutionException {
	for (Job job : this.jobs) {
		if (StringUtils.hasText(this.jobNames)) {
			String[] jobsToRun = this.jobNames.split(",");
			if (!PatternMatchUtils.simpleMatch(jobsToRun, job.getName())) {
				logger.debug("Skipped job: " + job.getName());
				continue;
			}
		}
		execute(job, jobParameters);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:JobLauncherCommandLineRunner.java

示例11: match

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private static boolean match(String pattern, String image, String imageId) {
    if(isAll(pattern)) {
        return true;
    }
    boolean isPattern = isPattern(pattern);
    if(ImageName.isId(image) && !isPattern) {
        return pattern.equals(imageId == null? image : imageId);
    }
    String imageVersion = ContainerUtils.getImageVersion(image);
    if(isPattern) {
        return PatternMatchUtils.simpleMatch(pattern, imageVersion);
    } else {
        return pattern.equals(imageVersion);
    }
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:16,代码来源:ImagesForUpdate.java

示例12: innerTest

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
@Override
protected boolean innerTest(CharSequence text) {
    if(text == null) {
        //obviously that '*' math null strings too
        return "*".equals(pattern);
    }
    return PatternMatchUtils.simpleMatch(pattern, text.toString());
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:9,代码来源:PatternFilter.java

示例13: filter

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private List<Server> filter(List<Server> servers, String pattern) {
	List<Server> filtered = new ArrayList<>();
	for (Server server : servers) {
		if (PatternMatchUtils.simpleMatch(pattern, server.getId())) {
			filtered.add(server);
		}
	}
	return filtered;
}
 
开发者ID:spencergibb,项目名称:ribbondemo,代码行数:10,代码来源:DemoServerListFilter.java

示例14: filter

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private Server filter(String pattern) {
	if (StringUtils.hasText(pattern)) {
		List<Server> servers = getServerList(true);
		for (Server server : servers) {
			if (PatternMatchUtils.simpleMatch(pattern, server.getId())) {
				return server;
			}
		}
	}
	return null;
}
 
开发者ID:spencergibb,项目名称:ribbondemo,代码行数:12,代码来源:DemoLoadBalancer.java

示例15: isMatch

import org.springframework.util.PatternMatchUtils; //导入依赖的package包/类
private boolean isMatch(String name, String[] includes, String[] excludes) {
	if (ObjectUtils.isEmpty(includes)
			|| PatternMatchUtils.simpleMatch(includes, name)) {
		return !PatternMatchUtils.simpleMatch(excludes, name);
	}
	return false;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream,代码行数:8,代码来源:ApplicationMetricsProperties.java


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