Package org.eclipse.jetty.webapp
Class ClassMatcher
A matcher for classes based on package and/or location and/or module/
Performs pattern matching of a class against a set of pattern entries. A class pattern is a string of one of the forms:
- 'org.package.SomeClass' will match a specific class
- 'org.package.' will match a specific package hierarchy
- 'org.package.SomeClass$NestedClass ' will match a nested class exactly otherwise. Nested classes are matched by their containing class. (eg. org.example.MyClass matches org.example.MyClass$AnyNestedClass)
- 'file:///some/location/' - A file system directory from which the class was loaded
- 'file:///some/location.jar' - The URI of a jar file from which the class was loaded
- 'jrt:/modulename' - A Java9 module name
- Any of the above patterns preceded by '-' will exclude rather than include the match.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static class
-
Constructor Summary
ConstructorDescriptionClassMatcher
(String pattern) ClassMatcher
(String... patterns) ClassMatcher
(ClassMatcher patterns) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
protected boolean
add
(ClassMatcher.Entry entry) void
clear()
boolean
boolean
String[]
String[]
String[]
boolean
boolean
iterator()
boolean
Match the class name against the patternboolean
Match the class name against the patternboolean
protected ClassMatcher.Entry
protected ClassMatcher.Entry
boolean
int
size()
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
addAll, contains, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
ClassMatcher
public ClassMatcher() -
ClassMatcher
-
ClassMatcher
-
ClassMatcher
-
-
Method Details
-
include
-
include
-
exclude
-
exclude
-
add
- Specified by:
add
in interfaceCollection<String>
- Specified by:
add
in interfaceSet<String>
- Overrides:
add
in classAbstractCollection<String>
-
add
-
add
-
newEntry
-
newEntry
-
remove
- Specified by:
remove
in interfaceCollection<String>
- Specified by:
remove
in interfaceSet<String>
- Overrides:
remove
in classAbstractCollection<String>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<String>
- Specified by:
clear
in interfaceSet<String>
- Overrides:
clear
in classAbstractCollection<String>
-
iterator
-
size
public int size()- Specified by:
size
in interfaceCollection<String>
- Specified by:
size
in interfaceSet<String>
- Specified by:
size
in classAbstractCollection<String>
-
getPatterns
- Returns:
- array of classpath patterns
-
getInclusions
- Returns:
- array of inclusive classpath patterns
-
getExclusions
- Returns:
- array of excluded classpath patterns (without '-' prefix)
-
match
Match the class name against the pattern- Parameters:
name
- name of the class to match- Returns:
- true if class matches the pattern
-
match
Match the class name against the pattern- Parameters:
clazz
- A class to try to match- Returns:
- true if class matches the pattern
-
match
-