Entity class generation method and device

By automatically parsing interface documents and using entity class generation models, it solves the problems of low efficiency and poor standardization of entity class generation, and achieves efficient and standardized entity class generation, which is suitable for a variety of interface documents and system interfaces.

CN114816387BActive Publication Date: 2024-09-24MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210452010.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2024-09-24
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

The efficiency of entity class generation in the existing technology is low and the standardization is poor. Mainly due to differences in developers' business capabilities and coding styles, manual writing is time-consuming and the generated entity classes are not standardized and difficult to maintain.

Method used

By automatically parsing interface documents, determining field types, and using pre-deployed entity class generation models to generate entity classes, we avoid developer involvement and achieve universality and consistency.

Benefits of technology

It improves the efficiency of entity class generation, ensures the standardization and maintainability of the generated entity classes, and is suitable for various interface documents and system interfaces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114816387B
    Figure CN114816387B
Patent Text Reader

Abstract

The present application discloses an entity class generation method and device, which are used to solve the problems of low efficiency and poor standardization of entity class generation in the prior art. The method includes: obtaining a target interface document to be parsed; the target interface document includes multiple lines of document data; parsing each line of document data of the target interface document, and determining the target field type corresponding to each line of document data according to the parsing result; writing the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data; converting the document information object into an entity class information object; the entity class information object includes element information required for generating the entity class; inputting the entity class information object into a pre-deployed entity class generation model for entity class generation processing, and obtaining the target entity class corresponding to the target interface document. This technical solution improves the generation efficiency and standardization of the entity class.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of technology development technology, and in particular to a method and device for generating an entity class. Background Art

[0002] In the field of technology development, it is usually necessary to connect to a large number of third-party system interfaces. Therefore, it is necessary to write a large number of entity classes of interface documents based on the interface documents of each third-party system interface.

[0003] There are two main implementation methods: one is to manually write the entity class of the interface document, that is, to manually write the entity class of the interface document according to the interface document. Due to the differences in the business capabilities and business proficiency of developers, it is easy to generate entity classes in a long time during the manual writing process, resulting in low efficiency in generating entity classes. And due to the differences in the coding styles of developers, it is difficult to standardize the definition of entity classes, resulting in poor standardization of generated entity classes. The other is to generate entity classes by writing simple codes, that is, for a specific and immutable interface document, the simplest entity class is generated by code. This method also has the problem of poor standardization of generated entity classes due to different coding styles of developers, which makes the generated entity classes poorly maintainable. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method and device for generating an entity class, so as to solve the problem of low efficiency and poor standardization of entity class generation in the prior art.

[0005] To solve the above technical problems, the embodiments of the present application are implemented as follows:

[0006] On the one hand, an embodiment of the present application provides an entity class generation method, including:

[0007] Obtaining a target interface document to be parsed; the target interface document includes multiple lines of document data;

[0008] Parsing each line of document data of the target interface document, and determining the target field type corresponding to each line of document data according to the parsing result;

[0009] According to the target field type corresponding to each line of document data, the data content of each line of document data is written into the document information object corresponding to the target interface document;

[0010] Converting the document information object into an entity class information object; the entity class information object includes element information required for generating an entity class;

[0011] The entity class information object is input into a pre-deployed entity class generation model to perform entity class generation processing to obtain a target entity class corresponding to the target interface document.

[0012] By adopting the technical solution of the embodiment of the present application, by obtaining the target interface document to be parsed, each line of document data of the target interface document is automatically parsed, and the target field type corresponding to each line of document data is determined according to the parsing result, and according to the target field type corresponding to each line of document data, the data content of each line of document data is automatically written into the document information object corresponding to the target interface document, thereby converting the document information object into an entity class information object, and the entity class information object includes the element information required for generating the entity class, and then the entity class information object is input into the pre-deployed entity class generation model for entity class generation processing, and the target entity class corresponding to the target interface document is obtained. It can be seen that in the process of generating the entity class of the interface document, there is no need for developers to participate, so it can avoid the problem of long time consumption in generating the entity class due to differences in the business capabilities and business proficiency of developers, and improve the efficiency of entity class generation. Moreover, the entity class corresponding to the interface document is generated through the entity class generation model. Due to the universality of the entity class generation model, it can be applied to various interface documents, and thus can be applied to various system interfaces that provide interface documents (such as third-party system interfaces). It not only achieves the universality of the generated entity class, but also makes the entity classes generated for different interface documents consistent, thereby avoiding the problem of non-standard entity classes caused by different coding styles of developers, improving the standardization of entity classes, and thus improving the maintainability of entity classes.

[0013] On the other hand, an embodiment of the present application provides an entity class generation device, including:

[0014] A first acquisition module is used to acquire a target interface document to be parsed; the target interface document includes multiple lines of document data;

[0015] A parsing and determining module, used to parse each line of document data of the target interface document, and determine the target field type corresponding to each line of document data according to the parsing result;

[0016] A writing module, used to write the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data;

[0017] A first conversion module, used to convert the document information object into an entity class information object; the entity class information object includes element information required for generating an entity class;

[0018] The input and generation module is used to input the entity class information object into a pre-deployed entity class generation model to perform entity class generation processing to obtain a target entity class corresponding to the target interface document.

[0019] On the other hand, an embodiment of the present application provides an electronic device, including a processor; and a memory arranged to store computer-executable instructions, wherein the computer-executable instructions are configured to be executed by the processor, and the computer-executable instructions are executed by the processor to implement the above-mentioned entity class generation method.

[0020] On the other hand, an embodiment of the present application provides a storage medium for storing computer-executable instructions, wherein the computer-executable instructions implement the above-mentioned entity class generation method when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 is a schematic flow chart of a method for generating an entity class according to an embodiment of the present application;

[0023] Figure 2 is a schematic block diagram of an actuator chain according to an embodiment of the present application;

[0024] Figure 3 is a schematic block diagram of a bidirectional linked list relationship of a document information object according to an embodiment of the present application;

[0025] Figure 4 is a schematic diagram of a target interface document according to an embodiment of the present application;

[0026] Figure 5 is a schematic flow chart of an entity class generation method according to another embodiment of the present application;

[0027] Figure 6 is a structural schematic diagram of an entity class generation device according to an embodiment of the present application;

[0028] Figure 7 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] The purpose of the embodiments of the present application is to provide a method and device for generating an entity class, so as to solve the problem of low efficiency and poor standardization of entity class generation in the prior art.

[0030] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0031] Considering that in daily technical development, a large number of entity classes of interface documents need to be written. If the developer manually writes the entity classes of each interface document in accordance with each interface document, due to the differences in the business capabilities and business proficiency of the developers, it is easy to have the problem of taking a long time to generate the entity class, resulting in low efficiency in generating the entity class, and due to the differences in the code styles of the developers, it is difficult to standardize the definition of the entity class, resulting in poor standardization of the generated entity class, and also making the maintainability of the generated entity class poor. It can be seen that in the process of generating the entity class, if the corresponding entity class can be automatically generated according to the interface document, the generation time of the entity class will be saved, and the standardization of the entity class can be ensured to a certain extent. The present application generates the corresponding entity class by automatically parsing the interface document without the participation of the developer, which saves the generation time of the entity class and improves the generation efficiency of the entity class. The entity class is generated by the entity class generation model, so that the entity classes generated for different interface documents are consistent, thereby ensuring the standardization of the generated entity class, thereby ensuring the maintainability of the generated entity class.

[0032] Figure 1 is a schematic flow chart of a method for generating an entity class according to an embodiment of the present application, such as Figure 1 As shown, the method may include:

[0033] S102, obtaining the target interface document to be parsed.

[0034] The target interface document is a document written by developers to describe the interface information provided by the system, and the target interface document may include multiple lines of document data.

[0035] S104, parsing each line of document data of the target interface document, and determining the target field type corresponding to each line of document data according to the parsing result.

[0036] Among them, the target field type can be the request interface name, the Chinese name of the request interface, the response interface name, the Chinese name of the response interface, the request field or the response field. The parsing result may include the target field type corresponding to each line of document data and the data content of each line of document data. Optionally, the data content of each line of document data here is not the original content of each line of document data, but the content obtained after screening, format modification and other processing. The specific processing will be described in detail in the following embodiments. Optionally, the request field includes header field information and input parameter data, and the response field includes header field information and output parameter data.

[0037] S106, writing the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data.

[0038] Among them, the position corresponding to each field type can be preset in the document information object, so as to facilitate writing the data content of each line of document data into the position corresponding to the same field type (referring to the same target field type as each line of document data) in the document information object. For example, the position corresponding to the request interface name, the position corresponding to the preset request interface Chinese name, the position corresponding to the preset response interface name, the position corresponding to the preset response interface Chinese name, the position corresponding to the preset request field, and the position corresponding to the preset response field can be preset in the document information object.

[0039] Optionally, the document information object can be a DocClassDefine object (an object in the Java language). The DocClassDefine object can include a position corresponding to a preset request interface name, a position corresponding to a preset request interface Chinese name, a position corresponding to a preset request field, a position corresponding to a preset response interface name, a position corresponding to a preset response interface Chinese name, and a position corresponding to a preset response field. The DocClassDefine object also includes a request response identifier and a bidirectional linked list relationship. The DocClassDefine object has an array field of type DocDefine inside for storing the data content of each line of document data.

[0040] S108, converting the document information object into an entity class information object.

[0041] The entity class information object includes element information required for generating the entity class. Optionally, the element information may include class name, public information parent class name, public information interface name, field information, annotation information, comments, import package information, etc. The field information is the attribute information of the entity class, and the field information may include the field access modifier, field type, field name, field default value, field annotation, field comment, etc. The specific content of the entity class information object will be described in detail in the following embodiments.

[0042] S110, inputting the entity class information object into a pre-deployed entity class generation model to perform entity class generation processing to obtain a target entity class corresponding to the target interface document.

