Part 2: Creating the Audit Class
This part of the tutorial shows how to define
a new audit class to use the Together API.
The easiest way to create an audit is to define a class that extends com.togethersoft.sca.plugin.audit.AuditRule. The AuditRule class contains stubs for the necessary check methods for the audit logic.
- Create a class on the CustomAudit diagram. Name it EmptyMethodRule.
- Select the class on the diagram. In the Properties
View, click the extends field.
- At the right of that field, click the
Selection dialog button to open the Selection dialog.
- Locate com.togethersoft.sca.plugin.audit.AuditRule
from the Model elements on the left, and click Add to add it to the
Selected list on the right. Your Selection dialog should look like
the one shown below:
- Click OK.
- The declaration of EmptyMethodRule is correct, but the class is missing two required methods. Right click on the class and choose Add Constructors from Superclass. You will modify this constructor later.
-
Right click on the class and choose Override Methods. This opens the Override Methods dialog.
- Check checkMethod(AstMethod) as shown below.
Then click OK.

When Together runs your audit, it automatically calls checkMethod(AstMethod)
for each method in every class and interface. The actual method is one of
the parameters.
- Go to the editor to see the resulting EmptyMethodRule code. If the editor indicates a syntax error, right click the source code and choose Source > Organize Imports.
- Save the EmptyMethodRule.java file.