CN114138244A - Method and device for automatically generating model files, storage medium and electronic equipment - Google Patents

Method and device for automatically generating model files, storage medium and electronic equipment Download PDF

Info

Publication number
CN114138244A
CN114138244A CN202111466259.1A CN202111466259A CN114138244A CN 114138244 A CN114138244 A CN 114138244A CN 202111466259 A CN202111466259 A CN 202111466259A CN 114138244 A CN114138244 A CN 114138244A
Authority
CN
China
Prior art keywords
data
model
analyzing
type
webpage
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
CN202111466259.1A
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.)
Beijing Ziroom Information Technology Co Ltd
Original Assignee
Beijing Ziroom Information 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 Beijing Ziroom Information Technology Co Ltd filed Critical Beijing Ziroom Information Technology Co Ltd
Priority to CN202111466259.1A priority Critical patent/CN114138244A/en
Publication of CN114138244A publication Critical patent/CN114138244A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method and a device for automatically generating a model file, a storage medium and electronic equipment, wherein the method comprises the following steps: acquiring an interface document address; analyzing the webpage according to the interface document address to obtain a unique identifier; analyzing according to the unique identifier to obtain webpage data; and generating a model class file according to json data and annotation description information obtained by analyzing the webpage data. According to the automatic generation method of the model files, the corresponding model files can be automatically generated by inputting the interface document addresses, so that the method is convenient and quick, and the working efficiency is greatly improved; meanwhile, the annotation description information in the model files is automatically generated, so that the error rate is low; in addition, when updating iteration is carried out, only a new model class file needs to be automatically generated to replace an old file, and the writing workload is reduced.

Description

