Source code generation tool for ABAP and Hybris

ABAP

There are two ways, one is ABAP Code Composer, details can be found in my blog Step by Step to generate ABAP code automatically using Code Composer

Or use another local method, directly prepare the source code of the class or report to be generated, fill it in an inner table (mt_source in the example below), and then use the keyword GENERATE to generate:

For a specific usage scenario of this approach, refer to my blog Simulate Mockito in ABAP

Hubris

The open source framework Velocity is used :

Finally, the source code we observed in the Hybris installation package is generated based on a template file, the specific location: global-beantemplate.vm

The following figure is an example of a template file, in which the blue box is static content, and the red box is the placeholder, which will be replaced with the corresponding value during ant build.

This is the final generated .java file based on the above template file. You can compare the template file with the image above to see how the placeholders are replaced with corresponding values.

To get more Jerry's original technical articles, please follow the public account "Wang Zixi" or scan the QR code below:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324392533&siteId=291194637