[0043] By adopting the technical solution of the embodiment of the present application, by obtaining the target interface document to be parsed, each line of document data of the target interface document is automatically parsed, and the target field type corresponding to each line of document data is determined according to the parsing result, and according to the target field type corresponding to each line of document data, the data content of each line of document data is automatically written into the document information object corresponding to the target interface document, thereby converting the document information object into an entity class information object, and the entity class information object includes the element information required for generating the entity class, and then the entity class information object is input into the pre-deployed entity class generation model for entity class generation processing, and the target entity class corresponding to the target interface document is obtained. It can be seen that in the process of generating the entity class of the interface document, there is no need for developers to participate, so it can avoid the problem of long time consumption in generating the entity class due to differences in the business capabilities and business proficiency of developers, and improve the efficiency of entity class generation. Moreover, the entity class corresponding to the interface document is generated through the entity class generation model. Due to the universality of the entity class generation model, it can be applied to various interface documents, and thus can be applied to various system interfaces that provide interface documents (such as third-party system interfaces). It not only achieves the universality of the generated entity class, but also makes the entity classes generated for different interface documents consistent, thereby avoiding the problem of non-standard entity classes caused by different coding styles of developers, improving the standardization of entity classes, and thus improving the maintainability of entity classes.

[0044] In one embodiment, for the target interface document to be parsed that is obtained, the target interface document can be parsed based on an Excel (spreadsheet) interface document template. The Excel interface document template may include multiple sheets (worksheets), each sheet includes two parts, a request and a response, and each sheet is used to parse a target interface document.

[0045] Among them, the configuration information of the Excel interface document template stores information such as the reading path of each sheet and the reading order of each sheet. In this embodiment, it can be determined which sheet(s) to read based on the number of target interface documents to be parsed and the configuration information of the Excel interface document template. Each time a sheet is read, a thread is allocated from the thread pool to the interface document parsing task. Each interface document parsing task will read each line of document data of the target interface document from top to bottom in sequence, and create an intermediate object of ExcelEvent for each line of document data to store the line of document data. The created intermediate object of ExcelEvent does not need to be temporarily stored and is directly passed to the executor chain. The executor chain includes multiple matchers, each of which is used to match and parse the document data. The processing process of the executor chain on the document data will be described in detail in the following embodiments.

[0046] In this embodiment, the interface document parsing task can achieve the decoupling effect of the programming languages ​​before and after the intermediate object of ExcelEvent by creating an intermediate object of ExcelEvent for each row of document data, that is, the interface document can be written in the same or different programming language as the generated entity class. For example, the generated entity class is a Java entity class, but the interface document can be an interface document written in Python programming language or in Java programming language.

[0047] In this embodiment, the template contents of multiple sheets may be the same or different, and the template contents of each sheet may include the request interface name, the Chinese name of the request interface, the header field information of the request field (such as number, field code, Chinese name, type, length, list value, required input, default value, etc.), input parameter data, response interface name, Chinese name of the response interface, header field information of the response field (consistent with the header field information of the request field), output parameter data, etc. In actual applications, according to the specific entity class generation requirements, the Chinese name of the request interface and the Chinese name of the response interface may not be set in the template content of the sheet, and this embodiment of the application does not limit this.

[0048] Optionally, the header field information of the request field and the header field information of the response field are consistent in the number of header fields, the type of header fields, and the order of header fields. For example, the number of header fields of the request field is 8, the header field type of the request field includes number, field code, Chinese name, type, length, list value, required input, and default value, and the order of header fields of the request field is number, field code, Chinese name, type, length, list value, required input, and default value. Then, the number of header fields of the response field needs to be 8, the header field type of the response field needs to include number, field code, Chinese name, type, length, list value, required input, and default value, and the order of header fields of the response field needs to be number, field code, Chinese name, type, length, list value, required input, and default value. Exemplarily, the header field information of the request field is shown in Table 1, then the header field information of the response field should be shown in Table 2.

[0049] Table 1

[0050] serial number Field Code Chinese name type length List Values Must lose default value

[0051] Table 2

[0052] serial number Field Code Chinese name type length List Values Must lose default value

[0053] Exemplarily, the template content of a sheet in the Excel interface document template may include the request interface name, the Chinese name of the request interface, the header field information of the request field (including number, field code, Chinese name, type, length, list value, required input and default value), input parameter data, response interface name, Chinese name of the response interface, header field information of the response field (consistent with the header field information of the request field) and output parameter data, as shown in Table 3.

[0054] Table 3

[0055]

[0056] Among them, the input parameter data (i.e., the fourth line in Table 3) may include multiple lines, and Table 3 only schematically shows one line. The multiple lines of input parameter data need to be followed by the response interface name to indicate that the document data of the request part has been read, and what is read thereafter are the document data of the response part.

[0057] In this embodiment, for the header field type of number in the header field information of the request field and the header field information of the response field, if all data numbers in the input parameter data or the output parameter data (i.e., the data content corresponding to the header field type "number") are empty, it indicates that the field levels corresponding to all the input parameter data are the same or the field levels corresponding to all the output parameter data are the same. If all data numbers in the input parameter data or the output parameter data are not empty, then in multiple lines of input parameter data or multiple lines of output parameter data, they must be incremented from 1 to +1 from top to bottom, for example, from 1 to 2, from 2 to 3, etc., and it is not allowed to directly increment from 1 to 3.

[0058] When all data numbers in the input parameter data or output parameter data are not empty, the data number upgrade must follow the principle of step-by-step ascending, as shown in Table 4, it is allowed to upgrade from 1 to 1.1, from 2.1 to 2.1.1, etc., but not allowed to upgrade directly from 1 to 2.1; the data number downgrade must follow the principle of downgrading to the parent level + 1, grandparent level + 1 of the previous data number, as shown in Table 4, it is allowed to downgrade from 1.1 to 2, from 2.1.1 to 3, etc., but not allowed to downgrade from 1.1 to 1. If the data number in the input parameter data or output parameter data does not meet the above data number upgrade principle or data number downgrade principle, the current interface document parsing task is terminated, and a prompt message for indicating that the target interface document number is abnormal is output.

[0059] Table 4

[0060] serial number Field Code 1 frz_oprn_flg 1.1 frz_num 2 cust_acct_num 2.1 acc_nm 2.1.1 frz_instr_src 3 sub_acct_serl_num

[0061] In this embodiment, the target interface document is parsed based on the Excel interface document template, thereby achieving an automated parsing effect on the target interface document, providing a data basis for automatically generating entity classes of the interface document in subsequent embodiments, and making the obtained parsing results more standardized and unified.

[0062] In one embodiment, before executing the interface document parsing task, a document information object corresponding to the target interface document can be created according to the template content and request response identifier of the Excel interface document template. The positions corresponding to each field type can be preset in the document information object, so as to facilitate writing the data content of each row of document data into the position corresponding to the same field type (referring to the same target field type corresponding to each row of document data) in the document information object. For example, the position corresponding to the request interface name, the position corresponding to the preset request interface Chinese name, the position corresponding to the preset response interface name, the position corresponding to the preset response interface Chinese name, the position corresponding to the preset request field, and the position corresponding to the preset response field can be preset in the document information object. The request response identifier and the bidirectional linked list relationship can also be set in the document information object.

[0063] Optionally, the document information object may be represented by a table, a string array, etc. In practical applications, the document information object may also be represented by other representations according to specific entity class generation requirements, which is not limited in the present embodiment.

[0064] Optionally, a table as shown in Table 3 may be used to represent the document information object. In addition to the contents listed in Table 3, the table used to represent the document information object also includes cells for defining request response identifiers and bidirectional linked list relationships.

[0065] If a string array is used to represent a document information object, each item of information contained in the document information object can be stored in different rows of the string array.

[0066] In one embodiment, when executing the interface document parsing task, each line of document data of the target interface document is parsed, and the target field type corresponding to each line of document data is determined according to the parsing result. This can be achieved through the following step A1 or the following steps C1-C3.

[0067] In one embodiment, for each line of document data, the document data is parsed, and specific implementation methods for determining the target field type corresponding to the document data according to the parsing result are:

[0068] Step A1: Match document data with at least one of a plurality of first preset keywords, and determine a field type corresponding to the first preset keyword matching the document data as a target field type.

[0069] The target field type may include one of the request interface name, response interface name, request field, and response field. Optionally, the target field type may also be the Chinese name of the request interface or the Chinese name of the response interface. The request field includes header field information and input parameter data, and the response field includes header field information and output parameter data. The header field information may include number, field code, Chinese name, type, length, list value, required input, default value, etc.

[0070] Among them, the multiple first preset keywords include preset keywords corresponding to at least one field type. Optionally, the multiple first preset keywords may include preset keywords corresponding to the request interface name, preset keywords corresponding to the request interface Chinese name, preset keywords corresponding to the response interface name, preset keywords corresponding to the response interface Chinese name, preset keywords corresponding to the number, preset keywords corresponding to the field code, preset keywords corresponding to the Chinese name, preset keywords corresponding to the type, preset keywords corresponding to the length, preset keywords corresponding to the list value, preset keywords corresponding to the required input, preset keywords corresponding to the default value, etc.

[0071] In this embodiment, when matching the document data with at least one of the plurality of first preset keywords, the matching may be performed sequentially according to the arrangement order of the plurality of first preset keywords, or the matching of the document data with the plurality of first preset keywords may be performed in parallel. Optionally, the matching may be performed sequentially according to the arrangement order of the plurality of first preset keywords, and may be performed as follows: matching the document data through an executor chain.

[0072] In this embodiment, when there is a first preset keyword in the document data, it can be determined that the document data matches the first preset keyword, and the field type corresponding to the first preset keyword can be determined as the target field type. Among them, the field type corresponding to the preset keyword corresponding to the request interface name is the request interface name, the field type corresponding to the preset keyword corresponding to the Chinese name of the request interface is the Chinese name of the request interface, the field type corresponding to the preset keyword corresponding to the response interface name is the response interface name, the field type corresponding to the preset keyword corresponding to the Chinese name of the response interface is the Chinese name of the response interface, and the field types corresponding to the preset keyword corresponding to the number, the preset keyword corresponding to the field code, the preset keyword corresponding to the Chinese name, the preset keyword corresponding to the type, the preset keyword corresponding to the length, the preset keyword corresponding to the list value, the preset keyword corresponding to the must-enter and the preset keyword corresponding to the default value are all request fields or response fields. For example, if there is a preset keyword corresponding to the request interface name in the document data, it can be determined that the document data matches the preset keyword corresponding to the request interface name, and the field type corresponding to the preset keyword corresponding to the request interface name (i.e., the request interface name) can be determined as the target field type.

