Collecting Annotation Pragmas
To create a collection of Pragma instances, send one of the allNamed:... location messages to Pragma. There are several forms, the simplest being allNamed:in: which takes an annotation pragma name and a class as arguments. For example, suppose the above doSomething and doSomethingElse methods are defined in a class, MyPragmaExample. To collect all the doStuff annotation pragmas, send:
Pragma allNamed: #doStuff in: MyPragmaExample
which will return a collection with two Pragma instances, one for the doStuff annotation pragma in each of the methods. Similarly,
Pragma allNamed: #doStuffWith:and: in: MyPragmaExample
returns a collection with a single Pragma instance. In this case, the annotation pragmas are in instance methods. If they were in class methods, the class argument would be: MyPragmaExample class.
This method searches for pragmas in only one class. Several of the other location methods search a branch of the class hierarchy, taking a start and end class for the search. For example, in
Pier, by sending an
allNamed:from:to: message, you can collect all
sanitize pragmas in methods between the receiving class and
PRContext (or whatever hierarchical sequence of classes you need to search):
Pragma allNamed: #sanitize from: self class to: PRContext
Browse the Pragma class methods for the full set of locating methods (“finding” category). Additional methods provide various sorting options on the collection of Pragma instances.
Last modified date: 01/29/2015