Java Reference
In-Depth Information
14.1.12 AROUND
One of the more powerful features used in Xpand templates is the aspect-
oriented capabilities provided by the «AROUND» statement. Using «AROUND» , you
can augment templates noninvasively. This is convenient when you want to aug-
ment the capabilities of templates that you cannot or do not want to modify, or,
in the case of multiple products generated in a product line, when you seek to
avoid conditionals throughout your MDD artifacts. This is the general syntax of
«AROUND» :
« AROUND fullyQualifiedDefinitionName(parameterList)? FOR Type»
. . .
« ENDAROUND »
The aspect-oriented part is in the point cut fullyQualifiedDefinition
Name , which can contain wildcards ( * ). For example, mindmap::topic2csv::
csvFile can provide a fully qualified name, while mindmap::topic* can
match templates that begin with mindmap::topic .
Similarly, parameter types can be specified in our point cut. Types specified
are matched to their definition parameter type or super type. The wildcard ( * )
can be used in parameter lists as well. For example, you can use
mindmap::topic2csv::csv(String name) or mindmap::topic2csv::
csv(String name,*) if there might be additional parameters.
Consider some examples of «AROUND» definitions.
To match all templates:
« AROUND *(*) FOR Object»
To match all templates ending in topic and with any number of parameters:
« AROUND *topic(*) FOR Object»
To match all templates in the mindmap namespace that have no parameters
for MapElement types (including subclasses):
« AROUND mindmap::* FOR MapElement»
To match all templates with a single String parameter:
« AROUND *(String s) FOR Object»
Search WWH ::




Custom Search