Method and device for automatically generating model files, storage medium and electronic equipment
Technical Field
The invention relates to the technical field of mobile internet, in particular to a method and a device for automatically generating a model file, a storage medium and electronic equipment.
Background
At present, in the process of code development, in order to develop conveniently and improve the readability and maintainability of codes, a corresponding model class needs to be created, and codes can be written by operating a model class object instead of directly operating complex data.
When each platform writes a model class, the following method is usually adopted: firstly, according to interface documents negotiated by front and back ends, manually writing codes and adding code annotation description information; and secondly, copying example data, converting the example data into model classes of different platforms by means of a json-to-model tool or a webpage gadget, and manually adding annotation description information. Thirdly, through the development tool IDE plug-in, json data is converted into corresponding models, and annotation description information needs to be added manually.
Therefore, if the model class is compiled by adopting the method, the model class needs to be manually created; the code needs to be written manually and the annotation description information needs to be written manually. When the existing mode is adopted to write the model class, most of models need to be realized in a manual mode, and the working efficiency is low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a storage medium, and an electronic device for automatically generating a model class file, so as to solve the technical problem in the prior art that the work efficiency is low when writing a model class.
The technical scheme provided by the invention is as follows:
a first aspect of an embodiment of the present invention provides a method for automatically generating a model class file, including: acquiring an interface document address; analyzing a webpage according to the interface document address to obtain a unique identifier; analyzing according to the unique identifier to obtain webpage data; and generating a model class file according to json data and annotation description information obtained by analyzing the webpage data.
Optionally, performing web page parsing according to the interface document address to obtain a unique identifier, including: judging the type of the website according to the interface document address; when the website type is a static type, acquiring the unique identifier according to the interface document address; and when the website type is a dynamic type, acquiring the unique identifier according to an automatic mode.
Optionally, obtaining the unique identifier according to an automated manner includes: automatically operating the interface document address according to a driving frame to obtain webpage code data; and analyzing the webpage code data according to a preset protocol to obtain the unique identifier.
Optionally, analyzing the obtained webpage data according to the unique identifier includes: and operating the label corresponding to the unique identifier according to the driving frame to obtain the markdown format webpage data.
Optionally, parsing the webpage data to obtain json data and a generated model class file of annotation description information, where the generating model class file includes: analyzing the webpage data to obtain json data; analyzing the json data according to a recursive algorithm to obtain attribute data of the model class and annotation description information corresponding to each attribute; and generating a model class file according to the annotation description information corresponding to each attribute and a preset model template.
Optionally, analyzing the json data according to a recursive algorithm to obtain attribute data of the model class and annotation description information corresponding to each attribute, including: analyzing by adopting a recursive algorithm according to the type of the json data to obtain each attribute data of the model type; analyzing the webpage data to obtain annotation description information; and obtaining the annotation description information corresponding to each attribute according to the attribute data and the annotation description information of the model class.
Optionally, analyzing by using a recursive algorithm according to the type of json data to obtain each attribute data of the model class, including: when the format of the json data is a character string type, generating attribute data of the model type according to the json data; when the format of the json data is a dictionary type, analyzing by adopting a recursive algorithm to analyze the character string type in the dictionary and generate each attribute data of the model type; and when the format of the json data is an array type, analyzing by adopting a recursive algorithm, reducing the array type into a dictionary type, and generating each attribute data of the model type by adopting an analysis mode of the dictionary type.
A second aspect of the embodiments of the present invention provides an apparatus for automatically generating a model class file, including: the address acquisition module is used for acquiring an interface document address; the analysis module is used for carrying out webpage analysis according to the interface document address to obtain a unique identifier; the identification analysis module is used for analyzing and obtaining webpage data according to the unique identification; and the model file generation module is used for generating a model file according to json data obtained by analyzing the webpage data and the annotation description information.
A third aspect of the embodiments of the present invention provides a computer-readable storage medium, where a computer instruction is stored, where the computer instruction is configured to enable a computer to execute the method for automatically generating a model class file according to any one of the first aspect and the first aspect of the embodiments of the present invention.
A fourth aspect of an embodiment of the present invention provides an electronic device, including: the automatic generation method of the model class file comprises a memory and a processor, wherein the memory and the processor are connected in a communication mode, the memory stores computer instructions, and the processor executes the computer instructions so as to execute the automatic generation method of the model class file according to the first aspect and any one of the first aspect of the embodiments of the invention.
The technical scheme provided by the invention has the following effects:
according to the method, the device, the storage medium and the electronic equipment for automatically generating the model files, provided by the embodiment of the invention, the interface document address is obtained; analyzing the webpage according to the interface document address to obtain a unique identifier; analyzing according to the unique identifier to obtain webpage data; and generating a model class file according to json data and annotation description information obtained by analyzing the webpage data. Therefore, the automatic generation method of the model files can automatically generate the corresponding model files by inputting the interface document addresses, is convenient and quick, and greatly improves the working efficiency; meanwhile, the annotation description information in the model files is automatically generated, so that the error rate is low; in addition, when updating iteration is carried out, only a new model class file needs to be automatically generated to replace an old file, and the writing workload is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow diagram of a method for automatic generation of model class files according to an embodiment of the invention;
FIG. 2 is a flow diagram of a method for automatic generation of model class files according to another embodiment of the present invention;
FIG. 3 is a flow diagram of a method for automatic generation of model class files according to another embodiment of the present invention;
FIG. 4 is a flow diagram of a method for automatic generation of model class files according to another embodiment of the present invention;
FIG. 5 is a block diagram of an apparatus for automatically generating a model class file according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a computer-readable storage medium provided according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As indicated in the background, model classes need to be written manually when using existing approaches. One of the compiling modes is that an interface document address is opened, json data is copied, a model code is generated by a three-party tool, the code generated by the three-party tool is copied and pasted into a project, and then corresponding annotation information is added to each data of the model. By adopting the writing mode, code writing needs to be carried out on one field and one field of the interface document. Therefore, the existing writing mode is complicated and the working efficiency is low. In addition, in the aspect of annotation information maintenance, the annotation description information needs to be copied after being compared with the interface document fields one by one, and the error rate is high. In addition, when the update occurs, whether each data of the interface document has change needs to be compared one by one, and the writing workload is increased.
In view of this, the embodiment of the present invention provides an automatic generation method for a model class file, so as to solve the technical problems in the prior art that the manual compiling of a model class has low working efficiency and a high error rate.
In accordance with an embodiment of the present invention, there is provided a method for automatic generation of model class files, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
In this embodiment, an automatic generation method for a model class file is provided, which may be used in electronic devices, such as a computer, a mobile phone, a tablet computer, and the like, fig. 1 is a flowchart of an automatic generation method for a model class file according to an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
step S101: and acquiring an interface document address. Specifically, the interface document address may be input by a user. For example, when a document needs to be converted into a model class file, the interface document address URL may be input into the electronic device, and the model class file may be generated by the electronic device through automatic parsing according to the interface document address.
Step S102: and analyzing the webpage according to the interface document address to obtain a unique identifier. After the electronic device obtains the interface document address, the electronic device may determine a webpage corresponding to the interface document address, and then parse the webpage corresponding to the interface document address to obtain a unique identifier of a webpage tag, or a real ID of the tag.
Step S103: and analyzing to obtain webpage data according to the unique identifier. Specifically, through the unique identifier, an automated framework can be adopted for analysis processing, so as to obtain webpage data, wherein the webpage data is data in a markdown format.
Step S104: and generating a model class file according to json data and annotation description information obtained by analyzing the webpage data. Specifically, when a model class file is generated, a platform corresponding to the model may be determined, a model template of the platform may be obtained, json data and annotation description information may be obtained through analysis according to webpage data, so that an annotated model code may be obtained, and the annotated model code is written into the model template, so that a corresponding model class file may be generated, thereby implementing automatic creation of the model class file. The generated model class file can be copied to a project for application.
The method for automatically generating the model files, provided by the embodiment of the invention, comprises the steps of obtaining an interface document address; analyzing the webpage according to the interface document address to obtain a unique identifier; analyzing according to the unique identifier to obtain webpage data; and generating a model class file according to json data and annotation description information obtained by analyzing the webpage data. Therefore, the automatic generation method of the model files can automatically generate the corresponding model files by inputting the interface document addresses, is convenient and quick, and greatly improves the working efficiency; meanwhile, the annotation description information in the model files is automatically generated, so that the error rate is low; in addition, when updating iteration is carried out, only a new model class file needs to be automatically generated to replace an old file, and the writing workload is reduced.
In an embodiment, as shown in fig. 2, performing web page parsing according to the interface document address to obtain a unique identifier includes the following steps:
step S201: and judging the type of the website according to the interface document address. After the electronic equipment receives the interface document address, whether the corresponding website type is a dynamic type or a static type can be judged through analyzing the address URL, so that the method for acquiring the unique identifier can be determined. When judging whether the website is a static website or a dynamic network, the method can be determined according to the URL link; for example, the URL links of the static website are html, htm, shtml and xml as link suffixes, while the URL of the dynamic website usually has a question mark. Thus, the type of website can be determined by the URL.
Step S202: and when the website type is a static type, acquiring the unique identifier according to the interface document address. Specifically, when the website type is determined to be a static type, metadata of the website can be directly acquired through a network request based on the interface document address, and a unique identifier can be determined by directly analyzing data, wherein the unique identifier is also a unique identifier of an HTML tag, or a real ID of the tag.
Step S203: and when the website type is a dynamic type, acquiring the unique identifier according to an automatic mode. When the website type is judged to be a dynamic type, if the metadata is directly acquired through a network request, the template data (without real data, only description information of how the interface data is displayed) is acquired; rather than real data, thereby requiring automated techniques to load the interface to retrieve the web page code.
In one embodiment, the following process may be adopted when the unique identifier is obtained by using an automated technique: automatically operating the interface document address according to a driving frame to obtain webpage code data; and analyzing the webpage code data according to a preset protocol to obtain the unique identifier.
Specifically, when a driving frame (driver frame) is adopted for automatic operation, the process of the automatic operation is the action of simulating the user to open the interface document, and because the interface webpage is of a dynamic type, the opening operation needs to be executed really to acquire real data, and the real data is also webpage code data. Then, the data can be analyzed by adopting xpath, and during analysis, the data can be analyzed according to an xml protocol to obtain the unique identifier of the specific html tag.
In an embodiment, analyzing the obtained webpage data according to the unique identifier includes: and operating the label corresponding to the unique identifier according to the driving frame to obtain markdown format data. Specifically, after the unique identifier, namely the real ID of the html tag, is determined, the tag is run by adopting a driver framework, the behavior of clicking the tag by a user is simulated, and therefore, data can be copied into the clipboard through the running process. The data cut into the clipboard is page real data, and the data is data in a markdown format.
In one embodiment, the generating a model class file of json data and annotation description information according to webpage data parsing includes:
step S301: and analyzing the webpage data to obtain json data. For markdown format data cut into a clipboard, data information required by conversion into classes is in json format. Therefore, a markdown protocol can be adopted to analyze the data rule and obtain json data. Specifically, when the markdown protocol is adopted for analysis, each segment in the data is analyzed according to the segment mark in the markdown format data, and the rule of the data is found, so that json data is determined.
Step S302: and analyzing the json data according to a recursive algorithm to obtain each attribute data of the model class and annotation description information corresponding to each attribute. Specifically, after the data in the json format is determined, different types of json data can be analyzed by using a recursive algorithm, so that each attribute data of the model class is obtained. Meanwhile, when the json data is analyzed, corresponding codes can be generated based on the language characteristics of different platforms.
In one embodiment, the json formatted data includes a string type, a dictionary type, and a data type. And when the format of the json data is a character string type, generating each attribute data of the model type according to the json data. For the character string type, each attribute data of the model type can be directly generated without adopting a recursive algorithm.
And when the format of the json data is a dictionary type, analyzing by adopting a recursive algorithm to analyze the character string type in the dictionary and generate each attribute data of the model type. Specifically, when the data is a dictionary type, key values in the data may be parsed, each key value corresponding to an attribute of the model type. For example, a person class has two attributes of name and age, and the obtained interface document contains data that the person class has key of name and value of zhang.
And the model attributes generally contain three parts of type, attribute name and attribute annotation. The key value corresponds to the attribute name, and the type can be generated through the type marked by the interface document; the annotation information may be determined by the parsed annotation description information body.
And when the format of the json data is an array type, analyzing by adopting a recursive algorithm, reducing the array type into a dictionary type, and generating each attribute data of the model type by adopting an analysis mode of the dictionary type. Specifically, for data of an array type, traversing the data in the array, and firstly adopting a recursive algorithm to analyze the array type into a dictionary type; then, the recursive algorithm is continuously adopted to resolve the dictionary type into a character string type, so that each attribute data of the model type can be generated.
For array type data, which is a description assembled by individual type data, a list can be used to describe an array; for example, a class has three classmates, which can be described by list: [ Zhang three, Li four and Wang five ], Zhang three is an element, namely an item.
Thus, when attributes of model classes are formed for different types of json data, the dictionary is a corresponding class, and the array is a set of corresponding objects (where the objects are generated by a class template, such as the above three items, which are all specific objects of the person class).
The webpage data are analyzed to obtain annotation description information, and the annotation description information is realized according to the following mode: the annotation description information of the data is provided in the form of a markdown list, so that the rule in the markdown list can be obtained by analyzing the markdown list. Then, after determining each attribute data of the model class, the annotation description information corresponding to the corresponding attribute data can be determined based on the attribute data and the rule of the annotation description information.
Step S303: and generating a model class file according to the annotation description information corresponding to each attribute and a preset model template. Specifically, after the annotation description information corresponding to each attribute is determined, model template files of corresponding platforms, for example, model template files of an iOS platform, an Android platform, or a Java platform, may be determined based on different platforms, and then corresponding model codes are generated based on the different platforms, so as to obtain corresponding model class files.
In an embodiment, as shown in fig. 4, the method for automatically generating a model class file is implemented by the following processes: a user inputs an interface document address URL of a model type file to be converted; determining whether the interface document website is a dynamic type or not according to the type of the interface document website; when the website type is a dynamic type, adopting an automatic technology loading interface to obtain a webpage code; when the webpage code is not in a dynamic type or a static type, the webpage code can be directly acquired; analyzing based on the webpage codes, and extracting corresponding ID values; and analyzing based on the ID value to obtain webpage data or original data, and analyzing the metadata to obtain each attribute data of the model class and annotation description information corresponding to each attribute data, thereby generating a model class code. A model class file may then be created and the generated model code stored.
According to the automatic generation method of the model files, provided by the embodiment of the invention, the model files comprising ios, android and java multiple platforms are generated by combining the model templates of different platforms, the data consistency of the multiple platforms is synchronously maintained, the defect that the multiple platforms respectively maintain the model files is effectively overcome, and the communication cost is effectively reduced.
An embodiment of the present invention further provides an apparatus for automatically generating a model class file, as shown in fig. 5, the apparatus includes:
the address acquisition module is used for acquiring an interface document address; for details, reference is made to the corresponding parts of the above method embodiments, which are not described herein again.
The analysis module is used for carrying out webpage analysis according to the interface document address to obtain a unique identifier; for details, reference is made to the corresponding parts of the above method embodiments, which are not described herein again.
The identification analysis module is used for analyzing and obtaining json data and annotation description information according to the unique identification; for details, reference is made to the corresponding parts of the above method embodiments, which are not described herein again.
And the model class file generating module is used for generating a model class file according to the json data and the annotation description information. For details, reference is made to the corresponding parts of the above method embodiments, which are not described herein again.
The automatic generation device of the model file provided by the embodiment of the invention obtains the address of the interface document; analyzing the webpage according to the interface document address to obtain a unique identifier; analyzing according to the unique identifier to obtain webpage data; and generating a model class file according to json data and annotation description information obtained by analyzing the webpage data. Therefore, the automatic generation device for the model files can automatically generate the corresponding model files by inputting the interface document addresses, is convenient and quick, and greatly improves the working efficiency; meanwhile, the annotation description information in the model files is automatically generated, so that the error rate is low; in addition, when updating iteration is carried out, only a new model class file needs to be automatically generated to replace an old file, and the writing workload is reduced.
The functional description of the automatic generation device of the model class file provided by the embodiment of the invention refers to the description of the automatic generation method of the model class file in the above embodiment in detail.
An embodiment of the present invention further provides a storage medium, as shown in fig. 6, on which a computer program 601 is stored, where the instructions, when executed by a processor, implement the steps of the method for automatically generating a model class file in the foregoing embodiment. The storage medium is also stored with audio and video stream data, characteristic frame data, an interactive request signaling, encrypted data, preset data size and the like. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
An embodiment of the present invention further provides an electronic device, as shown in fig. 7, the electronic device may include a processor 51 and a memory 52, where the processor 51 and the memory 52 may be connected by a bus or in another manner, and fig. 7 takes the connection by the bus as an example.
The processor 51 may be a Central Processing Unit (CPU). The Processor 51 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or combinations thereof.
The memory 52, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the corresponding program instructions/modules in the embodiments of the present invention. The processor 51 executes various functional applications and data processing of the processor by running non-transitory software programs, instructions and modules stored in the memory 52, that is, the method for automatically generating the model class file in the above method embodiment is implemented.
The memory 52 may include a storage program area and a storage data area, wherein the storage program area may store an operating device, an application program required for at least one function; the storage data area may store data created by the processor 51, and the like. Further, the memory 52 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 52 may optionally include memory located remotely from the processor 51, and these remote memories may be connected to the processor 51 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the memory 52 and, when executed by the processor 51, perform a method of automatic generation of model class files as in the embodiment shown in fig. 1-4.
The details of the electronic device may be understood by referring to the corresponding descriptions and effects in the embodiments shown in fig. 1 to fig. 4, and are not described herein again.
Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope defined by the appended claims.

