A code generation method and device based on maven plug-in and freemarker template

A code generation, java-like technology, applied in the field of code generation based on maven plug-ins and freemarker templates, can solve problems such as high scripting requirements, operating environment limitations, and not solutions, to improve versatility and ease of use, The effect of improving production efficiency

Active Publication Date: 2016-08-17
FUJIAN YIRONG INFORMATION TECH +2
View PDF9 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, in this device, a series of tasks such as calling the API interface library and generating codes are mainly performed through the execution of scripts. The requirements for scripting are relatively high, and the operating environment is limited, so it is not a more general solution.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A code generation method and device based on maven plug-in and freemarker template
  • A code generation method and device based on maven plug-in and freemarker template
  • A code generation method and device based on maven plug-in and freemarker template

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0033] The application scenarios of the present invention are as figure 1As shown, a code generation method and device based on the maven plug-in and freemarker template, input the relevant parameter rules of the code to be generated (basic package name, module name, and hbm.xml file name of the generated code), and edit the code template , so that the generated code meets the development requirements (such as a certain type of class using the same parent class). After preparing these parameters and templates, call the maven plug-in command to execute the parameters and template parsing process, and generate codes to the specified directory, then obtain the codes in the specified directory, move to the actual code environment, and modify the code Perform runtime inspections and custom modifications.

[0034] The main steps of the present invention are as figure 2 shown, including the following steps:

[0035] 1. Data preparation stage: mainly prepare the .hbm.xml file in h...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

A code generation method and device based on maven plug-ins and freemarker templates, including: preparing data and templates: writing or generating .hbm.xml files according to database design documents or database tables, writing templates according to project characteristics and freemarker template syntax; calling maven Steps for the plug-in to perform logic operations to generate code: call the maven plug-in that encapsulates the operation logic of code generation, perform logic operations and code generation according to the .hbm.xml file and freemarker template file prepared in the first step; code generation: apply the macro Generate the object code of the MVC three-tier architecture in the code template. The invention solves the problem of automatic generation of repetitive codes in the development process, and can carry out customization in actual conditions according to templates, which has a good effect on improving production efficiency. Binding automatic code generation and common build tool maven together improves the versatility and ease of use of the device.

Description

【Technical field】 [0001] The invention relates to the technical field of computer software, in particular to a code generation method and device based on a maven plug-in and a freemarker template. 【Background technique】 [0002] Computer experts have been looking for a way to make repeated code less and less, function encapsulation, object-oriented, AOP, MDA, ORM... all these related or unrelated technologies are trying to eliminate repeated code, but Along the way, people suddenly discovered that it is impossible to completely eliminate duplicate codes. At a higher level, there must be more advanced duplicate codes that we need to deal with, so code generation is gradually no longer demonized. Aren't these very important tools such as web page editors, compilers, and IDEs code generators? As long as the system is well designed, it is more practical to use a code generator to eliminate the remaining repetitive code than to use an academic method that seriously affects perfo...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Patents(China)
IPC IPC(8): G06F9/44
CPCG06F8/30
Inventor 倪时龙苏江文张垚王秋琳宋立华
Owner FUJIAN YIRONG INFORMATION TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products