[0073] In this embodiment, by matching each line of document data of the target interface document with at least one of a plurality of first preset keywords, the field type corresponding to the first preset keyword matching the document data is determined as the target field type, thereby simply and quickly determining the field type to which each line of document data to be parsed belongs, which is conducive to realizing rapid parsing of the document data.

[0074] In one embodiment, when matching document data through an executor chain, the intermediate object of ExcelEvent created by the interface document parsing task for each line of document data can be passed to a preset executor chain, so that each line of document data is matched and parsed according to each matcher in the executor chain to obtain a parsing result. Among them, the target field type corresponding to the line of document data is the same as the field type corresponding to the matcher with which the document data matches. The parsing result includes the target field type corresponding to each line of document data and the data content of each line of document data.

[0075] Optionally, the preset executor chain may include a request interface name matcher, a response interface name matcher, a request header matcher, a response header matcher, an input parameter matcher, an output parameter matcher, TailWork, etc. TailWork is an executor located at the tail end of the executor chain. Only the data content of the document data parsed by the input parameter matcher and the output parameter matcher will flow to TailWork. After TailWork further processes the incoming data content, it is written into the document information object corresponding to the target interface document. The field type corresponding to the request interface name matcher is the request interface name and / or the Chinese name of the request interface, the field type corresponding to the response interface name matcher is the response interface name and / or the Chinese name of the response interface, the field type corresponding to the request header matcher is the header field information of the request field, the field type corresponding to the response header matcher is the header field information of the response field, the field type corresponding to the input parameter matcher is the input parameter data, and the field type corresponding to the output parameter matcher is the output parameter data.

[0076] In this embodiment, for multiple matchers, the priority order of each matcher can be determined in advance, so that each matcher is registered to the executor chain in turn according to the priority order of each matcher, and the intermediate object of the input ExcelEvent traverses the executor chain to try to match with each matcher. If a match is found, the document data is parsed through the matcher to obtain the parsing result. Exemplarily, the priority order of each matcher is: request interface name matcher, response interface name matcher, request header matcher, response header matcher, input parameter matcher, output parameter matcher, TailWork. Then, after each matcher is registered to the executor chain in turn according to the priority order of each matcher, the resulting executor chain can be as follows: Figure 2 shown.

[0077] Below Figure 2 The executor chain shown in the figure details the matching and parsing processing of the document data by each matcher.

[0078] For the document data input to the request interface name matcher, if the line of document data matches the preset keyword corresponding to the request interface name, the first non-empty string after the preset keyword in the line of document data is obtained until it is empty, as the request interface name; if the line of document data matches the preset keyword corresponding to the Chinese name of the request interface, the first non-empty string after the preset keyword in the line of document data is obtained until it is empty, as the Chinese name of the request interface. If the line of document data does not match the preset keyword corresponding to the request interface name and the preset keyword corresponding to the Chinese name of the request interface, the line of document data is input to the response interface name matcher.

[0079] In this embodiment, after obtaining the request interface name, the request interface name can be written into the location corresponding to the preset request interface name in the document information object corresponding to the target interface document. When the request interface name is written into the location corresponding to the preset request interface name in the document information object, the request response flag in the document information object is set to True, indicating that the document data starting from this line is the document data of the request part.

[0080] For the document data input into the response interface name matcher, if the line of document data matches the preset keyword corresponding to the response interface name, the first non-empty string after the preset keyword in the line of document data is obtained until it is empty, which is used as the response interface name; if the line of document data matches the preset keyword corresponding to the Chinese name of the response interface, the first non-empty string after the preset keyword in the line of document data is obtained until it is empty, which is used as the Chinese name of the response interface.

[0081] In this embodiment, after the response interface name is obtained, the response interface name can be written into the position corresponding to the preset response interface name in the document information object corresponding to the target interface document. When the response interface name is written into the position corresponding to the preset response interface name in the document information object, the request response flag in the document information object is set to False, indicating that starting from this line of document data, the following document data are all document data of the response part.

[0082] For the document data input into the request header matcher, if the line of document data matches the preset keywords corresponding to the header field information (which may include preset keywords corresponding to the number, preset keywords corresponding to the field code, preset keywords corresponding to the Chinese name, preset keywords corresponding to the type, preset keywords corresponding to the length, preset keywords corresponding to the list value, preset keywords corresponding to the required input, preset keywords corresponding to the default value, etc.), it can be determined that the line of document data matches the request header matcher. Exemplarily, the preset keywords corresponding to the field code are field name, field, field English name, etc. If the line of document data contains any one or more of field name, field, field English name, it can be determined that the line of document data matches the preset keywords corresponding to the field code.

[0083] In the case where the line of document data matches the request header matcher, the column index position of each header field type (such as number, field code, Chinese name, type, length, list value, required input and default value) can be determined according to the matching order of the line of document data and each preset keyword, so that when the input parameter data is subsequently parsed, the corresponding relationship between each column and the data content of the input parameter data can be determined according to the column index position of each header field type. Among them, when the target field type corresponding to the document data is the input parameter data, the parsing result of the line of document data can be encapsulated into a string array, so that according to the column index position of each header field type, the header field type corresponding to each index position in the string array can be determined. For example, the column index position where the field code is located is 2, then the header field type corresponding to index 2 in the string array is the field code, that is, index 2 is the value of the field code.

[0084] Exemplarily, when the order of matching between a row of document data and each preset keyword is as shown in Table 5, the column index position where each header field type is located can be determined as follows: number-0, field code-1, Chinese name-2, type-3, length-4, list value-5, required-6, default value-7. When the order of matching between a row of document data and each preset keyword is as shown in Table 6, the column index position where each header field type is located can be determined as follows: number-4, field code-2, Chinese name-1, type-3, length-0, list value-6, required-5, default value-7.

[0085] Table 5

[0086] serial number Field Code Chinese name type length List Values Must lose default value

[0087] Table 6

[0088] length Chinese name Field Code type serial number Must lose List Values default value

[0089] In this embodiment, the column index position of each header field type can be determined according to the matching order between the document data and the preset keywords. Thus, the header field type corresponding to each index position in the string array can be determined according to the column index position of each header field type. There is no need to limit the position of each header field type, thereby achieving a loose matching effect on the header field information and being able to achieve flexible matching of dynamically set header field information, making the request header matcher more applicable.

[0090] For the document data input into the response header matcher, if this row of document data matches the preset keywords corresponding to the header field information (which may include preset keywords corresponding to the number, preset keywords corresponding to the field code, preset keywords corresponding to the Chinese name, preset keywords corresponding to the type, preset keywords corresponding to the length, preset keywords corresponding to the list value, preset keywords corresponding to the required input, preset keywords corresponding to the default value, etc.), then it can be determined that this row of document data matches the response header matcher.

[0091] When the line of document data matches the response header matcher, the column index position of each header field type can be determined according to the matching order of the line of document data and each preset keyword, so that when the output parameter data is subsequently parsed, the corresponding relationship between each column and the data content of the output parameter data can be determined according to the column index position of each header field type. Among them, when the target field type corresponding to the document data is the output parameter data, the parsing result of the line of document data can be encapsulated into a string array, so that according to the column index position of each header field type, the header field type corresponding to each index position in the string array can be determined. For example, the column index position where the field code is located is 2, then the header field type corresponding to index 2 in the string array is the field code, that is, index 2 is the value of the field code.

[0092] When the document data in this row matches the response header matcher, it can be determined whether the header field information of the request field and the header field information of the response field are consistent in terms of the number of header fields, header field type and header field order. If not, a prompt message can be output to indicate that the parsing of the target interface document has failed, thereby achieving the effect of timely terminating the interface document parsing task with abnormal header field information and saving computing resources.

[0093] For the document data input into the input parameter matcher, the header field type corresponding to each index position in the string array used to encapsulate the parsing result of each row of document data can be determined according to the column index position of the header field type of each request field (such as number, field code, Chinese name, type, length, list value, required input, default value, etc.), and the document data corresponding to each input parameter data can be parsed to obtain the data content corresponding to each header field type.

[0094] The parsing process of the document data corresponding to each input parameter data may include the following steps B1-B4:

[0095] Step B1, perform camel case naming processing on the document data corresponding to the field code, that is, the first word starts with a lowercase letter, and the first letter of each word after the second word is capitalized, for example: myFirstName, myLastName.

[0096] Step B2, according to the mapping relationship between the document data type and the specified data type corresponding to the entity class, the document data type of each row of document data is converted. The specified data type is the data type corresponding to the element information required to generate the entity class. The specific process of the conversion will be described in detail in the following embodiment.

[0097] Step B3, for the document data corresponding to the length, filter non-numeric characters. If there is one number, it is the maximum value; if there are two numbers, they are the minimum and maximum values ​​respectively; if the type is bigdecimal and there are two numbers, the first number is the total length and the second number is the decimal place.

[0098] Assume that after filtering non-numeric characters, the document data obtained is (1), then the maximum length is 1; assume that after filtering non-numeric characters, the document data obtained is (dada1), then the maximum length is 1; assume that after filtering non-numeric characters, the document data obtained is (1dada, a2, d3n, 4), then the minimum length is 1 and the maximum length is 2; assume that after filtering non-numeric characters, the document data obtained is (10, 2, 3, 4) and the type is bigdecimal, then the total length is 10, the decimal place is 2, and the integer is 8.

[0099] Step B4, for the document data corresponding to the number, Chinese name, list value, mandatory input and default value respectively, the original content of each document data is determined as the data content for writing into the document information object corresponding to the target interface document.

[0100] For the document data input into the output parameter matcher, the header field type corresponding to each index position in the string array used to encapsulate the parsing result of each row of document data can be determined according to the column index position of the header field type of each response field (such as number, field code, Chinese name, type, length, list value, required input, default value, etc.), and the document data corresponding to each output parameter data can be parsed to obtain the data content corresponding to each header field type.

[0101] Among them, the document data corresponding to each output parameter data is parsed and processed, which can be seen from the above steps B1-B4 and will not be repeated here.

