-
Notifications
You must be signed in to change notification settings - Fork 0
1. Intermediate Model
The intermediate model is an tree structure that contains all extracted information about a Java project. Every intermediate model has an instance of the class IntermediateModel
. It contains alle the elements of the model. The tree structure starts with an ExtractedPackage
as root package, which can be accessed from the IntermediateModel
instance.
An intermediate model should be accessed through its instance of the class IntermediateModel
. The method getRoot()
grants access to the root package. Because of the tree structure of the model, all components of the model can be accessed through the root package (with the methods getClasses()
, getInterfaces()
, getEnumerations()
, getTypes()
and getSubpackages()
).
Another way to access the elements of the model is to use the methods getPackage()
and getType()
. These methods take the name of the desired package/type and return the package/type object itself. If there is no package/type with that name in the model, a IllegalArgumentException
gets thrown.
Intermediate models can be created with the JavaProjectParser
or by hand. To allow the second option, creating them by hand, the constructors of the intermediate models classes use Strings input instead of complex Objects. To learn about using the class JavaProjectParser
see the section about the parser.
To create an intermediate model by hand you need to follow these steps:
- Create an instance of the class
IntermediateModel
. The constructor takes a project name as a parameter. Normally, this is the name of the project where the model was extracted from. The project name is metadata for the metamodel generation. - Create the packages of the intermediate model one by one. Use the full package names (e.g
main.view.secondary
). - Add the packages to the class
IntermediateModel
. The first package will be automatically set as root. Every following package will automatically assigned to its superpackage according to its full name. - Create the extracted types one by one. For every class, create its methods and attributes by hand and add them to the class. Use the full class name (e.g
main.view.secondary.SomeCLass
). If you want so simulate an inner class use the naming schemepackage.OuterClass$InnerClass
. - Add the extracted types to the class
IntermediateModel
. When using the methodadd()
, the classes will be added to their packages according to their full name. When using the methodaddTo()
, you can manually add them to a specific package. - Keep in mind that there is no automatic adding of methods and attributes to their extracted types.