Class ClassMatcher

All Implemented Interfaces:
Iterable<String>, Collection<String>, Set<String>
Direct Known Subclasses:
ClassMatcher

public class ClassMatcher extends AbstractSet<String>
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.
When class is initialized from a classpath pattern string, entries in this string should be separated by ':' (semicolon) or ',' (comma).