[0102] For the document data input to TailWork, TailWork further processes the inflowing data content and writes it into the document information object corresponding to the target interface document. TailWork further processes the inflowing data content by: judging the nesting relationship between each line of document data and the previous line of document data based on the difference in the number of “.” between the data number corresponding to each line of document data and the data number corresponding to the previous line of document data, and thus accurately writing each line of document data into the document information object based on the nesting relationship.

[0103] If the difference in the number of dots between the data number corresponding to a row of document data and the data number corresponding to the previous row of document data is equal to 1, it means that the number is upgraded and the row of document data belongs to the nested object of the previous row of document data. For example, if the data number corresponding to a row of document data is 1.1 and the data number corresponding to the previous row of document data is 1, the difference in the number of dots between the two is equal to 1, and the document data with the data number 1.1 is the nested object of the document data with the data number 1.

[0104] In the case where the document information object is a DocClassDefine object, assuming that the document information object written in the previous line of document data is the DocClassDefine object corresponding to the node current, then a DocClassDefine object corresponding to the node next can be created to represent the child document information object, and a bidirectional linked list relationship can be established between the DocClassDefine object corresponding to the node current and the DocClassDefine object corresponding to the node next. Through this bidirectional linked list relationship, the DocClassDefine object corresponding to the node current and the DocClassDefine object corresponding to the node next can be switched between each other. Then, the DocClassDefine object corresponding to the node current points to the DocClassDefine object corresponding to the node next, and the line of document data is added to the DocClassDefine object corresponding to the node next for correct storage.

[0105] If the difference in the number of "." between the data number corresponding to a row of document data and the data number corresponding to the previous row of document data is greater than 1, a prompt message is output to indicate that the target interface document number is abnormal, and the interface document parsing task with the abnormal number is terminated in time, thereby saving computing resources.

[0106] If the difference in the number of "." between the data number corresponding to a row of document data and the data number corresponding to the previous row of document data is equal to 0, it means that the data number level of this row of document data is the same as that of the previous row of document data, and this row of document data can be written into the document information object written into the previous row of document data.

[0107] If the difference in the number of "." between the data number corresponding to a row of document data and the data number corresponding to the previous row of document data is less than 0, it means that the data number is downgraded. A difference of -1 means that the parent level is the same as the previous row of document data, a difference of -2 means that the grandparent level is the same as the previous row of document data, and so on. In this embodiment, the document information object to which the row of document data should be written can be accurately determined through the established bidirectional linked list relationship, so that the row of document data can be written.

[0108] Optionally, document data with the same data number level and pointing to the same parent document information object will be written into the same document information object. A bidirectional linked list relationship is established inside the document information object, and there is always an initial node root that associates all the information of the entire interface document. For example, if there are 3 rows of document data in a nested relationship of grandfather-father-child, then 3 new document information objects will be created to represent grandfather, father, and child, and have the following mutual reference relationship: root = grandfather <=> father <=> child, that is, the initial node is the grandfather-level document information object, the father is the grandfather's child document information object, and the child is the father's child document information object.

[0109] For example, for document data with a grandfather-father-child nested relationship, the bidirectional linked list relationship established within the document information object can be as follows: Figure 3 As shown, 310 is a grandparent document information object, 320 is a parent document information object, and 330 is a child document information object. Assuming that the data content of the document data with data numbers 1 and 2 is written in 310, then the data content of the document data with data numbers 1.1 and 2.1 may be written in the two parent document information objects in 320, and the data content of the document data with data numbers 1.1.1 and 2.1.1 may be written in the two child document information objects in 330.

[0110] In one embodiment, as in the following steps C1-C3, for each line of document data, the document data is parsed, and the specific implementation methods of determining the target field type corresponding to the document data according to the parsing result are:

[0111] Step C1, matching the document data with at least one of a plurality of second preset keywords.

[0112] The field type corresponding to each second preset keyword may be a request interface name or a response interface name, and the multiple second preset keywords include preset keywords corresponding to at least one field type. Optionally, the multiple second preset keywords may include at least one of a preset keyword corresponding to a request interface name and a preset keyword corresponding to a response interface name. Matching the document data with at least one of the multiple second preset keywords may be performed as follows: matching the document data with the preset keyword corresponding to the request interface name and the preset keyword corresponding to the response interface name, respectively; or matching the document data with the preset keyword corresponding to the request interface name; or matching the document data with the preset keyword corresponding to the response interface name.

[0113] Step C2: if the document data matches at least one of the plurality of second preset keywords, then the field type corresponding to the second preset keyword matching the document data is determined as the target field type.

[0114] In this embodiment, if the document data matches the preset keyword corresponding to the request interface name, the field type corresponding to the preset keyword corresponding to the request interface name (i.e., the request interface name) is determined as the target field type. If the document data matches the preset keyword corresponding to the response interface name, the field type corresponding to the preset keyword corresponding to the response interface name (i.e., the response interface name) is determined as the target field type.

[0115] Step C3: if the document data does not match any of the second preset keywords, the target field type of the first document data is determined as a request field, and the target field type of the second document data is determined as a response field.

[0116] The first document data is located between the third document data and the fourth document data in the target interface document, the second document data is located after the fourth document data in the target interface document, the third document data is the document data of the target interface document whose field type is the request interface name, and the fourth document data is the document data of the target interface document whose field type is the response interface name. For example, Figure 4 As shown, 10 lines of "XXXXXX" are used to represent the target interface document. When 410 is the third document data and 420 is the fourth document data, 430 is the first document data and 440 is the second document data.

[0117] In this embodiment, by determining the third document data corresponding to the request interface name and the fourth document data corresponding to the response interface name, the first document data corresponding to the request field in the target interface document and the second document data corresponding to the response field are accurately obtained according to the position of each line of document data in the target interface document, thereby improving the accuracy of the target field type corresponding to each line of document data.

[0118] In one embodiment, after the target field type of the first document data is determined as the request field, and the target field type of the second document data is determined as the response field (i.e., step C3), the header field information of the request field can be determined based on the document data whose target field type is the request field, and the header field information of the response field can be determined based on the document data whose target field type is the response field. If the header field information corresponding to the request field and the response field respectively do not match, a second prompt message is output; if the header field information corresponding to the request field and the response field respectively matches, the interface document parsing task continues to be executed.

[0119] The header field information may include at least one of the number of header fields, the type of header fields, and the order of header fields, and the second prompt information is used to prompt that the target interface document parsing fails. Optionally, according to the document data whose target field type is the request field, the specific implementation method of determining the header field information of the request field can refer to the relevant content of matching the document data by the request header matcher in the above embodiment, and according to the document data whose target field type is the response field, the specific implementation method of determining the header field information of the response field can refer to the relevant content of matching the document data by the response header matcher in the above embodiment.

[0120] Optionally, the mismatch in the header field information corresponding to the request field and the response field may be that the header field information of the request field and the header field information of the response field are inconsistent in at least one of the number of header fields, the type of header fields, and the order of header fields.

[0121] For example, the number of header fields of the request field is 8, and the header field types of the request field include number, field code, Chinese name, type, length, list value, required input and default value, and the header field order of the request field is number, field code, Chinese name, type, length, list value, required input and default value. Then, when the number of header fields of the response field is 7, or the header field types of the response field include number, Chinese name, field code, type, length, list value, required input and default value, or the header field order of the response field is number, field code, Chinese name, length, type, list value, required input and default value, it can be determined that the header field information corresponding to the request field and the response field respectively do not match. When the number of header fields in the response field is 8, the header field types of the response field include number, field code, Chinese name, type, length, list value, required input and default value, and the header field sequence of the response field is number, field code, Chinese name, type, length, list value, required input and default value, it can be determined that the header field information corresponding to the request field and the response field respectively matches.

[0122] In this embodiment, by outputting a prompt message indicating that the target interface document parsing has failed when it is determined that the header field information corresponding to the request field and the response field do not match, it is beneficial to promptly terminate the interface document parsing task with abnormal header field information, thereby saving computing resources.

[0123] In one embodiment, before writing the data content of each line of document data into the document information object corresponding to the target interface document (ie, S106) according to the target field type corresponding to each line of document data, the following steps D1-D2 may be performed:

[0124] Step D1, obtaining a target mapping relationship, wherein the target mapping relationship is a mapping relationship between a document data type and a specified data type corresponding to an entity class, and the specified data type is a data type corresponding to element information required to generate an entity class.

[0125] Exemplarily, when the specified data type corresponding to the entity class is a Java type, the mapping relationship between the document data type and the Java type may be as shown in Table 7.

[0126] Table 7

[0127] Document data type Java Types obj / ref / object Reference Class list List<Reference Class> varchar / varchar2 / char String string / str / datestring String date LocalDate timestamp / time LocalDateTime decimal / bigdecimal BigDecimal float Float double Double int / integer Integer

[0128] Step D2: convert the document data type of each row of document data according to the target mapping relationship.

[0129] In this embodiment, if the target mapping relationship includes a mapping relationship between a document data type corresponding to the document data and a specified data type, the document data type of the document data is converted into the specified data type mapped by the mapping relationship.

[0130] Exemplarily, using the mapping relationship shown in Table 7, when the document data type of the document data is date, the document data type of the document data may be converted into LocalDate.

[0131] In this embodiment, if the target mapping relationship does not include a mapping relationship between a document data type corresponding to the document data and a specified data type, the document data type of the document data is converted into a default data type corresponding to the entity class.

[0132] Exemplarily, when the entity class is a Java entity class, the default data type may be String. Following the mapping relationship shown in Table 7, when the document data type of the document data is long, since long is not a document data type included in the mapping relationship, the document data data type may be converted to String.

[0133] In this embodiment, if the document data type of the document data in the nested relationship is a non-reference type, it is forced to be converted to ref by default. As shown in Table 8, field b has a data number upgrade, but the document data type of field b is long. Since long is not a document data type included in the mapping relationship (the mapping relationship shown in Table 7 is used), the document data type of field b can be converted to ref.

[0134] Table 8

[0135] serial number Fields Chinese name type 2 b long 2.1 c string

[0136] In this embodiment, if the document data type of ordinary (i.e., no nested relationship) document data is a reference type, it is forcibly converted to the default data type corresponding to the entity class (e.g., when the entity class is a Java entity class, the default data type is string). As shown in Table 9, there is no data number upgrade in field a, but the document data type of field a is a reference type ref, which is inconsistent with the record in the mapping relationship (the mapping relationship shown in Table 7 is used), so the document data type of field a can be converted to string.

