Class PackageNameMatcher
- java.lang.Object
-
- org.eclipse.tycho.extras.docbundle.PackageNameMatcher
-
public class PackageNameMatcher extends java.lang.Object
An utility class for filtering package names.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
description
private java.util.List<java.util.regex.Pattern>
patterns
-
Constructor Summary
Constructors Modifier Constructor Description private
PackageNameMatcher(java.util.List<java.util.regex.Pattern> patterns)
Constructs a new object which matches against the given patterns.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Method Detail
-
compile
public static PackageNameMatcher compile(java.util.List<java.lang.String> specs)
Compiles the given list of package name specification strings into a matching object.If the list is empty, the resulting object will never match any package name, which means that
matches(String)
will always returnfalse
.- Parameters:
specs
- The list of package name specifications. For details on specification syntax see#compile(String)
.- Returns:
- A new matching object.
- Throws:
java.lang.IllegalArgumentException
- Thrown if the given argument isnull
or if any of the strings in the list is an invalid package name specification.
-
buildPattern
private static java.util.regex.Pattern buildPattern(java.lang.String spec)
-
buildDescription
private java.lang.String buildDescription()
-
matches
public boolean matches(java.lang.String packageName)
Returns true if the given package name matches against any of the patterns in this matcher.- Returns:
- Always
false
if the given package name isnull
or an empty string.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-