public class PackageNameMatcher
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
description |
private java.util.List<java.util.regex.Pattern> |
patterns |
Modifier | Constructor and Description |
---|---|
private |
PackageNameMatcher(java.util.List<java.util.regex.Pattern> patterns)
Constructs a new object which matches against the given patterns.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
buildDescription() |
private static java.util.regex.Pattern |
buildPattern(java.lang.String spec) |
static PackageNameMatcher |
compile(java.util.List<java.lang.String> specs)
Compiles the given list of package name specification strings into a matching object.
|
boolean |
matches(java.lang.String packageName)
Returns true if the given package name matches against any of the patterns in this matcher.
|
java.lang.String |
toString() |
private final java.util.List<java.util.regex.Pattern> patterns
private final java.lang.String description
private PackageNameMatcher(java.util.List<java.util.regex.Pattern> patterns)
patterns
- public static PackageNameMatcher compile(java.util.List<java.lang.String> specs)
If the list is empty, the resulting object will never match any package name, which means
that matches(String)
will always return false
.
specs
- The list of package name specifications. For details on specification syntax see
#compile(String)
.java.lang.IllegalArgumentException
- Thrown if the given argument is null
or if any of the strings in the
list is an invalid package name specification.private static java.util.regex.Pattern buildPattern(java.lang.String spec)
private java.lang.String buildDescription()
public boolean matches(java.lang.String packageName)
false
if the given package name is null
or an empty
string.public java.lang.String toString()
toString
in class java.lang.Object