Class NamePattern
java.lang.Object
org.tentackle.maven.plugin.mcp.render.NamePattern
Matches names by substring, glob, or regular expression.
Which of the three a caller wants is obvious from what it wrote, so it is derived rather than configured:
a regex: prefix selects a regular expression, a * or ? selects a glob, anything else
is a case-insensitive substring.
- Author:
- harald
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NamePatternMatches everything.static final StringThe prefix selecting a regular expression. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
REGEX_PREFIX
-
ANY
Matches everything.
-
-
Constructor Details
-
NamePattern
Creates a pattern.- Parameters:
text- the pattern text, null or empty to match everything- Throws:
IllegalArgumentException- if a regular expression is malformed
-
-
Method Details
-
matches
Returns whether a name matches.- Parameters:
name- the name; may be null- Returns:
- true if it matches
-
isAny
public boolean isAny()Returns whether this pattern matches everything.- Returns:
- true if unrestricted
-
toString
-