CN117215536A - Interface code creation method, device, equipment and storage medium - Google Patents

Interface code creation method, device, equipment and storage medium Download PDF

Info

Publication number
CN117215536A
CN117215536A CN202311168464.9A CN202311168464A CN117215536A CN 117215536 A CN117215536 A CN 117215536A CN 202311168464 A CN202311168464 A CN 202311168464A CN 117215536 A CN117215536 A CN 117215536A
Authority
CN
China
Prior art keywords
interface
target
preset
interface code
java class
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311168464.9A
Other languages
Chinese (zh)
Inventor
冉荣健
凌利虎
吴迪
张超超
邢婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yiqi Xufu Network Technology Co ltd
Original Assignee
Yiqi Xufu Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yiqi Xufu Network Technology Co ltd filed Critical Yiqi Xufu Network Technology Co ltd
Priority to CN202311168464.9A priority Critical patent/CN117215536A/en
Publication of CN117215536A publication Critical patent/CN117215536A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The application discloses an interface code creation method, a device, equipment and a storage medium, which relate to the field of software development and comprise the following steps: determining a target Java class file of an interface code to be generated by triggering a preset interface code generation plug-in an integrated development environment; determining a target interface corresponding to a target Java class file in an integrated development environment by using a preset interface code generation plug-in, and determining a text mark document of the target interface; traversing the text markup document by using a preset interface code to generate an insert, and analyzing character strings of the text markup document to obtain interface definitions corresponding to the target interfaces; and extracting interface metadata in the interface definition, and generating an interface code corresponding to the target Java class file according to the interface metadata. The application is based on the plug-in technology of the integrated development environment, and can quickly and automatically generate the interface code by analyzing the interface definition in the MarkDown document, thereby ensuring the correctness of the code and saving the development time.

Description

