Accessing the AST of a OAW checks file
It’s easy to parse and access the AST of an OAW checks file using the infrastructure provided:
/**
* Copied from
* {@link org.openarchitectureware.check.CheckFacade#checkAll(String, InputStream, Collection<?>, ExecutionContext, Issues, boolean)}
*/
public void test1() throws Exception {
String checkFile = "src/metamodel/Checks.chk";
InputStream in = new FileInputStream(checkFile);
ExtensionFile file = ParseFacade.file(new InputStreamReader(in), checkFile);
for (Check check : file.getChecks()) {
System.out.println("Message: " + check.getMsg());
System.out.println("Constraint: " + check.getConstraint()); // abstract class Expression
}
}
This was implemented in revision 1007 of IAML.