-
Notifications
You must be signed in to change notification settings - Fork 8
Properties Code Generator
Plug-in developers can use the Properties Code Generator to generate Java types and retrieval methods for a property set. The generated Java classes can then be copied into an analysis plug-in and used during analysis to lookup property values.
Note that the generator is not part of the OSATE installation, it is available only when running OSATE from the development environment.
Within OSATE, right-click on a property set in the AADL Navigator and select Generate Java Property Getters. This will work for local property sets in the project as well as contributed property sets found under Plug-in Contributions. The generator will create a src-gen folder in the project which contains the property set and place all generated Java files in that folder.
Once generated, the Java files can be copied into a plug-in project in the Eclipse environment that is being used for OSATE plug-in development. This plugin will need to depend upon org.osate.aadl2
, org.osate.aadl2.modelsupport
, and org.osate.pluginsupport
.
By default, the generator will place all Java files into a Java package which has the name of the property set converted to lower case. This can be changed by specifying the Java package with @codegen-package
tag in a comment on the line directly above the property set declaration. For example, the following property set will have its Java files placed into a Java package called org.osate.aadl2.contrib.communication
:
-- @codegen-package org.osate.aadl2.contrib.communication
property set Communication_Properties is
...
end Communication_Properties;
The generator will create a Java file for each enumeration type, units type, and record type. It will also create a Java class with the same name as the property set. This class contains static methods corresponding to the individual properties of the property set which perform property lookup on a specified NamedElement
. For each property, there is a method generated which performs non-modal lookup and another method which will lookup the property for a specified Mode
. Each lookup method returns an Optional
which indicates if the property has been defined or remains undefined.
The generator was used to generate Java classes for the predeclared property sets. These classes are in plugin org.osate.aadl2.contrib
.