[0137] Table 9

[0138] serial number Fields Chinese name type 1 a ref 2 b string

[0139] In this embodiment, by obtaining the mapping relationship between the document data type and the specified data type corresponding to the entity class, and converting the document data type of each row of document data into the specified data type corresponding to the entity class or the default data type corresponding to the entity class according to the mapping relationship, it is helpful to ensure the standardization of the data content written into the document information object.

[0140] In one embodiment, for document data that does not have a nested relationship, the data content of the document data is written into the document information object corresponding to the target interface document (i.e., S106) according to the target field type corresponding to the document data, which can be executed as follows: the data content of the document data whose field type is the request interface name is written into the position corresponding to the preset request interface name; the data content of the document data whose field type is the response interface name is written into the position corresponding to the preset response interface name; the data content of the document data whose field type is the request field is written into the position corresponding to the preset request field; the data content of the document data whose field type is the response field is written into the position corresponding to the preset response field.

[0141] The document information object includes a preset request interface name, a preset response interface name, a preset request field, and a preset response field.

[0142] Optionally, the data content of the document data whose field type is the request interface name is written into the position corresponding to the preset request interface name, that is, assigning a value to the position corresponding to the preset request interface name. The data content of the document data whose field type is the response interface name is written into the position corresponding to the preset response interface name, that is, assigning a value to the position corresponding to the preset response interface name. The data content of the document data whose field type is the request field is written into the position corresponding to the preset request field, that is, assigning a value to the position corresponding to the preset request field. The data content of the document data whose field type is the response field is written into the position corresponding to the preset response field, that is, assigning a value to the position corresponding to the preset response field.

[0143] In this embodiment, by writing the data content of each line of document data into the position corresponding to each field type in the document information object corresponding to the target interface document according to the respective field types, accurate storage of each data content in the document information object is effectively ensured.

[0144] In one embodiment, each line of document data corresponds to its own data number. For document data with a nested relationship, as in the following steps E1-E4, for each line of document data whose target field type is a request field or a response field, the specific implementation methods of writing the data content of the document data into the document information object are:

[0145] Step E1, determining the current field level corresponding to the current row of document data according to the data number.

[0146] Step E2: If the current field level is the same as the field level corresponding to the document data located in the previous line of the current line of document data in the target interface document, the data content of the current line of document data is written into the first document information sub-object corresponding to the previous line of document data.

[0147] Optionally, it is possible to determine whether the current field level is the same as the field level corresponding to the previous line of document data based on the difference in the number of “.” between the data number corresponding to the current line of document data and the data number corresponding to the previous line of document data; if the difference is 0, the current field level is the same as the field level corresponding to the previous line of document data; if the difference is equal to 1, the current field level belongs to the next level or the previous level of the field level corresponding to the previous line of document data.

[0148] Step E3, if the current field level is lower than the field level corresponding to the previous row of document data, then according to the bidirectional linked list relationship between the first document information sub-object and the second document information sub-object, the data content of the current row of document data is written into the second document information sub-object, and the second document information sub-object is a nested object of the first document information sub-object.

[0149] Wherein, relative to the second document information sub-object, the first document information sub-object is a parent document information object; relative to the first document information sub-object, the second document information sub-object is a child document information object.

[0150] Step E4, if the current field level is higher than the field level corresponding to the previous row of document data, then according to the bidirectional linked list relationship between the first document information sub-object and the third document information sub-object, the data content of the current row of document data is written into the third document information sub-object, and the first document information sub-object is a nested object of the third document information sub-object.

[0151] Wherein, relative to the third document information sub-object, the first document information sub-object is a child document information object; relative to the first document information sub-object, the third document information sub-object is a parent document information object.

[0152] In this embodiment, the data number corresponding to each line of document data can be used to accurately determine the hierarchical relationship between the current field level corresponding to the current line of document data and the field level corresponding to the previous line of document data, so that document data with nested relationships can be accurately written into the corresponding document information sub-objects, which is conducive to the accurate parsing of complex nested class interface documents.

[0153] In one embodiment, if the level difference between the current field level and the field level corresponding to the previous line of document data is greater than 1, a first prompt message is output, and the first prompt message is used to prompt that the numbering of the target interface document is abnormal.

[0154] Optionally, the difference in the number of “.” between the data number corresponding to the current line of document data and the data number corresponding to the previous line of document data can be used to determine whether the level difference between the current field level and the field level corresponding to the previous line of document data is greater than 1, where one “.” represents one level difference.

[0155] For example, the current field level is 1.1.1, and the field level corresponding to the previous line of document data is 1. Since there are two dots between the two, it can be determined that the level difference between the current field level and the field level corresponding to the previous line of document data is greater than 1.

[0156] In this embodiment, by outputting a prompt message to indicate that the target interface document has a numbering abnormality when it is determined that the level difference between the current field level and the field level corresponding to the previous line of document data is greater than 1, it is beneficial to promptly terminate the interface document parsing task with the numbering abnormality, save computing resources, and help ensure the accuracy of the entity class of the interface document finally generated.

[0157] In one embodiment, before writing the data content of the current row of document data into the second document information sub-object (i.e., step E3), a second document information sub-object corresponding to the current row of document data may be created, and a bidirectional linked list relationship between the second document information sub-object and the first document information sub-object may be established, wherein the second document information sub-object is a nested object of the first document information sub-object.

[0158] Optionally, if Figure 2 The executor chain shown parses the document data, thereby writing the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data. When writing each line of document data, if the field level of the current line of document data is lower than the field level corresponding to the previous line of document data, a lower-level document information sub-object (such as the second document information sub-object) is created in real time, and a bidirectional linked list relationship is created. According to the above steps E1-E4, it can be determined that the first document information sub-object belongs to the nested object of the third document information sub-object, and the second document information sub-object belongs to the nested object of the first document information sub-object. Therefore, before writing the data content of the current line of document data into the first document information sub-object, the first document information sub-object corresponding to the document data can be created, and a bidirectional linked list relationship between the first document information sub-object and the third document information sub-object can be established.

[0159] Optionally, the creation of a bidirectional linked list relationship can refer to Figure 3 In the embodiment shown, the bidirectional linked list relationship between the document information sub-objects can be as follows Figure 3 As shown, 310 is the third document information sub-object, 320 is the first document information sub-object, and 330 is the second document information sub-object.

[0160] In this embodiment, when the current field level corresponding to the current row of document data is lower than the field level corresponding to the previous row of document data, a second document information sub-object corresponding to the current row of document data is created, and a bidirectional linked list relationship is established between the second document information sub-object and the first document information sub-object. This provides a basis for accurately writing document data with nested relationships into corresponding document information sub-objects, and is conducive to accurate parsing of complex nested class interface documents.

[0161] In one embodiment, after creating a second document information sub-object corresponding to the current row of document data, the data content of the row of document data with the latest writing time in the first document information sub-object can be deleted, and the data content of the deleted document data can be written into the second document information sub-object, and the interface name corresponding to the second document information sub-object can be determined based on the deleted document data and the interface name corresponding to the first document information sub-object.

[0162] The interface name may include the request interface name, the request interface Chinese name, the response interface name, the response interface Chinese name, etc.

[0163] Optionally, writing the data content of the deleted document data into the second document information sub-object can be executed as follows: assigning the data content of the deleted document data to the attributes of the second document information sub-object, the content in the attribute (i.e., the data content of the deleted document data) is the source of the field values ​​corresponding to the field types such as the request interface name, request interface Chinese name, response interface name, and response interface Chinese name of the second document information sub-object.

[0164] Optionally, the interface name corresponding to the second document information sub-object is determined based on the deleted document data and the interface name corresponding to the first document information sub-object, that is, the interface name corresponding to the second document information sub-object is determined based on the field value of the field code recorded in the attributes of the second document information sub-object and the interface name corresponding to the first document information sub-object. For example, if the field value of the field code recorded in the attributes of the second document information sub-object is cust_acct_num, and the request interface name corresponding to the first document information sub-object is QuotaInfo, then the request interface name corresponding to the second document information sub-object can be determined to be: QuotaInfoCustAcctNumReq.

[0165] In this embodiment, by deleting the data content of the line of document data with the latest writing time in the first document information sub-object, and determining the interface name corresponding to the second document information sub-object based on the deleted document data and the interface name corresponding to the first document information sub-object, the nested relationship between the document information sub-objects can be accurately and intuitively reflected based on the interface name corresponding to the second document information sub-object, which is conducive to directly generating nested classes based on the document information sub-objects in subsequent embodiments.

[0166] The following example describes how to create a document information object and write the data content of each line of document data into the document information object corresponding to the target interface document.

[0167] Before executing the interface document parsing task, first create a document information object and assign it to the initial node root, and then assign it to the node current.

[0168] Then, the interface document parsing task is executed, and each line of document data of the target interface document is read from top to bottom in sequence, and each line of document data is matched and parsed. When the data number of the document data parsed is 1, the data content of the document data of this line is written into the document information object corresponding to the node current; when the data number of the document data parsed is 2, since the data number level of data number 2 and data number 1 are the same, the data content of the document data of data number 2 is still written into the document information object corresponding to the node current; when the data number of the document data parsed is 2.1, since data number 2.1 is an upgraded number compared to data number 2 of the previous line of document data, the data content of the document data of data number 2 in the document information object corresponding to the node current can be deleted, and a new document information object is created and assigned to the node next, and the data content of the document data of data number 2 is assigned to the attribute of the document information object corresponding to the node next, and then the node current points to the node next, so that the data content of the document data of data number 2.1 is written into the document information object corresponding to the node next.

[0169] When the data number of the parsed document data is 3, since data number 3 is a downgraded number compared to data number 2.1 of the previous line of document data, the parent document information object of the document information object corresponding to the node next can be obtained, that is, the document information object corresponding to the node current can be obtained, thereby writing the data content of the document data with data number 3 into the document information object corresponding to the node current.

[0170] In one embodiment, the entity class information object may include the following information: package name, dependent package name, class name, inherited parent class, implemented interface, document comment on the class, annotation on the class, and attribute field. Attribute field may include field comment, field annotation, field access modifier, field type, field name, field default value, etc. Converting the document information object to the entity class information object (i.e. S108) may be performed as follows: Steps F1-F8:

