The name matcher

The name matcher is the object allowing to reference classes or components by name using regular expressions. The original idea came from "Apache Ant" fileset definitions that proved to be very good compromise between ease of definition and power of use.

So, like Ant filesets, a "name matcher" contains a set of "include" and "exclude" patterns using "*", "**" and "?" wildcards. Like in Ant, the difference between "*", "**" is that the first excludes the 'hierarchy separator' (usually '.' or '/') while the second includes it. The meaning of the first is "any name in this package or component" while the second means "any name in this component/package or recursively in any sub-component/sub-package".

The "includes" defines a first subset of the total set of classes or component by selecting only those with names matching at least one of the include pattern. When there is no include pattern, the whole set is selected.

Then the "excludes" refine this set by eliminating all the classes or components matching at least one exclude pattern.

Matching classes

When matching classes, the patterns are evaluated against the full class name (with packages separated by dots). In this case the "**" wild card includes the dot and hence apply recursively to sub-packages while "*" select only in the current package.



The result set of will contain "net.sf.sfac.model.MainTest" (because it matches the "include" and doesn't match any exclude) but will not contain "net.sf.sfac.gui.MainPanel" (because it is matched by the first "exclude" pattern).

Matching components

When matching components, the patterns are evaluated against the full component name (which is composed of the component type and the component name separated by a semicolon) but also against hierarchical paths composed of the component name separated by slashes.



means: "any component included (directly or inderectly) in the 'GUI' layer".