Claims (10)

1. A method for automatically generating a model class file is characterized by comprising the following steps:
acquiring an interface document address;
analyzing a webpage according to the interface document address to obtain a unique identifier;
analyzing according to the unique identifier to obtain webpage data;
and generating a model class file according to json data and annotation description information obtained by analyzing the webpage data.
2. The method for automatically generating a model class file according to claim 1, wherein performing web page parsing according to the interface document address to obtain a unique identifier comprises:
judging the type of the website according to the interface document address;
when the website type is a static type, acquiring the unique identifier according to the interface document address;
and when the website type is a dynamic type, acquiring the unique identifier according to an automatic mode.
3. The method for automatically generating a model class file according to claim 2, wherein the obtaining of the unique identifier according to an automated manner includes:
automatically operating the interface document address according to a driving frame to obtain webpage code data;
and analyzing the webpage code data according to a preset protocol to obtain the unique identifier.
4. The method for automatically generating a model class file according to claim 1, wherein analyzing the obtained webpage data according to the unique identifier comprises:
and operating the label corresponding to the unique identifier according to the driving frame to obtain the markdown format webpage data.
5. The method for automatically generating the model class file according to claim 1, wherein the generating the model class file by analyzing the json data and the annotation description information according to the webpage data comprises:
analyzing the webpage data to obtain json data;
analyzing the json data according to a recursive algorithm to obtain attribute data of the model class and annotation description information corresponding to each attribute;
and generating a model class file according to the annotation description information corresponding to each attribute and a preset model template.
6. The method for automatically generating the model class file according to claim 5, wherein analyzing the json data according to a recursive algorithm to obtain attribute data of the model class and annotation description information corresponding to each attribute comprises:
analyzing by adopting a recursive algorithm according to the type of the json data to obtain each attribute data of the model type;
analyzing the webpage data to obtain annotation description information;
and obtaining the annotation description information corresponding to each attribute according to the attribute data and the annotation description information of the model class.
7. The method for automatically generating the model class file according to claim 6, wherein analyzing by using a recursive algorithm according to the type of json data to obtain each attribute data of the model class comprises:
when the format of the json data is a character string type, generating attribute data of the model type according to the json data;
when the format of the json data is a dictionary type, analyzing by adopting a recursive algorithm to analyze the character string type in the dictionary and generate each attribute data of the model type;
and when the format of the json data is an array type, analyzing by adopting a recursive algorithm, reducing the array type into a dictionary type, and generating each attribute data of the model type by adopting an analysis mode of the dictionary type.
8. An apparatus for automatically generating a model class file, comprising:
the address acquisition module is used for acquiring an interface document address;
the analysis module is used for carrying out webpage analysis according to the interface document address to obtain a unique identifier;
the identification analysis module is used for analyzing and obtaining webpage data according to the unique identification;
and the model file generation module is used for generating a model file according to json data obtained by analyzing the webpage data and the annotation description information.
9. A computer-readable storage medium storing computer instructions for causing a computer to perform the method for automatically generating a model class file according to any one of claims 1 to 7.
10. An electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the method of automatically generating a model class file according to any one of claims 1 to 7.
CN202111466259.1A 2021-12-03 2021-12-03 Method and device for automatically generating model files, storage medium and electronic equipment Pending CN114138244A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111466259.1A CN114138244A (en) 2021-12-03 2021-12-03 Method and device for automatically generating model files, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111466259.1A CN114138244A (en) 2021-12-03 2021-12-03 Method and device for automatically generating model files, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114138244A true CN114138244A (en) 2022-03-04

