本文整理汇总了Java中org.apache.tools.ant.types.selectors.SelectorUtils.matchPath方法的典型用法代码示例。如果您正苦于以下问题:Java SelectorUtils.matchPath方法的具体用法?Java SelectorUtils.matchPath怎么用?Java SelectorUtils.matchPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.types.selectors.SelectorUtils
的用法示例。
在下文中一共展示了SelectorUtils.matchPath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findStrayThirdPartyBinaries
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private void findStrayThirdPartyBinaries(File dir, String prefix, Set<String> violations, List<String> ignoredPatterns) throws IOException {
for (String n : findHgControlledFiles(dir)) {
File f = new File(dir, n);
if (f.isDirectory()) {
findStrayThirdPartyBinaries(f, prefix + n + "/", violations, ignoredPatterns);
} else if (n.matches(".*\\.(jar|zip)")) {
String path = prefix + n;
boolean ignored = false;
for (String pattern : ignoredPatterns) {
if (SelectorUtils.matchPath(pattern, path)) {
ignored = true;
break;
}
}
if (!ignored && dir.getName().equals("external") &&
new File(new File(dir.getParentFile(), "nbproject"), "project.xml").isFile()) {
ignored = true;
}
if (!ignored) {
violations.add(path);
} else {
//System.err.println("accepted: " + path);
}
}
}
}
示例2: scanForExtraFiles
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private void scanForExtraFiles(File d, String prefix, Set<String> files, String cluster, StringBuilder extraFiles) {
if (prefix.equals("update_tracking/")) {
return;
}
for (String n : d.list()) {
File f = new File(d, n);
if (f.getName().equals(".lastModified")) {
continue;
}
if (f.isDirectory()) {
scanForExtraFiles(f, prefix + n + "/", files, cluster, extraFiles);
} else {
String path = prefix + n;
if ( patterns != null )
for( String p: patterns.getExcludePatterns(getProject()) )
if (SelectorUtils.matchPath(p, path)) return;
if (!files.contains(path)) {
extraFiles.append("\n" + cluster + ": untracked file " + path);
f.delete();
}
}
}
}
示例3: matchesArtifactPattern
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
public synchronized boolean matchesArtifactPattern( String relativePath )
{
// Correct the slash pattern.
relativePath = relativePath.replace( '\\', '/' );
if ( artifactPatterns == null )
{
artifactPatterns = getFileTypePatterns( ARTIFACTS );
}
for ( String pattern : artifactPatterns )
{
if ( SelectorUtils.matchPath( pattern, relativePath, false ) )
{
// Found match
return true;
}
}
// No match.
return false;
}
示例4: matchesDefaultExclusions
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
public boolean matchesDefaultExclusions( String relativePath )
{
// Correct the slash pattern.
relativePath = relativePath.replace( '\\', '/' );
for ( String pattern : DEFAULT_EXCLUSIONS )
{
if ( SelectorUtils.matchPath( pattern, relativePath, false ) )
{
// Found match
return true;
}
}
// No match.
return false;
}
示例5: excluded
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private boolean excluded(File f, String prefix) { // #68929
String pathAbs = f.getAbsolutePath();
if (!pathAbs.startsWith(prefix)) {
throw new BuildException("Examined file " + f + " should have a path starting with " + prefix, getLocation());
}
// Cannot just call matchPath on the pathAbs because a relative pattern will *never* match an absolute path!
String path = pathAbs.substring(prefix.length());
for (String exclude : DirectoryScanner.getDefaultExcludes()) {
if (SelectorUtils.matchPath(exclude.replace('/', File.separatorChar), path)) {
return true;
}
}
return false;
}
示例6: matchesPattern
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
* Tests whitelist and blacklist patterns against path.
*
* @param path the path to test.
* @param patterns the list of patterns to check.
* @return true if the path matches at least 1 pattern in the provided patterns list.
*/
private boolean matchesPattern( String path, List<String> patterns )
{
if ( CollectionUtils.isEmpty( patterns ) )
{
return false;
}
if ( !path.startsWith( "/" ) )
{
path = "/" + path;
}
for ( String pattern : patterns )
{
if ( !pattern.startsWith( "/" ) )
{
pattern = "/" + pattern;
}
if ( SelectorUtils.matchPath( pattern, path, false ) )
{
return true;
}
}
return false;
}
示例7: isCandidate
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
* flow:
*
* 0. no match for extension -> return false
* 1. no include, no exclude -> don't filter. return true
* 2. no include, yes exclude -> return isExcludeMatch(file) ? false : true
* 3. yes include, no exclude -> return isIncludeMatch(file) ? true : false
*
* 4. yes include, yes exclude ->
* if(isExcludeMatch(file)) {
* return false
* }
*
* return isIncludeMatch(file))
*
* @param relativePath
* @return
*/
private boolean isCandidate(String relativePath, String[] extensions, List<String> includeFilter, List<String> excludeFilter) {
relativePath = relativePath.replaceAll("\\\\", "/");
boolean isMatch = true;
if(!isExtension(relativePath, extensions)) {
return false;
}
if(excludeFilter != null) {
for (String exclusion : excludeFilter) {
if(SelectorUtils.matchPath(exclusion, relativePath, false)) {
return false;
}
}
}
if(includeFilter.size() > 0) {
for (String inclusion : includeFilter) {
if(SelectorUtils.matchPath(inclusion, relativePath, false)) {
return true;
}
}
isMatch = false;
}
return isMatch;
}
示例8: match
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
* Convert the paths into absolute normalized paths and match or test for prefix equality.
*
* @param pattern the path representing the pattern
* @param path the path to be matched
* @param prefix do a prefix check of <code>pattern</code> in <code>path</code> or match
* <code>pattern</code> as ANT pattern in <code>path</code>
* @return <code>true</code> if <code>path</code> matches <code>pattern</code>, <code>false</code> else
*/
private static boolean match(Path pattern, Path path, boolean prefix) {
boolean result;
// just use the ANT stuff / prefix but use the absolute paths
String sPattern = PathUtils.normalize(pattern.getAbsolutePath().getAbsolutePath());
String sPath = PathUtils.normalize(path.getAbsolutePath().getAbsolutePath());
if (prefix) {
result = sPath.startsWith(sPattern);
} else {
result = SelectorUtils.matchPath(sPattern, sPath);
}
return result;
}
示例9: matches
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
private boolean matches(List<String> patterns, String candidate) {
for (String pattern : patterns) {
if (SelectorUtils.matchPath(pattern, candidate)) {
return true;
}
}
return false;
}
示例10: matchPath
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
* Tests whether or not a given path matches a given pattern.
*
* @param pattern The pattern to match against. Must not be
* <code>null</code>.
* @param str The path to match, as a String. Must not be
* <code>null</code>.
*
* @return <code>true</code> if the pattern matches against the string,
* or <code>false</code> otherwise.
*/
protected static boolean matchPath( String pattern, String str ) {
return SelectorUtils.matchPath( pattern, str );
}
示例11: matchPath
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
* Test whether or not a given path matches a given pattern.
*
* @param pattern The pattern to match against. Must not be
* <code>null</code>.
* @param str The path to match, as a String. Must not be
* <code>null</code>.
*
* @return <code>true</code> if the pattern matches against the string,
* or <code>false</code> otherwise.
*/
protected static boolean matchPath(final String pattern, final String str) {
return SelectorUtils.matchPath(pattern, str);
}
示例12: matchPath
import org.apache.tools.ant.types.selectors.SelectorUtils; //导入方法依赖的package包/类
/**
* Tests whether or not a given path matches a given pattern.
*
* @param pattern The pattern to match against. Must not be
* <code>null</code>.
* @param str The path to match, as a String. Must not be
* <code>null</code>.
*
* @return <code>true</code> if the pattern matches against the string,
* or <code>false</code> otherwise.
*/
protected static boolean matchPath(String pattern, String str) {
return SelectorUtils.matchPath(pattern, str);
}