Transformations give you almost unlimited control over the structure of your model. You can specify a number of expressions that modify the fully-qualified names of the classes in your project - in effect moving them to locations other than their actual locations in the code-base.

When would you want to do this? Basically any time that you think you'd like to see code with a different hierarchy. For example:

You define a Transformation using menu Project/Transformations and then specifying a number of "Match" and "Output" pairs. The syntax uses "*" to match one or more tokens or characters, and "?" to match exactly one token or character (a token being an element of a path, e.g. A and B and C in A.B.C). If you want to change the sequence of wildcards in the Match expression, you can use "{1}", "{2}" etc. in the Output expression. "{jar}" can be used in Output expressions and has the value of {jar} file from which an input item is derived.

Examples:

Match pattern Output pattern Result
*.Test* test.*.Test* Moves all classes whose local name starts with "Test" to a parallel hierarchy called "test"
com.foo.public.*
com.foo.private.*
com.foo.components.*
com.foo.components.*
Merges
com.foo.public.X and com.foo.private.X into com.foo.components.X and
com.foo.public.Y and com.foo.private.Y into com.foo.components.Y
com.foo.* * Removes com.foo from all names
*.? {2}.{1} Changes a.b.C to C.a.b
?.?.* {2}.{1}.{3} Changes a.b.C to b.a.C

Tip: