A com.nomagic.magicdraw.ce.CodeEngineeringSet object represents a code-engineering object as a resource for forward or reverse engineering.

Each CodeEngineeringSet provides properties, which can be read:

  • Name. Represents a name of the code engineering set, visible in the Browser.
  • Model elements. Represents elements that are added into the code engineering set from the model.
  • Working directory. Represents a code engineering directory where generated/reversed files are located. 

Forward Engineering

To perform the code generation, elements should be added to the CodeEngineeringSet object. Use the CodeEngineeringSet.addElementsToCodeEngineeringSet(java.util.List<BaseElement>) method to add a list of model elements to the code engineering set.

Model elements should be in the working package, otherwise the model element is not be added to the code engineering set. The working package is set when creating a code engineering set.

Reverse Engineering

Source code files are required to perform the Reverse Engineering. There are 2 methods available for adding files into the code engineering set:

  1. CodeEngineeringSet.addFilesToCodeEngineeringSet(java.util.List<java.io.File>)This method adds the given list of files to the code engineering set.
  2. CodeEngineeringSet.addAllFilesRecursivelyToCES(java.io.File)This method adds all specific source code files to the code engineering set, starting from the given directory.

 Source code files should be in the working directory, in order to have the successful reverse.