Family

ID=80387489

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111466259.1A Pending CN114138244A (en) 2021-12-03 2021-12-03 Method and device for automatically generating model files, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114138244A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210264096A1 (en) * 2020-02-25 2021-08-26 Transposit Corporation Markdown data content with action binding
CN115686459A (en) * 2022-10-31 2023-02-03 北京力控元通科技有限公司 Model generation method, device and equipment based on Java language and readable storage medium
CN116910330A (en) * 2023-09-12 2023-10-20 湖南科研云信息科技有限公司 Financial archive management method, system, electronic equipment and storage medium
CN117576545A (en) * 2024-01-16 2024-02-20 成都同步新创科技股份有限公司 Multi-algorithm full-matching access adapter access method

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210264096A1 (en) * 2020-02-25 2021-08-26 Transposit Corporation Markdown data content with action binding
US11704474B2 (en) * 2020-02-25 2023-07-18 Transposit Corporation Markdown data content with action binding
CN115686459A (en) * 2022-10-31 2023-02-03 北京力控元通科技有限公司 Model generation method, device and equipment based on Java language and readable storage medium
CN116910330A (en) * 2023-09-12 2023-10-20 湖南科研云信息科技有限公司 Financial archive management method, system, electronic equipment and storage medium
CN116910330B (en) * 2023-09-12 2023-12-05 湖南科研云信息科技有限公司 Financial archive management method, system, electronic equipment and storage medium
CN117576545A (en) * 2024-01-16 2024-02-20 成都同步新创科技股份有限公司 Multi-algorithm full-matching access adapter access method
CN117576545B (en) * 2024-01-16 2024-04-05 成都同步新创科技股份有限公司 Multi-algorithm full-matching access adapter access method