[0171] Step F1, obtain the package name from the configuration information. If the target interface document is parsed based on the Excel interface document template, the configuration information is the configuration information of the Excel interface document template. Multiple sheets in the Excel interface document template can share one configuration information, or one sheet corresponds to one configuration information. Step F2, determine the dependent package name of the annotation (including class annotation and field annotation), parent class, interface name and field type. Step F3, determine the class name: the outermost class uses the request interface name or response interface name as the class name; the nested class name is a combination of the interface name of the parent class and the field name of the nested field. Step F4, obtain the inherited parent class from the configuration information. As described in step F1, the configuration information can be the configuration information of the Excel interface document template. Step F5, obtain the implementation interface from the configuration information. As described in step F1, the configuration information can be the configuration information of the Excel interface document template. Step F6, determine the parsed request interface Chinese name or response interface Chinese name as the document comment on the class. Step F7, determine the class annotation through the existing annotation plug-in.

[0172] Step F8, determine the attribute field: determine the field value corresponding to the Chinese name in the header field information as the field annotation; determine the field annotation through the existing annotation plug-in; use private as the access modifier of the field; convert the field value corresponding to the type in the header field information to the specified data type (such as Java type) corresponding to the entity class; determine the field value corresponding to the field code in the header field information as the field name; determine the field value corresponding to the default value in the header field information as the field default value.

[0173] The entity class generation method provided by the present application is explained below through a specific business scenario. In a business scenario, the document information object is represented by a table. After the data content of each row of document data obtained by parsing the target interface document based on the Excel interface document template is written into the document information object, the document information object shown in Table 10 and Table 11 can be obtained. Table 11 is a nested object of Table 10. It should be noted that Table 10 and Table 11 are only schematic displays of the document information object, and the request response identifier and the bidirectional linked list relationship are not reflected in Table 10 and Table 11.

[0174] In this business scenario, the field value corresponding to the request interface name in the parent document information object is QuotaInfo, the field value corresponding to the request interface Chinese name is product quota information, the request field and response field respectively contain the field values ​​corresponding to the number, field code, Chinese name, type, length, list value, default value and required input, the field value corresponding to the response interface name is RespQueryQuota, and the field value corresponding to the response interface Chinese name is product quota information query response message. The field value corresponding to the request interface name in the child document information object is QuotaInfoCustAcctNumReq, the field value corresponding to the request interface Chinese name is product quota information#customer account number, and the request field respectively contains the field values ​​corresponding to the number, field code, Chinese name, type, length, list value, default value and required input. Figure 5 The illustrated embodiment is described using this scenario as an example.

[0175] Table 10

[0176]

[0177] Table 11

[0178]

[0179] Figure 5 is a schematic flow chart of an entity class generation method according to another embodiment of the present application, such as Figure 5 As shown, the method may include:

[0180] S501, obtaining a target interface document to be parsed, where the target interface document includes multiple lines of document data.

[0181] S502, for each line of document data, match the document data with at least one of the multiple second preset keywords, and determine the third document data whose field type is the request interface name and the fourth document data whose field type is the response interface name according to the matching result.

[0182] In this embodiment, the field type corresponding to each second preset keyword may be a request interface name or a response interface name, and the multiple second preset keywords include preset keywords corresponding to at least one field type. Optionally, the multiple second preset keywords may include at least one of a preset keyword corresponding to the request interface name and a preset keyword corresponding to the response interface name. Matching the document data with at least one of the multiple second preset keywords may be performed as follows: matching the document data with the preset keyword corresponding to the request interface name and the preset keyword corresponding to the response interface name, respectively; or matching the document data with the preset keyword corresponding to the request interface name; or matching the document data with the preset keyword corresponding to the response interface name.

[0183] If the document data matches the preset keyword corresponding to the request interface name, the field type corresponding to the preset keyword corresponding to the request interface name (i.e., the request interface name) is determined as the target field type, and the document data is the third document data. If the document data matches the preset keyword corresponding to the response interface name, the field type corresponding to the preset keyword corresponding to the response interface name (i.e., the response interface name) is determined as the target field type, and the document data is the fourth document data.

[0184] S503, determining the target field type of the first document data located between the third document data and the fourth document data in the target interface document as the request field, and determining the target field type of the second document data located after the fourth document data in the target interface document as the response field.

[0185] In one embodiment, after determining the target field type of the first document data as the request field and the target field type of the second document data as the response field, the header field information of the request field can be determined according to the document data whose target field type is the request field, and the header field information of the response field can be determined according to the document data whose target field type is the response field, and when the header field information corresponding to the request field and the response field do not match, the second prompt information for prompting the failure of parsing the target interface document is output. The header field information may include at least one of the number of header fields, the type of header fields, and the order of header fields.

[0186] S504: for each line of document data whose target field type is a request field or a response field, determine the current field level corresponding to the current line of document data according to the data number, and then execute S505 or S506.

[0187] Among them, each line of document data corresponds to its own data number. According to the difference in the number of "." between the data number corresponding to the current line of document data and the data number corresponding to the document data located in the previous line of document data in the target interface document, it can be judged whether the current field level is the same as the field level corresponding to the previous line of document data; if the difference is 0, the current field level is the same as the field level corresponding to the previous line of document data; if the difference is equal to 1, the current field level belongs to the next level or the previous level of the field level corresponding to the previous line of document data. If the level difference between the current field level and the field level corresponding to the previous line of document data is greater than 1, the first prompt information for prompting the abnormal numbering of the target interface document is output.

[0188] S505: If the current field level is the same as the field level corresponding to the document data located in the previous line of document data in the target interface document, the data content of the current line of document data is written into the document information object corresponding to the previous line of document data. Then, S507 is executed.

[0189] As shown in Table 10, the field levels of the document data corresponding to data number 1, the document data corresponding to data number 2, and the document data corresponding to data number 3 are the same. Therefore, the data content corresponding to data number 1, the data content corresponding to data number 2, and the data content corresponding to data number 3 can all be written into the document information object shown in Table 10.

[0190] In one embodiment, before writing the data content of the current row of document data into the document information object, the mapping relationship between the document data type and the specified data type corresponding to the entity class may be obtained, and the document data type of the current row of document data may be converted according to the mapping relationship. If the mapping relationship includes the mapping relationship between the document data type corresponding to the current row of document data and the specified data type, the document data type of the current row of document data may be converted to the specified data type mapped by the mapping relationship; if the mapping relationship does not include the mapping relationship between the document data type corresponding to the current row of document data and the specified data type, the document data type of the current row of document data may be converted to the default data type corresponding to the entity class.

[0191] S506: If the current field level is lower than the field level corresponding to the previous line of document data, the data content of the current line of document data is written into the child document information object according to the bidirectional linked list relationship between the document information object and the child document information object.

[0192] In this embodiment, before writing the data content of the current row of document data into the child document information object (i.e., the document information object shown in Table 11), a child document information object corresponding to the current row of document data (i.e., the document information object shown in Table 11) can be created, and a bidirectional linked list relationship between the document information object (i.e., the document information object shown in Table 10) and the child document information object (i.e., the document information object shown in Table 11) can be established.

[0193] After creating a child document information object corresponding to the current row of document data, the data content of the row of document data with the latest writing time in the document information object can be deleted, and the data content of the deleted document data can be written into the child document information object. Based on the deleted document data and the interface name corresponding to the document information object, the interface name corresponding to the child document information object can be determined.

[0194] As shown in Table 11, the field level of the document data corresponding to data number 3.1 is lower than the field level of the document data corresponding to data number 3. Therefore, according to the bidirectional linked list relationship between Table 10 and Table 11, the data content corresponding to data number 3.1 can be written into the sub-level document information object shown in Table 11.

[0195] S507: Convert each document information object into an entity class information object, where the entity class information object includes element information required for generating an entity class.

[0196] In this embodiment, the document information objects shown in Table 10 and the document information objects shown in Table 11 need to be converted into entity information objects respectively. The specific conversion method can refer to the above steps F1-F8 and will not be repeated here.

[0197] S508, inputting each entity class information object into a pre-deployed entity class generation model to perform entity class generation processing to obtain a target entity class corresponding to the target interface document.

[0198] Exemplarily, each document information object can be converted into an entity class information object according to the data content of the document data with data number 3 shown in Table 10, and the data content of the document data with data number 3.1 and the data content of the document data with data number 3.2 shown in Table 11, so that each entity class information object is input into a pre-deployed entity class generation model for entity class generation processing to obtain a target entity class corresponding to the target interface document, and the target entity class is a nested class, which includes an entity class (parent class) with a class name of QuotaInfo and a nested object entity class (child class) with a class name of QuotaInfoCustAcctNumReq.

[0199] For example, the entity class named QuotaInfo is as follows:

[0200] package req;

[0201] import javax.validation.Valid;

[0202] import lombok.Setter;

[0203] import javax.validation.constraints.NotBlank;

[0204] import lombok.Getter;

[0205] import com.alibaba.fastjson.annotation.JSONField;

[0206] import java.io.Serializable;

[0207] import org.hibernate.validator.constraints.Length;

[0208] / **

[0209] *Product quota information

[0210] *

[0211] *doc-obj is automatically generated

[0212] *

[0213] *@date 2022-01-05

[0214] * @author doc-obj

[0215] * @since 1.0

[0216] * /

[0217] @Setter

[0218] @Getter

[0219] public class QuotaInfo implements Serializable{

[0220] / **

[0221] *Customer Account Number

[0222] * /

[0223] @JSONField(name="cust_acct_num")

[0224] @Valid

[0225] private QuotaInfoCustAcctNumReq custAcctNum;

[0226] }

[0227] For example, a nested object entity class with a class name of QuotaInfoCustAcctNumReq is as follows:

[0228] package req;

[0229] import lombok.Setter;

[0230] import lombok.Getter;

[0231] import com.alibaba.fastjson.annotation.JSONField;

[0232] import java.io.Serializable;

[0233] import org.hibernate.validator.constraints.Length;

[0234] / **

[0235] *Product amount information#Customer account

[0236] *

[0237] *doc-obj is automatically generated

