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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionClassMatcher(String pattern) ClassMatcher(String... patterns) ClassMatcher(ClassMatcher patterns) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanprotected booleanadd(ClassMatcher.Entry entry) voidclear()booleanbooleanString[]String[]String[]booleanbooleaniterator()booleanMatch the class name against the patternbooleanMatch the class name against the patternbooleanprotected ClassMatcher.Entryprotected ClassMatcher.Entrybooleanintsize()Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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:
addin interfaceCollection<String>- Specified by:
addin interfaceSet<String>- Overrides:
addin classAbstractCollection<String>
-
add
-
add
-
newEntry
-
newEntry
-
remove
- Specified by:
removein interfaceCollection<String>- Specified by:
removein interfaceSet<String>- Overrides:
removein classAbstractCollection<String>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<String>- Specified by:
clearin interfaceSet<String>- Overrides:
clearin classAbstractCollection<String>
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<String>- Specified by:
sizein interfaceSet<String>- Specified by:
sizein 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
-