Decycle uses a special pattern syntax that was inspired by Apache Ant
for matching fully qualified class names. A typical decycle pattern looks like this:
com.example.app.**
?
matches exactly one name character (but not dots)*
matches zero or more name characters (but not dots)**
matches zero or more dots and name characters.
matches only itself (the dot)|
separates alternatives(
and)
can be used to surround sub-patterns (for example alternatives)
A name character is a character that may be used in names of Java classes,
i.e. usually letters, digits, the underscore _
, and in particular the dollar symbol $
.
Note: Decycle looks at the byte code and matches the class names created by the compiler.
For example, the inner interface java.util.Map.Entry
becomes java.util.Map$Entry
.
com.example.?oo
matchescom.example.Foo
andcom.example.Zoo
(it doesn't matchcom.example.oo
andcom.example.bar.Taboo
)com.example.*
matchescom.example.Foo
andcom.example.Bar
(it doesn't matchcom.example.bar.Foo
)com.example.B*
matchescom.example.B
,com.example.Bar
, andcom.example.Bar$Inner
com.example.**
matchescom.example.Foo
andcom.example.bar.baz.Qux
com.example.**.Foo
matchescom.example.bar.Foo
andcom.example.bar.baz.Foo
(however, it doesn't matchcom.example.Foo
– this is different from Ant's**
handling)com.example.*.**
matchescom.example.bar.Foo
andcom.example.bar.baz.Foo
(but it doesn't matchcom.example.Foo
)com.example.(bar|baz).Foo
matches onlycom.example.bar.Foo
andcom.example.baz.Foo
Patterns that are used for the configuration of slicings have an extended syntax.
A named pattern uses the form pattern=name
. In this case the assigned
name defines the name of the slice.
An unnamed pattern should also contain one pair of curly braces (e.g. com.example.{*}.**
).
The matched substring within the curly braces defines the name of the slice.