[0238] *

[0239] *@date 2022-01-05

[0240] * @author doc-obj

[0241] * @since 1.0

[0242] * /

[0243] @Setter

[0244] @Getter

[0245] public class QuotaInfoCustAcctNumReq implements Serializable{

[0246] / **

[0247] *Account Name

[0248] * /

[0249] @JSONField(name="acc_nm")

[0250] @Length(max=750,message="The maximum length of account name [acc_nm] is

[750] ")

[0251] private String accNm;

[0252] / **

[0253] *Frozen Type

[0254] * /

[0255] @JSONField(name="frz_catg")

[0256] @Length(max=2,message="The maximum length of the frozen type [frz_catg] is [2]")

[0257] private String frzCatg;

[0258] }

[0259] The specific process of S501-S508 has been described in detail in the above embodiment and will not be repeated here.

[0260] By adopting the technical solution of the embodiment of the present application, by obtaining the target interface document to be parsed, each line of document data of the target interface document is automatically parsed, and the target field type corresponding to each line of document data is determined according to the parsing result, and according to the target field type corresponding to each line of document data, the data content of each line of document data is automatically written into the document information object corresponding to the target interface document, thereby converting the document information object into an entity class information object, and the entity class information object includes the element information required for generating the entity class, and then the entity class information object is input into the pre-deployed entity class generation model for entity class generation processing, and the target entity class corresponding to the target interface document is obtained. It can be seen that in the process of generating the entity class of the interface document, there is no need for developers to participate, so it can avoid the problem of long time consumption in generating the entity class due to differences in the business capabilities and business proficiency of developers, and improve the efficiency of entity class generation. Moreover, the entity class corresponding to the interface document is generated through the entity class generation model. Due to the universality of the entity class generation model, it can be applied to various interface documents, and thus can be applied to various system interfaces that provide interface documents (such as third-party system interfaces). It not only achieves the universality of the generated entity class, but also makes the entity classes generated for different interface documents consistent, thereby avoiding the problem of non-standard entity classes caused by different coding styles of developers, improving the standardization of entity classes, and thus improving the maintainability of entity classes.

[0261] In summary, specific embodiments of the present subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recorded in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing can be advantageous.

[0262] The above is an entity class generation method provided in an embodiment of the present application. Based on the same idea, an entity class generation device is also provided in an embodiment of the present application.

[0263] Figure 6 This is a schematic diagram of the structure of an entity class generation device according to an embodiment of the present application. Figure 6 , the entity class generating device may include:

[0264] The first acquisition module 610 is used to acquire a target interface document to be parsed; the target interface document includes multiple lines of document data;

[0265] The parsing and determining module 620 is used to parse each line of document data of the target interface document and determine the target field type corresponding to each line of document data according to the parsing result;

[0266] A writing module 630, used to write the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data;

[0267] The first conversion module 640 is used to convert the document information object into an entity class information object; the entity class information object includes element information required for generating an entity class;

[0268] The input and generation module 650 is used to input the entity class information object into the pre-deployed entity class generation model to perform entity class generation processing to obtain the target entity class corresponding to the target interface document.

[0269] In one embodiment, the parsing and determining module 620 includes:

[0270] a matching and determining unit, configured to match the document data with at least one of the plurality of first preset keywords for each line of document data, and determine the field type corresponding to the first preset keyword matching the document data as the target field type;

[0271] The target field type includes one of a request interface name, a response interface name, a request field, and a response field.

[0272] In one embodiment, the parsing and determining module 620 includes:

[0273] a matching unit, configured to match the document data with at least one of a plurality of second preset keywords for each line of document data, wherein the field type corresponding to the second preset keyword includes a request interface name or a response interface name, and the plurality of second preset keywords include a preset keyword corresponding to at least one field type;

[0274] a first determining unit, configured to determine, if the document data matches at least one of the plurality of second preset keywords, a field type corresponding to the second preset keyword matching the document data as a target field type;

[0275] The second determination unit is used to determine the target field type of the first document data as a request field, and to determine the target field type of the second document data as a response field if the document data does not match any of the multiple second preset keywords; wherein the first document data is located between the third document data and the fourth document data in the target interface document, the second document data is located after the fourth document data in the target interface document, the third document data is the document data in the target interface document whose field type is the request interface name, and the fourth document data is the document data in the target interface document whose field type is the response interface name.

[0276] In one embodiment, the document information object includes a preset request interface name, a preset response interface name, a preset request field, and a preset response field; the writing module 630 includes:

[0277] The first writing unit is used to write the data content of the document data whose field type is the request interface name into the position corresponding to the preset request interface name; write the data content of the document data whose field type is the response interface name into the position corresponding to the preset response interface name; write the data content of the document data whose field type is the request field into the position corresponding to the preset request field; write the data content of the document data whose field type is the response field into the position corresponding to the preset response field.

[0278] In one embodiment, each row of document data corresponds to a respective data number;

[0279] For each line of document data whose target field type is a request field or a response field, the writing module 630 includes:

[0280] A third determining unit, used to determine the current field level corresponding to the document data according to the data number;

[0281] A second writing unit is used to write the data content of the document data into the first document information sub-object corresponding to the previous line of document data if the current field level is the same as the field level corresponding to the document data located in the previous line of document data in the target interface document;

[0282] A third writing unit is used to write the data content of the document data into the second document information sub-object according to the bidirectional linked list relationship between the first document information sub-object and the second document information sub-object if the current field level is lower than the field level corresponding to the previous line of document data, and the second document information sub-object is a nested object of the first document information sub-object;

[0283] The fourth writing unit is used to write the data content of the document data into the third document information sub-object according to the bidirectional linked list relationship between the first document information sub-object and the third document information sub-object if the current field level is higher than the field level corresponding to the previous line of document data. The first document information sub-object is a nested object of the third document information sub-object.

[0284] In one embodiment, the entity class generating device further includes:

[0285] A creation module, used for creating a second document information sub-object corresponding to the document data before writing the data content of the document data into the second document information sub-object;

[0286] An establishing module is used to establish a bidirectional linked list relationship between the second document information sub-object and the first document information sub-object.

[0287] In one embodiment, the entity class generating device further includes:

[0288] A deleting and writing module, used to delete the data content of a row of document data with the latest writing time in the first document information sub-object after creating the second document information sub-object corresponding to the document data, and write the data content of the deleted document data into the second document information sub-object;

[0289] The first determining module is used to determine the interface name corresponding to the second document information sub-object according to the deleted document data and the interface name corresponding to the first document information sub-object.

[0290] In one embodiment, the entity class generating device further includes:

[0291] The first output module is used to output a first prompt message if the level difference between the current field level and the field level corresponding to the previous line of document data is greater than 1, and the first prompt message is used to prompt that the numbering of the target interface document is abnormal.

[0292] In one embodiment, the entity class generating device further includes:

[0293] The second acquisition module is used to acquire a target mapping relationship before writing the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data, wherein the target mapping relationship is a mapping relationship between the document data type and the specified data type corresponding to the entity class, and the specified data type is a data type corresponding to the element information required to generate the entity class;

[0294] A second conversion module, used to convert the document data type of each row of document data according to the target mapping relationship;

[0295] If the target mapping relationship includes a mapping relationship between a document data type corresponding to the document data and a specified data type, the document data type of the document data is converted into the specified data type mapped by the mapping relationship;

[0296] If the target mapping relationship does not include a mapping relationship between the document data type corresponding to the document data and the specified data type, the document data type of the document data is converted to a default data type corresponding to the entity class.

[0297] In one embodiment, the entity class generating device further includes:

[0298] A second determination module is used to determine, after determining the target field type of the first document data as the request field and the target field type of the second document data as the response field, the header field information of the request field according to the document data whose target field type is the request field; and determine the header field information of the response field according to the document data whose target field type is the response field; the header field information includes at least one of the number of header fields, the type of header fields, and the order of header fields;

[0299] The second output module is used to output second prompt information if the header field information corresponding to the request field and the response field respectively does not match, and the second prompt information is used to prompt that the target interface document parsing fails.

[0300] The device of the embodiment of the present application automatically parses each line of document data of the target interface document by acquiring the target interface document to be parsed, determines the target field type corresponding to each line of document data according to the parsing result, and automatically writes the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data, thereby converting the document information object into an entity class information object, the entity class information object includes element information required for generating the entity class, and then inputs the entity class information object into the pre-deployed entity class generation model for entity class generation processing, and obtains the target entity class corresponding to the target interface document. It can be seen that in the process of generating the entity class of the interface document, there is no need for developers to participate, so it can avoid the problem of long time consumption in generating the entity class due to differences in the business capabilities and business proficiency of developers, and improve the efficiency of entity class generation. Moreover, the entity class corresponding to the interface document is generated through the entity class generation model. Due to the universality of the entity class generation model, it can be applied to various interface documents, and thus can be applied to various system interfaces that provide interface documents (such as third-party system interfaces). It not only achieves the universality of the generated entity class, but also makes the entity classes generated for different interface documents consistent, thereby avoiding the problem of non-standard entity classes caused by different coding styles of developers, improving the standardization of entity classes, and thus improving the maintainability of entity classes.

[0301] Those skilled in the art should understand that Figure 6 The entity class generation device in can be used to implement the entity class generation method described above, and the detailed description thereof should be similar to the description of the method part above. To avoid tediousness, it will not be repeated here.

[0302] Based on the same idea, the embodiment of the present application also provides an electronic device, such as Figure 7 As shown. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 701 and memory 702, and one or more applications or data may be stored in the memory 702. Among them, the memory 702 may be a temporary storage or a permanent storage. The application stored in the memory 702 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 701 can be configured to communicate with the memory 702 to execute a series of computer executable instructions in the memory 702 on the electronic device. The electronic device may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input and output interfaces 705, and one or more keyboards 706.

[0303] Specifically in this embodiment, the electronic device includes a memory and one or more applications, wherein the one or more applications are stored in the memory, and the one or more applications may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more applications are configured to be executed by one or more processors, including computer executable instructions for performing the following:

[0304] Obtain the target interface document to be parsed; the target interface document includes multiple lines of document data;

[0305] Parse each line of document data of the target interface document, and determine the target field type corresponding to each line of document data according to the parsing result;

[0306] According to the target field type corresponding to each line of document data, write the data content of each line of document data into the document information object corresponding to the target interface document;

[0307] Convert the document information object into an entity class information object; the entity class information object includes element information required for generating an entity class;

[0308] The entity class information object is input into the pre-deployed entity class generation model to perform entity class generation processing to obtain the target entity class corresponding to the target interface document.

[0309] The device of the embodiment of the present application automatically parses each line of document data of the target interface document by acquiring the target interface document to be parsed, determines the target field type corresponding to each line of document data according to the parsing result, and automatically writes the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data, thereby converting the document information object into an entity class information object, the entity class information object includes element information required for generating an entity class, and then inputs the entity class information object into a pre-deployed entity class generation model for entity class generation processing, and obtains the target entity class corresponding to the target interface document. It can be seen that in the process of generating the entity class of the interface document, there is no need for developers to participate, so it can avoid the problem of long time consumption in generating entity classes due to differences in business capabilities and business proficiency of developers, and improve the efficiency of entity class generation. Moreover, the entity class corresponding to the interface document is generated through the entity class generation model. Due to the universality of the entity class generation model, it can be applied to various interface documents, and thus can be applied to various system interfaces that provide interface documents (such as third-party system interfaces). It not only achieves the universality of the generated entity class, but also makes the entity classes generated for different interface documents consistent, thereby avoiding the problem of non-standard entity classes caused by different coding styles of developers, improving the standardization of entity classes, and thus improving the maintainability of entity classes.

[0310] The embodiment of the present application further proposes a storage medium, which stores one or more computer programs, wherein the one or more computer programs include computer executable instructions, and when the computer executable instructions are executed by an electronic device including multiple application programs, the electronic device can execute the above-mentioned entity class generation method, and is specifically used to execute:

[0311] Obtain the target interface document to be parsed; the target interface document includes multiple lines of document data;

[0312] Parse each line of document data of the target interface document, and determine the target field type corresponding to each line of document data according to the parsing result;

[0313] According to the target field type corresponding to each line of document data, write the data content of each line of document data into the document information object corresponding to the target interface document;

[0314] Convert the document information object into an entity class information object; the entity class information object includes element information required for generating an entity class;

[0315] The entity class information object is input into the pre-deployed entity class generation model to perform entity class generation processing to obtain the target entity class corresponding to the target interface document.

[0316] By adopting the storage medium of the embodiment of the present application, by acquiring the target interface document to be parsed, each line of document data of the target interface document is automatically parsed, and the target field type corresponding to each line of document data is determined according to the parsing result, and according to the target field type corresponding to each line of document data, the data content of each line of document data is automatically written into the document information object corresponding to the target interface document, thereby converting the document information object into an entity class information object, the entity class information object includes the element information required for generating the entity class, and then the entity class information object is input into the pre-deployed entity class generation model for entity class generation processing, and the target entity class corresponding to the target interface document is obtained. It can be seen that in the process of generating the entity class of the interface document, there is no need for developers to participate, so it can avoid the problem of long time consumption of generating entity classes due to differences in business capabilities and business proficiency of developers, and improve the efficiency of entity class generation. Moreover, the entity class corresponding to the interface document is generated through the entity class generation model. Due to the universality of the entity class generation model, it can be applied to various interface documents, and thus can be applied to various system interfaces that provide interface documents (such as third-party system interfaces). It not only achieves the universality of the generated entity class, but also makes the entity classes generated for different interface documents consistent, thereby avoiding the problem of non-standard entity classes caused by different coding styles of developers, improving the standardization of entity classes, and thus improving the maintainability of entity classes.

[0317] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0318] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0319] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0320] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0321] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0322] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0323] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0324] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0325] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0326] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.