Interface code creation method, device, equipment and storage medium
Technical Field
The present application relates to the field of software development, and in particular, to a method, an apparatus, a device, and a storage medium for creating an interface code.
Background
In a software project, it is often necessary to perform interface design first, and then complete development according to the design, where a developer is required to convert interface definitions in a design document into Java code. However, in the development process, the developer needs to spend a lot of time and effort to convert, and the converted process is mechanical, tedious and inefficient, and needs to be processed through continuous copy and paste. This results in a very error-prone process, which results in errors in the manual conversion process, resulting in code Bug. Therefore, how to quickly and accurately perform the conversion of interface definitions is a problem to be solved in the art.
Disclosure of Invention
Accordingly, the present application is directed to a method, apparatus, device, and storage medium for creating an interface code, which can automatically and rapidly generate an interface code by analyzing an interface definition in a Markdown document based on a plug-in technology of an integrated development environment, thereby ensuring the correctness of the code and saving the development time. The specific scheme is as follows:
in a first aspect, the present application provides an interface code creation method, including:
acquiring a plug-in triggering instruction to trigger a preset interface code generation plug-in an integrated development environment, and determining a target Java class file of an interface code to be generated through the preset interface code generation plug-in;
determining a target interface corresponding to the target Java class file in the integrated development environment by using the preset interface code generation plug-in, and determining a text mark document of the target interface;
traversing the text markup document by using the preset interface code generating plug-in, and analyzing the character strings of the text markup document to obtain interface definitions corresponding to the target interfaces;
and extracting the interface metadata in the interface definition, and generating an interface code corresponding to the target Java class file according to the interface metadata.
Optionally, the obtaining a plug-in triggering instruction includes:
and creating a function shortcut key corresponding to the preset interface code generation plug-in, and acquiring a plug-in trigger instruction corresponding to the function shortcut key.
Optionally, before determining the target Java class file of the interface code to be generated, the method further includes:
acquiring a file creation instruction, creating a blank Java class file according to the file creation instruction, and taking the blank Java class file as a target Java class file;
or, acquiring a file opening instruction, opening an existing Java class file in the integrated development environment according to the file opening instruction, and taking the existing Java class file as a target Java class file.
Optionally, the extracting the interface metadata in the interface definition includes:
and extracting texts after the titles in the character strings of the text mark document according to a preset text extraction rule, and taking the texts as the interface metadata.
Optionally, the extracting the interface metadata in the interface definition includes:
extracting texts after titles in character strings of the text markup document according to the preset text extraction rules, and generating a parameter table according to the texts;
analyzing parameters in the parameter table according to a preset table analysis function, and generating interface metadata according to analysis results.
Optionally, the parsing the parameters in the parameter table according to the preset table parsing function, and generating the interface metadata according to the parsing result includes:
traversing the attribute rows in the parameter table, and traversing the attribute rows for analysis so as to take the attribute items in the attribute rows as a content array;
interface metadata is generated from elements in the content array.
Optionally, the generating, according to the interface metadata, an interface code corresponding to the target Java class file includes:
splicing the interface metadata to generate an interface code corresponding to the target Java class file;
or reading a preset template file, and providing an interface code corresponding to the target Java class file for a template engine according to the template content of the preset template file and the interface metadata.
In a second aspect, the present application provides an interface code creation apparatus comprising:
the file determining module is used for acquiring a plug-in triggering instruction to trigger a preset interface code generating plug-in the integrated development environment, and determining a target Java class file of the interface code to be generated through the preset interface code generating plug-in;
the document determining module is used for determining a target interface corresponding to the target Java class file in the integrated development environment by utilizing the preset interface code generating plug-in, and determining a text mark document of the target interface;
the document analysis module is used for utilizing the preset interface code to generate an insert to traverse the text markup document and analyzing the character string of the text markup document to obtain the interface definition corresponding to the target interface;
and the code generation module is used for extracting the interface metadata in the interface definition and generating the interface code corresponding to the target Java class file according to the interface metadata.
In a third aspect, the present application provides an electronic device comprising a processor and a memory; wherein the memory is used for storing a computer program which is loaded and executed by the processor to implement the aforementioned interface code creation method.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which when executed by a processor implements the aforementioned interface code creation method.
The method comprises the steps of acquiring a plug-in triggering instruction to trigger a preset interface code generation plug-in an integrated development environment, and determining a target Java class file of an interface code to be generated through the preset interface code generation plug-in; determining a target interface corresponding to the target Java class file in the integrated development environment by using the preset interface code generation plug-in, and determining a text mark document of the target interface; traversing the text markup document by using the preset interface code generating plug-in, and analyzing the character strings of the text markup document to obtain interface definitions corresponding to the target interfaces; and extracting the interface metadata in the interface definition, and generating an interface code corresponding to the target Java class file according to the interface metadata. Therefore, java codes are generated by analyzing the documents in the MarkDown form, so that code Bug caused by errors in the manual conversion process is avoided, and the accuracy and the effectiveness of the codes can be ensured. Meanwhile, the time for a developer to write codes according to the document can be saved, and the working efficiency of the developer is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an interface code creation method provided by the application;
FIG. 2 is a schematic diagram of a text markup document conversion provided by the present application;
FIG. 3 is a flowchart of a specific method for creating an interface code according to the present application;
FIG. 4 is a schematic diagram of a text markup document depicting an interface provided by the present application;
FIG. 5 is a schematic diagram of an interface code creation device according to the present application;
fig. 6 is a block diagram of an electronic device according to the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The developer is required in the software project to translate the interface definitions in the design document into Java code. However, in the development process, a developer needs to spend a great deal of time and effort to convert, which easily causes errors in the manual conversion process and causes code Bug. The Java code is generated by analyzing the document in the MarkDown form, so that code Bug caused by errors in the manual conversion process is avoided, the accuracy and the effectiveness of the code can be ensured, meanwhile, the time for a developer to write the code according to the document can be saved, and the working efficiency of the developer is improved.
Referring to fig. 1, an embodiment of the present application discloses an interface code creation method, including:
and S11, acquiring a plug-in triggering instruction to trigger a preset interface code generation plug-in the integrated development environment, and determining a target Java class file of the interface code to be generated through the preset interface code generation plug-in.
In this embodiment, the corresponding interface is generated through the IDE (Integrated Development Environment ) text markup document, and it is understood that it is first necessary to determine Java class files that need to generate the text markup document. Therefore, the embodiment can trigger the preset interface code in the integrated development environment to generate the plug-in function through the shortcut key. Firstly, creating a preset interface code to generate a function shortcut key corresponding to the plug-in, and acquiring a plug-in trigger instruction corresponding to the function shortcut key. And triggering a plug-in function through the instruction to select a file corresponding to the interface belonging to the target Java class. Therefore, the present embodiment may first determine, through the preset interface code generation plug-in, the target Java class file to be generated with the interface code. Specifically, in one embodiment, a file creation instruction may be acquired, a blank Java class file is created in an integrated development environment according to the file creation instruction, and the blank Java class file is used as a target Java class file; in another embodiment, a file opening instruction is acquired, an existing Java class file in the integrated development environment is opened according to the file opening instruction, and the existing Java class file is used as a target Java class file.
And step S12, determining a target interface corresponding to the target Java class file in the integrated development environment by using the preset interface code generation plug-in, and determining a text mark document of the target interface.
In this embodiment, a target interface corresponding to a target Java class file in an integrated development environment may be determined by using a preset interface code generating plug-in, and a text markup document of the target interface may be selected. It will be appreciated that the text markup document referred to above, markdown, is a lightweight markup language having plain text format syntax, and rich text documents can be written in plain text format that is easy to read and write. In Markdown, the table uses "|" to separate different cells and "-" to separate headers and other rows.
It will be appreciated that in a software development lifecycle, a developer typically completes writing a design document, modifies the design document after review, and writes code according to the design document. In the design phase, the name of the interface, description information, incoming parameters, return parameters, etc. are required to be completed, and the information can be used as a part of the code. The application can analyze the interface design document in the MarkDown format through IDE plug-in technology and generate the interface code according to the content, thereby helping the developer to quickly complete the writing of the interface code.
And S13, utilizing the preset interface code to generate an insert to traverse the text markup document, and analyzing the character string of the text markup document to obtain the interface definition corresponding to the target interface.
In this embodiment, after selecting the text markup document, the plug-in may be generated by using a preset interface code to traverse the text markup document, and analyze the character string of the text markup document to obtain the interface definition corresponding to the target interface.
And S14, extracting interface metadata in the interface definition, and generating an interface code corresponding to the target Java class file according to the interface metadata.
In this embodiment, by extracting the interface metadata in the interface definition, the interface code corresponding to the target Java class file may be generated and stored according to the interface metadata. Through the above technical solution, as shown in fig. 2, in this embodiment, after an interface code is triggered in the IDE to generate an plugin, a Markdown file location is selected from a designated location, then all acquired Markdown files are traversed, and after the plugin parses the Markdown file location, a corresponding interface code is generated. Note that the procedure of generating a document of a Java interface in this embodiment is also applicable to the generation of interface documents of other languages. By analyzing the interface definition in the MarkDown document, the interface code file is automatically created, so that the time for generating the interface code by a developer can be greatly reduced, the productivity of the developer is liberated, and the developer is led to pay attention to the realization of the code logic, thereby improving the development efficiency of a research and development team and better meeting the rapid development of the service.
Through the technical scheme, the method acquires the plug-in trigger instruction to trigger the preset interface code generation plug-in the integrated development environment, and determines the target Java class file of the interface code to be generated through the preset interface code generation plug-in; determining a target interface corresponding to a target Java class file in an integrated development environment by using a preset interface code generation plug-in, and determining a text mark document of the target interface; traversing the text markup document by using a preset interface code to generate an insert, and analyzing character strings of the text markup document to obtain interface definitions corresponding to the target interfaces; and extracting interface metadata in the interface definition, and generating an interface code corresponding to the target Java class file according to the interface metadata. Thus, the accuracy and the effectiveness of the Java code can be ensured by analyzing the document in the MarkDown form to generate the Java code. Meanwhile, the time for a developer to write codes according to the document can be saved, the working efficiency of the developer is improved, and the online Bug and communication cost is reduced.
Based on the above embodiment, the present application can generate Java code by parsing a document in Markdown form, and next, a process of generating a corresponding code from a text markup document will be described in detail in this embodiment. Referring to fig. 3, the embodiment of the application discloses a specific method for creating an interface code, which comprises the following steps:
and S21, utilizing a preset interface code to generate an insert to traverse the text markup document, and analyzing the character strings of the text markup document to obtain interface definitions corresponding to the target interfaces.
And S22, extracting texts after the titles in the character strings of the text mark document according to preset text extraction rules, and taking the texts as the interface metadata.
In a specific embodiment, the interface document described by Markdown as shown in fig. 3 may extract text following a title in a character string of the text markup document according to a preset text extraction rule, and use the extracted text as the interface metadata. For example:
1) Locating the first secondary title "#", extracting characters after "#", taking the characters as the names of interfaces, and recording the names as apiName;
2) Locating the first three-level title "# #", extracting the text after "# #", taking the text as the signature of the interface, and marking the text as apiSignature;
3) The text of the line behind the "# # Description" is extracted as the Description of the interface and is recorded as apiDescription;
4) Locating to a three-level title "# # Path", extracting text in a line behind the "# # Path" as a URL Path of the interface, and marking the URL Path as apiPath;
5) The Method which is positioned to the three-level title "# # Method" and takes the text of the line behind the "# # Method" as an interface is marked as apiMethod;
6) The text of the line following the "# # parameters" is extracted as a starting point, and the text is taken as a table for entering the reference until the next blank line is ended. Calling a form analysis function to analyze the input parameters;
7) The text of the line following the three-level title "# # return" is extracted as a starting point until the next empty line is ended, and is used as a table for the out-of-reference. And calling a table analysis function to analyze the parameters.
Step S23, extracting texts after titles in character strings of the text mark documents according to the preset text extraction rules, and generating a parameter table according to the texts; analyzing parameters in the parameter table according to a preset table analysis function, and generating interface metadata according to analysis results.
In this embodiment, in another specific embodiment, the text after the title in the character string of the text markup document may be extracted according to a preset text extraction rule, and a parameter table may be generated according to the text, and then parameters in the parameter table may be parsed according to a preset table parsing function, and interface metadata may be generated according to the parsing result. It should be noted that the above embodiments are directed to the corresponding creation when VO classes are complex for the entrance and exit of the method. The specific process is as follows:
1) Obtaining a table of the out-going or in-going ginseng;
2) Skipping the first and second rows of the table, wherein the first row and the second row of the table are skipped;
3) Acquiring a third row to the end of the table, wherein all rows are attribute rows of the interface, recording all attribute items as propertyArray, and traversing the rows;
4) Analyzing the acquired attribute lines, and dividing the lines by using 'I' to obtain an array;
5) The first element of the array is an attribute name, which is recorded as a name;
6) The second element of the array is an attribute type and is marked as type;
7) The third element of the array is the attribute description, denoted desc.
It will be appreciated that the VO class, used for the presentation layer, may encapsulate all data of a given page (or component) for delivery to the front-end object. VO, a specific Java class, ends in a VO name, for the Controller layer in SpringMVC.
It should be noted that the preset table parsing function in the above steps is as follows: when analyzing parameters in a parameter table according to a preset table analysis function and generating interface metadata according to analysis results, firstly traversing attribute rows in the parameter table, traversing attribute rows for analysis, and taking attribute items in the attribute rows as a content array; interface metadata is then generated from the elements in the content array. It will be appreciated that the processing of the lines is complex in that the attributes nest the attributes. Thus requiring progressive scanning to establish parent-child relationships between attributes. Such as attribute name containing' "then this is denoted as nested sub-attribute according to" The number of's', judge father-son relation of these lines, if the current line matches to twice, the next line matches to three times, then the current line is the next line father attribute, the next line is the current line son attribute; and scanning line by line, if the line contains sub-attributes, representing the complex type of the line (not being the simple type of Integer, string), creating a corresponding VO class according to the type of the attribute, and traversing subsequent lines until all the sub-attributes are processed.
For example, userVO is a parent attribute, with a number of child attributes, including education, job; in contrast, reduction is also a parent attribute, with two child attributes, school and year. Similarly, job is a parent with two child properties, company and year. The parent property is a complex type for which corresponding classes, userVO, educationVO and JobVO, can be created.
Step S24, splicing the interface metadata to generate an interface code corresponding to the target Java class file; or reading a preset template file, and providing an interface code corresponding to the target Java class file for a template engine according to the template content of the preset template file and the interface metadata.
In the embodiment, the interface metadata are spliced to generate an interface code corresponding to the target Java class file; or reading a preset template file and providing an interface code corresponding to the target Java class file for the template engine according to the template content and the interface metadata of the preset template file.
According to the above scheme, it can be understood that after the metadata of the interface is obtained, the metadata can be spliced to form a code, and a template engine, such as a Velocity, can also be used to generate the interface code. Such as a vector template in the following format:
the template file content, namely the template content, can be obtained by reading the template file, then the interface code content is generated according to the template content and the interface metadata through a template engine, and the code content is written into the Java class file to finish interface generation.
The process of generating the VO class is similar to the interface code, and the VO class can be generated by using the following template:
for more specific processing in step S21, reference may be made to the corresponding content disclosed in the foregoing embodiment, and no further description is given here.
In this embodiment, a plug-in is generated by using a preset interface code to traverse the text markup document, and a character string of the text markup document is parsed to obtain an interface definition corresponding to the target interface. And extracting texts after the titles in the character strings of the text mark document according to preset text extraction rules, and taking the texts as the interface metadata. Or extracting texts after the titles in the character strings of the text mark document according to preset text extraction rules, and generating a parameter table according to the texts; and analyzing parameters in the parameter table according to a preset table analysis function, and generating interface metadata according to analysis results. Then splicing the interface metadata to generate an interface code corresponding to the target Java class file; or reading a preset template file and providing an interface code corresponding to the target Java class file for the template engine according to the template content and the interface metadata of the preset template file. In this embodiment, the interface metadata may be obtained by parsing the Markdown document of the interface, and the Java file content may be generated according to the template and the metadata. By analyzing the documents in the MarkDown form to generate Java codes, the accuracy and the effectiveness of the codes can be ensured. Meanwhile, the time for a developer to write codes according to the document can be saved, and the working efficiency of the developer is improved.
Referring to fig. 5, the embodiment of the application also discloses an interface code creation device, which comprises:
the file determining module 11 is configured to obtain a plug-in triggering instruction to trigger a preset interface code generating plug-in the integrated development environment, and determine a target Java class file of an interface code to be generated through the preset interface code generating plug-in;
a document determining module 12, configured to determine a target interface corresponding to the target Java class file in the integrated development environment by using the preset interface code generating plug-in, and determine a text markup document of the target interface;
the document analysis module 13 is configured to traverse the text markup document by using the preset interface code generation plug-in, and analyze a character string of the text markup document to obtain an interface definition corresponding to the target interface;
and the code generation module 14 is used for extracting the interface metadata in the interface definition and generating the interface code corresponding to the target Java class file according to the interface metadata.
In this embodiment, a plug-in triggering instruction is obtained to trigger a preset interface code generating plug-in an integrated development environment, and a target Java class file of an interface code to be generated is determined through the preset interface code generating plug-in; determining a target interface corresponding to a target Java class file in an integrated development environment by using a preset interface code generation plug-in, and determining a text mark document of the target interface; then using a preset interface code to generate an insert traversal text markup document, and analyzing character strings of the text markup document to obtain interface definitions corresponding to the target interfaces; and extracting interface metadata in the interface definition, and generating an interface code corresponding to the target Java class file according to the interface metadata. Through the technical scheme, the Java code is generated by analyzing the document in the MarkDown form, so that the accuracy and the effectiveness of the code can be ensured, the time for a developer to write the code according to the document can be saved, and the working efficiency of the developer is improved.
In some embodiments, the file determining module 11 specifically includes:
the instruction acquisition unit is used for creating a function shortcut key corresponding to the preset interface code generation plug-in and acquiring a plug-in trigger instruction corresponding to the function shortcut key.
In some specific embodiments, the file determining module 11 further includes:
the first file determining unit is used for acquiring a file creating instruction, creating a blank Java class file according to the file creating instruction, and taking the blank Java class file as a target Java class file;
and the second file determining unit is used for acquiring a file opening instruction, opening the existing Java class file in the integrated development environment according to the file opening instruction, and taking the existing Java class file as a target Java class file.
In some embodiments, the code generation module 14 specifically includes:
and the text extraction unit is used for extracting the text after the title in the character string of the text mark document according to a preset text extraction rule, and taking the text as the interface metadata.
In some embodiments, the code generation module 14 specifically includes:
a table generating unit, configured to extract a text after a title in a character string of the text markup document according to the preset text extraction rule, and generate a parameter table according to the text;
and the parameter analysis sub-module is used for analyzing parameters in the parameter table according to a preset table analysis function and generating interface metadata according to analysis results.
In some specific embodiments, the parameter analysis submodule specifically includes:
the attribute analysis unit is used for traversing the attribute rows in the parameter table and analyzing the attribute rows so as to take the attribute items in the attribute rows as a content array;
and the data generation unit is used for generating interface metadata according to the elements in the content array.
In some embodiments, the code generation module 14 specifically includes:
the first code generation unit is used for splicing the interface metadata to generate an interface code corresponding to the target Java class file;
and the second code generating unit is used for reading a preset template file and providing an interface code corresponding to the target Java class file for a template engine according to the template content of the preset template file and the interface metadata.
Further, the embodiment of the present application further discloses an electronic device, and fig. 6 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement the relevant steps in the interface code creation method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program capable of performing other specific tasks in addition to the computer program capable of performing the interface code creation method performed by the electronic device 20 as disclosed in any of the foregoing embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the interface code creation method disclosed previously. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has outlined rather broadly the more detailed description of the application in order that the detailed description of the application that follows may be better understood, and in order that the present principles and embodiments may be better understood; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. An interface code creation method, comprising:
acquiring a plug-in triggering instruction to trigger a preset interface code generation plug-in an integrated development environment, and determining a target Java class file of an interface code to be generated through the preset interface code generation plug-in;
determining a target interface corresponding to the target Java class file in the integrated development environment by using the preset interface code generation plug-in, and determining a text mark document of the target interface;
traversing the text markup document by using the preset interface code generating plug-in, and analyzing the character strings of the text markup document to obtain interface definitions corresponding to the target interfaces;
and extracting the interface metadata in the interface definition, and generating an interface code corresponding to the target Java class file according to the interface metadata.
2. The interface code creation method according to claim 1, wherein the acquiring a plug-in trigger instruction includes:
and creating a function shortcut key corresponding to the preset interface code generation plug-in, and acquiring a plug-in trigger instruction corresponding to the function shortcut key.
3. The method for creating an interface code according to claim 1, further comprising, before said determining a target Java class file for which the interface code is to be created:
acquiring a file creation instruction, creating a blank Java class file according to the file creation instruction, and taking the blank Java class file as a target Java class file;
or, acquiring a file opening instruction, opening an existing Java class file in the integrated development environment according to the file opening instruction, and taking the existing Java class file as a target Java class file.
4. The interface code creation method according to claim 1, wherein the extracting the interface metadata in the interface definition includes:
and extracting texts after the titles in the character strings of the text mark document according to a preset text extraction rule, and taking the texts as the interface metadata.
5. The interface code creation method according to claim 1, wherein the extracting the interface metadata in the interface definition includes:
extracting texts after titles in character strings of the text markup document according to the preset text extraction rules, and generating a parameter table according to the texts;
analyzing parameters in the parameter table according to a preset table analysis function, and generating interface metadata according to analysis results.
6. The method for creating an interface code according to claim 5, wherein said parsing parameters in said parameter table according to a preset table parsing function and generating interface metadata according to a parsing result comprises:
traversing the attribute rows in the parameter table, and traversing the attribute rows for analysis so as to take the attribute items in the attribute rows as a content array;
interface metadata is generated from elements in the content array.
7. The interface code creation method according to any one of claims 1 to 6, wherein the generating the interface code corresponding to the target Java class file from the interface metadata includes:
splicing the interface metadata to generate an interface code corresponding to the target Java class file;
or reading a preset template file, and providing an interface code corresponding to the target Java class file for a template engine according to the template content of the preset template file and the interface metadata.
8. An interface code creation apparatus, comprising:
the file determining module is used for acquiring a plug-in triggering instruction to trigger a preset interface code generating plug-in the integrated development environment, and determining a target Java class file of the interface code to be generated through the preset interface code generating plug-in;
the document determining module is used for determining a target interface corresponding to the target Java class file in the integrated development environment by utilizing the preset interface code generating plug-in, and determining a text mark document of the target interface;
the document analysis module is used for utilizing the preset interface code to generate an insert to traverse the text markup document and analyzing the character string of the text markup document to obtain the interface definition corresponding to the target interface;
and the code generation module is used for extracting the interface metadata in the interface definition and generating the interface code corresponding to the target Java class file according to the interface metadata.
9. An electronic device comprising a processor and a memory; wherein the memory is for storing a computer program that is loaded and executed by the processor to implement the interface code creation method of any of claims 1 to 7.
10. A computer readable storage medium for storing a computer program which when executed by a processor implements the interface code creation method of any of claims 1 to 7.
CN202311168464.9A 2023-09-11 2023-09-11 Interface code creation method, device, equipment and storage medium Pending CN117215536A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311168464.9A CN117215536A (en) 2023-09-11 2023-09-11 Interface code creation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311168464.9A CN117215536A (en) 2023-09-11 2023-09-11 Interface code creation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117215536A true CN117215536A (en) 2023-12-12