Similar Documents

Publication Publication Date Title
CN114138244A (en) Method and device for automatically generating model files, storage medium and electronic equipment
US8510237B2 (en) Machine learning method to identify independent tasks for parallel layout in web browsers
CN115617327A (en) Low code page building system, method and computer readable storage medium
US9128723B2 (en) Method and apparatus for dynamic document object model (DOM) aware code editing
CN111125598A (en) Intelligent data query method, device, equipment and storage medium
CN112416363B (en) Method and device for generating front-end and back-end CRUD codes
CN110941427B (en) Code generation method and code generator
CN108255837B (en) SQL parser and method
US8694964B1 (en) Managing code samples in documentation
CN112417338B (en) Page adaptation method, system and equipment
CN108664247B (en) Page template data interaction method and device
CN112905179A (en) Mobile terminal H5 page generation method and device, electronic equipment and storage medium
CN115599386A (en) Code generation method, device, equipment and storage medium
CN117875288A (en) Form page generation method and device and electronic equipment
CN111078217A (en) Brain graph generation method, apparatus and computer-readable storage medium
Decker et al. A tool for efficiently reverse engineering accurate UML class diagrams
CN112231197A (en) Page testing method and device and storage medium
CN116088846A (en) Processing method, related device and equipment for continuous integrated code format
CN117632710A (en) Method, device, equipment and storage medium for generating test code
CN112632333A (en) Query statement generation method, device, equipment and computer readable storage medium
CN113238739A (en) Plug-in development and data acquisition method, device, electronic equipment and medium
CN112416333A (en) Software model training method, device, system, equipment and storage medium
CN111859862A (en) Text data labeling method and device, storage medium and electronic device
CN114546381A (en) Front-end page code file generation method and device, electronic equipment and storage medium
CN114201215A (en) Interface document generation method and device, electronic equipment and storage medium

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