[0327] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0328] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0329] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A method for generating an entity class, characterized in that: include: Get the target interface document to be parsed; The target interface document includes multiple lines of document data; Parsing each line of document data of the target interface document, and determining the target field type corresponding to each line of document data according to the parsing result; the parsing result includes the target field type corresponding to each line of document data and the data content of each line of document data; According to the target field type corresponding to each line of document data, the data content of each line of document data is written into the document information object corresponding to the target interface document; Converting the document information object into an entity class information object; the entity class information object includes element information required for generating an entity class; The entity class information object is input into a pre-deployed entity class generation model to perform entity class generation processing to obtain a target entity class corresponding to the target interface document.

2. The method according to claim 1, characterized in that For each line of document data, the document data is parsed, and the specific implementation methods of determining the target field type corresponding to the document data according to the parsing result are: Matching the document data with at least one of a plurality of first preset keywords, and determining a field type corresponding to the first preset keyword matching the document data as the target field type; The target field type includes one of a request interface name, a response interface name, a request field, and a response field.

3. The method according to claim 1, characterized in that For each line of document data, the document data is parsed, and the specific implementation methods of determining the target field type corresponding to the document data according to the parsing result are: Matching the document data with at least one of a plurality of second preset keywords, wherein the field type corresponding to the second preset keyword includes a request interface name or a response interface name, and the plurality of second preset keywords include a preset keyword corresponding to at least one field type; If the document data matches at least one of the plurality of second preset keywords, determining the field type corresponding to the second preset keyword matching the document data as the target field type; If the document data does not match any of the multiple second preset keywords, the target field type of the first document data is determined as a request field, and the target field type of the second document data is determined as a response field; wherein the first document data is located between the third document data and the fourth document data in the target interface document, the second document data is located after the fourth document data in the target interface document, the third document data is the document data in the target interface document whose field type is the request interface name, and the fourth document data is the document data in the target interface document whose field type is the response interface name.

4. The method according to claim 2 or 3, characterized in that: The document information object includes a preset request interface name, a preset response interface name, a preset request field and a preset response field; The step of writing the data content of the document data into the document information object corresponding to the target interface document according to the target field type corresponding to the document data comprises: Write the data content of the document data whose field type is the request interface name into the position corresponding to the preset request interface name; write the data content of the document data whose field type is the response interface name into the position corresponding to the preset response interface name; write the data content of the document data whose field type is the request field into the position corresponding to the preset request field; write the data content of the document data whose field type is the response field into the position corresponding to the preset response field.

5. The method according to claim 2 or 3, characterized in that: Each row of document data corresponds to its own data number; For each line of document data whose target field type is the request field or the response field, the specific implementation methods of writing the data content of the document data into the document information object are: Determine, according to the data number, a current field level corresponding to the document data; If the current field level is the same as the field level corresponding to the document data located in the previous line of the document data in the target interface document, then the data content of the document data is written into the first document information sub-object corresponding to the previous line of document data; If the current field level is lower than the field level corresponding to the previous line of document data, then according to the bidirectional linked list relationship between the first document information sub-object and the second document information sub-object, the data content of the document data is written into the second document information sub-object, and the second document information sub-object is a nested object of the first document information sub-object; If the current field level is higher than the field level corresponding to the previous line of document data, the data content of the document data is written into the third document information sub-object based on the bidirectional linked list relationship between the first document information sub-object and the third document information sub-object, and the first document information sub-object is a nested object of the third document information sub-object.

6. The method according to claim 5, characterized in that Before writing the data content of the document data into the second document information sub-object, the method further includes: Creating a second document information sub-object corresponding to the document data; A bidirectional linked list relationship is established between the second document information sub-object and the first document information sub-object.

7. The method according to claim 6, characterized in that After creating the second document information sub-object corresponding to the document data, the method further includes: Deleting the data content of a row of document data with the latest writing time in the first document information sub-object, and writing the data content of the deleted document data into the second document information sub-object; The interface name corresponding to the second document information sub-object is determined according to the deleted document data and the interface name corresponding to the first document information sub-object.

8. The method according to claim 5, characterized in that The method further comprises: If the level difference between the current field level and the field level corresponding to the previous line of document data is greater than 1, a first prompt message is output, where the first prompt message is used to prompt that the numbering of the target interface document is abnormal.

9. The method according to claim 1, characterized in that: Before writing the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data, the method further includes: Acquire a target mapping relationship, where the target mapping relationship is a mapping relationship between a document data type and a specified data type corresponding to an entity class, where the specified data type is a data type corresponding to element information required to generate the entity class; Convert the document data type of each row of document data according to the target mapping relationship; Wherein, if the target mapping relationship includes a mapping relationship between a document data type corresponding to the document data and a specified data type, the document data type of the document data is converted into the specified data type mapped by the mapping relationship; If the target mapping relationship does not include a mapping relationship between the document data type corresponding to the document data and the specified data type, the document data type of the document data is converted into a default data type corresponding to the entity class.

10. The method according to claim 3, characterized in that After determining the target field type of the first document data as the request field and determining the target field type of the second document data as the response field, the method further includes: Determine the header field information of the request field according to the document data whose target field type is the request field; determine the header field information of the response field according to the document data whose target field type is the response field; the header field information includes at least one of the number of header fields, the type of header fields, and the order of header fields; If the header field information corresponding to the request field and the response field respectively does not match, a second prompt information is output, where the second prompt information is used to prompt that the parsing of the target interface document fails.

11. An entity class generation device, characterized in that: include: A first acquisition module is used to acquire a target interface document to be parsed; The target interface document includes multiple lines of document data; A parsing and determining module, used to parse each line of document data of the target interface document, and determine the target field type corresponding to each line of document data according to the parsing result; the parsing result includes the target field type corresponding to each line of document data and the data content of each line of document data; A writing module, used to write the data content of each line of document data into the document information object corresponding to the target interface document according to the target field type corresponding to each line of document data; A first conversion module, used to convert the document information object into an entity class information object; the entity class information object includes element information required for generating an entity class; The input and generation module is used to input the entity class information object into a pre-deployed entity class generation model to perform entity class generation processing to obtain a target entity class corresponding to the target interface document.

12. An electronic device, characterized in that: include: processor; as well as A memory arranged to store computer executable instructions, wherein the computer executable instructions are configured to be executed by the processor, and the computer executable instructions are executed by the processor to implement the entity class generation method according to any one of claims 1 to 10.

13. A storage medium, characterized in that: The storage medium is used to store computer executable instructions, and when the computer executable instructions are executed by a processor, the entity class generation method according to any one of claims 1 to 10 is implemented.