Family

ID=89040050

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311168464.9A Pending CN117215536A (en) 2023-09-11 2023-09-11 Interface code creation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117215536A (en)

Similar Documents

Publication Publication Date Title
CN108390773B (en) Method and equipment for dynamic routing of scaffold
US11423042B2 (en) Extracting information from unstructured documents using natural language processing and conversion of unstructured documents into structured documents
JP2020030818A (en) System and method for generating proposal based on request for proposal (rfp)
CN108664546B (en) XML data structure conversion method and device
CN112527291A (en) Webpage generation method and device, electronic equipment and storage medium
CN110308907B (en) Data conversion method and device, storage medium and electronic equipment
US7073122B1 (en) Method and apparatus for extracting structured data from HTML pages
CN106776779B (en) Method for generating entity file by JSON data based on Mac platform
CN109325217B (en) File conversion method, system, device and computer readable storage medium
CN115293124A (en) Automatic generation method and device for software engineering document
Dohrn et al. Design and implementation of wiki content transformations and refactorings
CN109582928B (en) PDF report data extraction method and device
CA2422490C (en) Method and apparatus for extracting structured data from html pages
CN117215536A (en) Interface code creation method, device, equipment and storage medium
US7725504B2 (en) Method and apparatus for helping user form structured diagram from unstructured information source
CN113971044A (en) Component document generation method, device, equipment and readable storage medium
CN114296726A (en) Code generation method and device, computer equipment and storage medium
CN111401005B (en) Text conversion method and device and readable storage medium
CN112667722A (en) Nuclear power station program file conversion method and equipment
Beaudoux et al. Using Model Driven Engineering technologies for building authoring applications
CN110618809B (en) Front-end webpage input constraint extraction method and device
CN111414330B (en) Data editing method and system, data processing device and storage medium
CN107273386B (en) XML Schema constraint file generation method and device for database
Sabo et al. Computer language notation specification through program examples
Steininger Content management for e-learning an integrated solution

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination