Package com.facebook.buck.util
Class PatternsMatcher
- java.lang.Object
-
- com.facebook.buck.util.PatternsMatcher
-
public class PatternsMatcher extends Object
Helper class that keeps a list of compiled patterns and provides a method to check whether a string matches at least one of them.
-
-
Field Summary
Fields Modifier and Type Field Description static PatternsMatcher
ANY
A pattern which patches any stringstatic PatternsMatcher
NONE
A pattern which matches no string
-
Constructor Summary
Constructors Constructor Description PatternsMatcher(com.google.common.collect.ImmutableSet<Pattern> compiledPatterns)
PatternsMatcher(Collection<String> rawPatterns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> Map<String,V>
filterMatchingMapKeys(Map<String,V> entries)
boolean
isMatchesAny()
boolean
isMatchesNone()
boolean
matches(String string)
boolean
substringMatches(String string)
-
-
-
Field Detail
-
ANY
public static final PatternsMatcher ANY
A pattern which patches any string
-
NONE
public static final PatternsMatcher NONE
A pattern which matches no string
-
-
Constructor Detail
-
PatternsMatcher
public PatternsMatcher(Collection<String> rawPatterns)
-
PatternsMatcher
public PatternsMatcher(com.google.common.collect.ImmutableSet<Pattern> compiledPatterns)
-
-
Method Detail
-
matches
public boolean matches(String string)
- Returns:
- true if the given string matches some of the patterns
-
substringMatches
public boolean substringMatches(String string)
- Returns:
- true if a substring of the given string matches some of the patterns or there are no patterns
-
isMatchesAny
public boolean isMatchesAny()
- Returns:
- true if this pattern matches any string
-
isMatchesNone
public boolean isMatchesNone()
- Returns:
- true if no string matches this pattern
-
-