Package org.eclipse.jetty.webapp
Class ClasspathPattern
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<String>
-
- org.eclipse.jetty.webapp.ClasspathPattern
-
public class ClasspathPattern extends AbstractSet<String>
Classpath classes list performs pattern matching of a class name against an internal array of classpath 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 Classes Modifier and Type Class Description static classClasspathPattern.ByClassstatic classClasspathPattern.ByLocationstatic classClasspathPattern.ByLocationOrModulestatic classClasspathPattern.ByModulestatic classClasspathPattern.ByPackagestatic classClasspathPattern.ByPackageOrName
-
Constructor Summary
Constructors Constructor Description ClasspathPattern()ClasspathPattern(String pattern)ClasspathPattern(String[] patterns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(String pattern)booleanadd(String... pattern)protected booleanadd(org.eclipse.jetty.webapp.ClasspathPattern.Entry entry)voidclear()booleanexclude(String name)booleanexclude(String... name)String[]getPatterns()booleaninclude(String name)booleaninclude(String... name)Iterator<String>iterator()booleanmatch(Class<?> clazz)Match the class name against the patternbooleanmatch(String name)Match the class name against the patternbooleanmatch(String name, URL url)protected org.eclipse.jetty.webapp.ClasspathPattern.EntrynewEntry(String pattern)protected org.eclipse.jetty.webapp.ClasspathPattern.EntrynewEntry(String name, boolean inclusive)booleanremove(Object o)intsize()-
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
-
-
-
-
Method Detail
-
include
public boolean include(String name)
-
include
public boolean include(String... name)
-
exclude
public boolean exclude(String name)
-
exclude
public boolean exclude(String... name)
-
add
public boolean add(String pattern)
- Specified by:
addin interfaceCollection<String>- Specified by:
addin interfaceSet<String>- Overrides:
addin classAbstractCollection<String>
-
add
public boolean add(String... pattern)
-
newEntry
protected org.eclipse.jetty.webapp.ClasspathPattern.Entry newEntry(String pattern)
-
newEntry
protected org.eclipse.jetty.webapp.ClasspathPattern.Entry newEntry(String name, boolean inclusive)
-
add
protected boolean add(org.eclipse.jetty.webapp.ClasspathPattern.Entry entry)
-
remove
public boolean remove(Object o)
- 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>
-
size
public int size()
- Specified by:
sizein interfaceCollection<String>- Specified by:
sizein interfaceSet<String>- Specified by:
sizein classAbstractCollection<String>
-
getPatterns
public String[] getPatterns()
- Returns:
- array of classpath patterns
-
match
public boolean match(String name)
Match the class name against the pattern- Parameters:
name- name of the class to match- Returns:
- true if class matches the pattern
-
match
public boolean match(Class<?> clazz)
Match the class name against the pattern- Parameters:
clazz- A class to try to match- Returns:
- true if class matches the pattern
-
-