Eureka AIR delivers breakthrough ideas for toughest innovation challenges, trusted by R&D personnel around the world.

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 operating environment restrictions, high script writing requirements, and not a solution, so as to improve production efficiency, improve versatility and Ease of use effect

Active Publication Date: 2014-01-08
FUJIAN YIRONG INFORMATION TECH +2
View PDF9 Cites 39 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
  • Code generation method and device based on maven plug-in and freemarker template
  • Code generation method and device based on maven plug-in and freemarker template
  • 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

The invention discloses a code generation method and device based on a maven plug-in and a freemarker template. The method comprises the steps that data and the template are prepared, namely, .hbm.xml files are written or generated according to a data base design file or a data base table, and the template is written according to the characteristics of items and freemarker template grammar; the maven plug-in is called to carry out the logical operation to generate codes, namely, the maven plug-in which encapsulates arithmetic logic generated by the codes is called, and logic operation and code generation are carried out according to the .hbm.xml files prepared in the first step and freemarker template files; the codes are generated, namely, macro is applied to the code template to generate a target code of an MVC three-layer structure. The code generation method and device based on the maven plug-in and the freemarker template solve the problem that duplicated codes are automatically generated in the developing process, and can be customized under the actual condition according to the template and improve production efficiency; because automatic code generation and a common construction tool maven are bound, the universality and the usability of the device are improved.

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
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
Eureka Blog
Learn More
PatSnap group products