RPC interface definition extraction and version management method and device, electronic equipment and storage medium

By adopting the combination method of Maven and JavaParser in the RPC framework, RPC interface definitions are automatically extracted and managed, which solves the shortcomings of manual writing and maintenance of interface definitions in the existing technology, and realizes efficient and automated interface definition management and version control.

CN119829116APending Publication Date: 2025-04-15CHINA CITIC BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411774799.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The existing RPC framework has the flaws of manual writing and maintenance in the extraction and management of interface definitions, resulting in increased development costs, inconsistent interface definitions and errors, and the existing automatic generation tools cannot accurately describe the RPC interface definition and have a risk of code intrusion.

Method used

Using the method based on Maven and JavaParser, Java source code is parsed through the Maven framework, JavaParser generates an AST abstract syntax tree, extracts RPC interface definition information, and uploads it to the server for version management, realizing automatic extraction and efficient management of interface definitions.

Benefits of technology

It realizes automatic extraction and version management of RPC interface definitions without intrusion code, simplifies the development process, reduces development costs, avoids inconsistencies and errors in interface definitions, and realizes release-on-scan through CI/CD pipelines, improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829116A_ABST
    Figure CN119829116A_ABST
Patent Text Reader

Abstract

The invention relates to the field of software development and automation tools, and discloses an RPC interface definition extraction and version management method based on Maven and JavaParser. The RPC interface definition extraction method comprises the following steps: in an environment in which JDK and Maven frameworks are installed, executing an mvn command or utilizing IDEA to open a project and calling an analysis plug-in; project management information is automatically generated according to the pom file of the project, and a jar package list on which the project depends and a local dependency library directory address are obtained; the method comprises the following steps of: loading a project source code and a dependent jar package file into a CombinedTypeSolver parser, and constructing a JavaParser class; traversing a Java source code file in the project, and analyzing a code text into an AST abstract syntax tree by using JavaParser; and rewriting a VoidVisitor Adapter access adapter of the JavaParser, accessing and operating nodes of the AST abstract syntax tree, and extracting interface definition information. According to the invention, no intrusion code is realized, the CI / CD process is convenient to integrate, and a user is non-inductive due to the fact that the CI / CD process is issued and scanned; code analysis is focused, and a project structure does not need to be concerned; and the scanning information is visually displayed, so that the information amount and the user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application generally relates to the field of software development and automation tools, and more specifically, to a method, device, electronic device and storage medium for extracting and versioning RPC interface definitions based on Maven and JavaParser. Background Art

[0002] With the continuous development of software technology, remote procedure call (RPC) has become an important means to achieve inter-service communication in distributed systems. However, in the application process of RPC framework, the extraction and management of interface definitions has always been a key issue. At present, most RPC frameworks require developers to manually write and maintain interface definitions, which not only increases development costs, but also easily leads to inconsistencies and errors in interface definitions. Although there are tools such as swagger that automatically generate interface documents, they are usually used to describe RESTful APIs instead of RPC interfaces. They cannot accurately describe RPC interface definitions, and require manual annotations, which increases development workload. At the same time, they cannot analyze the reference relationship between interfaces and entity classes, and have defects in data change impact analysis. In addition, tools such as swagger may pollute project dependency packages when parsing project references, causing code intrusion. Summary of the invention

[0003] In order to overcome the shortcomings of the prior art, the present application provides a method for extracting and versioning RPC interface definitions based on Maven and JavaParser. The method uses the Maven framework as the program entry, parses the Java source code using the JavaParser library, automatically generates RPC interface definition information, and uploads this information to the server for version management, thereby realizing the automated extraction and efficient management of interface definitions.

[0004] In a first aspect, the present application provides a method for extracting RPC interface definitions, comprising:

[0005] In an environment where JDK and Maven framework are installed, start the interface definition extraction process by executing the mvn command or using IDEA to open the project and call the parsing plug-in;

[0006] The Maven framework automatically generates project management information based on the project's pom file, including MavenProject, MavenSession, and ProjectDependenciesResolver, to obtain the list of jar packages that the project depends on and the local dependency library directory address;

[0007] Load the project source code and dependent jar package files into the CombinedTypeSolver parser, and construct the JavaParser class based on the parser;

[0008] Traverse the Java source code files in the project and use JavaParser to parse the code text into an AST abstract syntax tree;

[0009] Rewrite JavaParser's VoidVisitorAdapter access adapter to access and manipulate AST abstract syntax tree nodes and extract interface definition information.

[0010] Optionally, the RPC interface definition extraction method also includes: in the process of accessing the AST abstract syntax tree, collecting and organizing interface information, method information, method parameter information, method parameter associated entity class information, entity class information and entity class attribute information to form structured data.

[0011] Optionally, the interface information includes interface name, package path, Chinese name, description information, author, etc.; the method information includes method ID, method name, belonging interface name, Chinese name, description information, author, etc.; the method parameter information includes parameter name, input and output parameter category, parameter type name, Chinese name, description information, etc.; the method parameter associated entity class information includes the associated entity class name, package path and Maven coordinates of the package to which it belongs; the entity class information includes entity class ID, entity class name, package path, Chinese name, description information, author, etc.; the entity class attribute information includes attribute name, attribute type name, Chinese name, description information, etc.

[0012] In a second aspect, the present application also provides a method for managing RPC interface definition versions, including:

[0013] Uploading the interface definition information extracted according to the method described in any paragraph of the first aspect to the server;

[0014] The server combines the received interface definition information into tree-shaped parameter information and stores it in a relational database;

[0015] The server records the interface definition information uploaded each time it is scanned and managed as different versions, and compares it with the previous version to generate a change record.

[0016] In a third aspect, the present application further provides an RPC interface definition extraction device, comprising:

[0017] The project loading module is used to load projects in an environment where JDK and Maven framework are installed;

[0018] Dependency parsing module, used to parse project dependencies according to pom files;

[0019] The syntax tree generation module is used to load the project source code and dependent jar package files into the parser and generate an AST abstract syntax tree;

[0020] The information extraction module is used to traverse the AST abstract syntax tree and extract interface definition information.

[0021] Optionally, the RPC interface definition extraction device further includes: an information sorting module, used to sort the extracted interface definition information into structured data.

[0022] In a fourth aspect, the present application further provides an RPC interface definition version management device, comprising:

[0023] Information upload module, used to upload interface definition information to the server;

[0024] The version management module is used to combine the received interface definition information into tree parameter information and store it in the database, and record the interface definition information uploaded each time as different versions, and compare it with the previous version to generate a change record.

[0025] Optionally, the RPC interface definition version management device also includes: a query module, which is used to provide a function for users to query detailed information and compare records on the web page when logging in.

[0026] The beneficial effects of this application are: achieving non-intrusive code and facilitating integration of CI / CD processes; focusing on code analysis without paying attention to project structure; converting Java text code into parseable structured data with associated relationships; recording the relationship between interfaces and model classes to facilitate analysis of the impact of model class changes; achieving release-as-scanning through integrated CI / CD pipelines without user awareness; and visual display of scanned information to improve the amount of information and user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0028] Figure 1 It is a flowchart of the RPC interface definition extraction method provided in an embodiment of the present application.

[0029] Figure 2 It is a flowchart of the RPC interface definition version management method provided in an embodiment of the present application.

[0030] Figure 3 It is a structural diagram of the RPC interface definition extraction device provided in an embodiment of the present application.

[0031] Figure 4 It is a structural diagram of the RPC interface definition version management device provided in an embodiment of the present application.

[0032] Figure 5 A schematic structural diagram of an electronic device to which the embodiments of the present application are applicable is shown. DETAILED DESCRIPTION

[0033] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0034] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0035] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0036] Example 1

[0037] Figure 1 1 is a flow chart of a method for extracting RPC interface definitions provided by an embodiment of the present application. Figure 1 As shown, in this embodiment, the RPC interface definition extraction method includes the following steps.

[0038] S101: In an environment where JDK and Maven framework are installed, start the interface definition extraction process by executing the mvn command or using IDEA to open the project and call the parsing plug-in.

[0039] Specifically, in step S101, the environment where JDK and Maven framework are installed can be a user terminal. The parsing plug-in can integrate the continuous integration / continuous delivery (CI / CD) process, combine code parsing into the R&D management process, and realize user-free automatic parsing.

[0040] S102: The Maven framework automatically generates project management information according to the project's pom file, including MavenProject, MavenSession, and ProjectDependenciesResolver, to obtain the list of jar packages that the project depends on and the local dependency library directory address.

[0041] Specifically, in step S102, the local dependency library directory address is obtained according to MavenSession.

[0042] S103: Load the project source code and dependent jar package files into the CombinedTypeSolver parser, and construct a JavaParser class based on the parser.

[0043] Specifically, in step S103, the JavaParser class is a library for parsing Java source code, which can parse the Java source code into an AST (Abstract Syntax Tree), so that developers can perform various analyses, conversions and operations on the code.

[0044] As an example, Table 1 below provides a simulated or actual Java project code snippet for a bank test project, which contains the definitions of multiple classes and an interface. These classes and interfaces are defined in the same package com.citicbank.test.

[0045]

[0046]

[0047]

[0048] S104: Traverse the Java source code files in the project and use JavaParser to parse the code text into an AST abstract syntax tree.

[0049] Specifically, in step S104, the AST abstract syntax tree is a structured representation of Java source code. Compared with the way JavaDoc reads text, using the JavaParser source code parsing library can parse Java projects into more readable abstract syntax trees with richer information.

[0050] S105: Rewrite the VoidVisitorAdapter access adapter of JavaParser to access and operate the AST abstract syntax tree nodes and extract the interface definition information.

[0051] Specifically, in step S105, the main node types include: ClassOrInterfaceDeclaration: source code class or interface declaration, used to represent various information of the class or interface, such as class name, inherited parent class, annotations, JavaDoc comments, etc. Before obtaining information, it is necessary to determine whether it is an interface or an entity class; FieldDeclaration: field declaration in source code, used to represent various information of the field, such as field name, field type, field modifier, annotation, JavaDoc comments, etc.; MethodDeclaration: method declaration in source code, used to represent various information of the method, such as method name, input and output parameters and exception list, method modifier, annotation, JavaDoc comments, etc.

[0052] As an example, Table 2 below provides node information after the abstract syntax tree is converted.

[0053]

[0054] Specifically, in this embodiment, the post-conversion syntax tree processing logic is customized as follows:

[0055] 1. If JavaDoc has a single line, the data in that line is considered to be the Chinese name; if it has multiple lines, the first line is considered to be the Chinese name and the rest are descriptive information.

[0056] 2. For scenarios where generics are defined in the source code, when parsing each node, if there are generics, the generic definitions are recorded as part of the basic information of the node in order, and the container types are recorded hierarchically. Example: A method is defined as<T extend Object1> Res <List <t>>method(); the method generic description is T extendObject1, and the output parameter generic tree is

[0057] {

[0058] "children":[{

[0059] "children":[{

[0060] "value":"Object1"

[0061] }],

[0062] "value":"List"}],

[0063] "value":"Res"

[0064] }

[0065] Therefore, by associating with the entity class, it is convenient to obtain the actual JSON format of the method.

[0066] In this embodiment, the RPC interface definition extraction method also includes step S106: in the process of accessing the AST abstract syntax tree, collecting and organizing interface information, method information, method parameter information, method parameter associated entity class information, entity class information and entity class attribute information to form structured data.

[0067] Specifically, in step S106, the collected data is organized into the following structures:

[0068] Package information: group name, package name, package version number (i.e. Maven coordinates, which can uniquely identify Maven packages);

[0069] Interface information list: a collection of interfaces under this package, including interface name, package path, Chinese name, description information, author, etc.

[0070] Method information list: a collection of methods under each interface, including method ID, method name, interface name, Chinese name, description information, author, etc.

[0071] Method parameter information list: parameter set under each method, including method ID, parameter name, input and output parameter category, parameter type name, Chinese name, description information, etc.

[0072] Method parameter associated entity class list: including method ID, parameter name, associated entity class name, associated entity class package path, and Maven coordinates of the associated entity class package;

[0073] Entity class information list: a collection of entity classes under the package, including entity class ID, entity class name, package path, Chinese name, description information, author, etc.

[0074] Entity class attribute information list: attribute set under each entity, including entity class ID, attribute name, attribute type name, Chinese name, description information, etc.;

[0075] List of entity classes associated with entity class attributes: including entity class ID, attribute name, associated entity class name, associated entity class package path, and Maven coordinates of the package to which the associated entity class belongs.

[0076] Specifically, the input parameters and output parameters of the method are organized and displayed according to their type and hierarchy, forming a hierarchical tree structure. The hierarchical relationship between parameters is represented by the parent-child relationship between nodes. This structured display method helps developers better understand the parameter composition and relationship of the method.

[0077] As an example, Table 3 below provides a parameter tree obtained by assembling a node.

[0078]

[0079]

[0080] As an example, a real case is provided below to better explain the steps of this method.

[0081] For example, in a bank project, after the interface source code is written in IDEA, there is an interface file and an entity class file in the project. The interface file has a method definition, and the output parameter type is the entity class; the entity class file has three attribute definitions.

[0082] Scan the project through the Maven plug-in, first get the list of dependent jar packages. According to the Maven framework configuration, the local machine has a directory to store all project dependent packages. The package coordinates and directory can be used to lock the unique file, that is, the dependent jar package, load the dependent package and the code of this project, build the JavaParser class, and the source code file will be processed into a formatted abstract syntax tree. The code definitions in the text are processed as tree nodes. The syntax tree contains all the content in the code text and the information required for compilation. During the access to the syntax tree, the Chinese name, description information, type name and other information required for the subsequent interface definition analysis are collected and encapsulated into different entity structures according to the different node types. Now we have an interface definition entity, a method definition entity, a parameter entity, a parameter and entity relationship entity, a class entity, and three attribute entities; according to Java syntax, the method output parameter data format is the entity class defined in the code, so the three attributes of the entity class need to be added to the method parameters, and the output parameter node is used as the parent node of the three attributes. If the entity class attributes increase from three to four, scan again, the method parameter expansion attributes become four, and a change record is added to describe the addition of the fourth attribute. The user logs in to the web terminal to view the method details and display the input and output parameter information.

[0083] The RPC interface definition extraction method provided in this embodiment uses the Maven framework as the process entry, and utilizes Maven's mature construction and project management processes to be highly integrated with the CI / CD process; at the same time, the Maven core logic has structured the project and exposed it through the interface, making it easy to focus on code analysis without having to pay attention to the project structure. Compared with mainstream code analysis tools that produce independent interface documents, the method also records the relationship between the interface and the model class, and can perform impact analysis on changes to the model class. Full coverage of the RPC interface is achieved, and by integrating the CI / CD pipeline, publishing and scanning are achieved without user awareness; the visual display of the scanned information greatly improves the amount of information and experience compared to viewing the code file.

[0084] Example 2

[0085] Figure 2 It is a flowchart of an RPC interface definition version management method provided in an embodiment of the present application, which includes the following steps.

[0086] S201: Upload the interface definition information extracted according to the method described in any paragraph of the first aspect to the server.

[0087] S202: The server combines the received interface definition information into tree-shaped parameter information and stores it in a relational database.

[0088] S203: The server records the interface definition information uploaded each time through scanning as different versions for management, and compares it with the previous version to generate a change record.

[0089] Through the RPC interface definition version management method provided in this embodiment, the content of each version of the interface can be recorded for management, and the reference relationship between the interface and the entity class can be visualized, which facilitates code management and data analysis.

[0090] Example 3

[0091] Figure 3 : is a structural diagram of an RPC interface definition extraction device 100 provided in an embodiment of the present application, including:

[0092] The project loading module 101 is used to load a project in an environment where JDK and Maven framework are installed;

[0093] A dependency parsing module 102 is used to parse project dependencies according to the pom file;

[0094] The syntax tree generation module 103 is used to load the project source code and dependent jar package files into the parser and generate an AST abstract syntax tree;

[0095] The information extraction module 104 is used to traverse the AST abstract syntax tree and extract interface definition information.

[0096] In this embodiment, the RPC interface definition extraction device 100 further includes: an information sorting module 105, which is used to sort the extracted interface definition information into structured data.

[0097] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the specific structure of the RPC interface definition extraction device 100. In other embodiments of the present application, the RPC interface definition extraction device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0098] Example 4

[0099] Figure 4 : is a structural diagram of an RPC interface definition version management device 200 provided in an embodiment of the present application, including:

[0100] Information uploading module 201, used to upload interface definition information to the server;

[0101] The version management module 202 is used to combine the received interface definition information into tree-shaped parameter information and store it in the database, and record the interface definition information uploaded each time as different versions, and compare it with the previous version to generate a change record.

[0102] In this embodiment, the RPC interface definition version management device 200 further includes: a query module 203, which is used to provide a function for a user to log in to a web page to query detailed information and compare records.

[0103] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the specific structure of the RPC interface definition version management device 200. In other embodiments of the present application, the RPC interface definition version management device 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0104] The embodiment of the present application further provides an electronic device 300, including a processor 301 and a memory 303;

[0105] Memory 303, used for storing operation instructions;

[0106] The processor 301 is used to execute the RPC interface definition extraction method and the RPC interface definition version management method provided in any embodiment of the present application by calling an operation instruction.

[0107] As an example, Figure 5 A schematic diagram of the structure of an electronic device applicable to the embodiment of the present application is shown. Figure 5 As shown, the electronic device 300 includes: a processor 301 and a memory 303. Among them, the processor 301 and the memory 303 are connected, such as being connected through a bus 302. Optionally, the electronic device 300 may also include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one. It is understandable that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the specific structure of the electronic device 300. In other embodiments of the present application, the electronic device 300 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware. Optionally, the electronic device may also include a display screen 305 for displaying images, or receiving user operation instructions when necessary.

[0108] The processor 301 is applied in the embodiment of the present application to implement the method shown in the above method embodiment. The transceiver 304 may include a receiver and a transmitter. The transceiver 304 is applied in the embodiment of the present application to implement the function of the electronic device of the embodiment of the present application communicating with other devices when executed.

[0109] Processor 301 may be a CPU (Central Processing Unit), a general purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0110] The processor 301 may also include one or more processing units, for example, the processor 301 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU). Among them, different processing units may be independent devices or integrated into one or more processors. Among them, the controller may be the nerve center and command center of the electronic device 300. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions. A memory may also be set in the processor 301 for storing instructions and data. In some embodiments, the memory in the processor 301 is a high-speed cache memory. The memory may store instructions or data that the processor 301 has just used or circulated. If the processor 301 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 301 is reduced, and the efficiency of the system is improved.

[0111] The processor 301 can run the RPC interface definition extraction method and the RPC interface definition version management method provided in the embodiment of the present application, so as to reduce the user's operation complexity, improve the intelligence of the terminal device, and enhance the user experience. The processor 301 can include different devices. For example, when the CPU and GPU are integrated, the CPU and the GPU can cooperate to execute the RPC interface definition extraction method and the RPC interface definition version management method provided in the embodiment of the present application. For example, part of the algorithm in the RPC interface definition extraction method and the RPC interface definition version management method is executed by the CPU, and the other part of the algorithm is executed by the GPU to obtain faster processing efficiency.

[0112] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0113] The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or may include a high-speed random access memory, or may include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0114] Optionally, the memory 303 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the RPC interface definition extraction method and the RPC interface definition version management method provided in any embodiment of the present application.

[0115] The memory 303 can be used to store computer executable program codes, which include instructions. The processor 301 executes various functional applications and data processing of the electronic device 300 by running the instructions stored in the memory 303. The memory 303 may include a program storage area and a data storage area. Among them, the program storage area may store the code of the operating system, application program, etc. The data storage area may store data created during the use of the electronic device 300 (such as images, videos, etc. collected by the camera application), etc.

[0116] The memory 303 may also store one or more computer programs corresponding to the RPC interface definition extraction method and the RPC interface definition version management method provided in the embodiments of the present application. The one or more computer programs are stored in the above-mentioned memory 303 and are configured to be executed by the one or more processors 301. The one or more computer programs include instructions, and the above-mentioned instructions can be used to execute each step in the above-mentioned corresponding embodiment.

[0117] Of course, the codes of the RPC interface definition extraction method and the RPC interface definition version management method provided in the embodiment of the present application can also be stored in an external memory. In this case, the processor 301 can run the codes of the RPC interface definition extraction method and the RPC interface definition version management method stored in the external memory through the external memory interface, and the processor 301 can control the running of the RPC interface definition extraction method and the RPC interface definition version management method process.

[0118] The display screen 305 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-LED, a Micro Led, a Micro-Oled, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 300 may include 1 or N display screens 305, where N is a positive integer greater than 1. The display screen 305 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI). For example, the display screen 305 can display photos, videos, web pages, or files, etc.

[0119] The electronic device provided in the embodiment of the present application is applicable to any embodiment of the above method. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, which will not be repeated here.

[0120] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the RPC interface definition extraction method and the RPC interface definition version management method shown in the above method embodiment are implemented.

[0121] The computer-readable storage medium provided in the embodiment of the present application is applicable to any embodiment of the above-mentioned method. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, which will not be repeated here.

[0122] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer executes the above-mentioned related steps to implement the method in the above-mentioned embodiment. The computer program product provided in the embodiment of the present application is applicable to any embodiment of the above-mentioned method. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, which will not be repeated here.

[0123] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another device, or some features can be discarded or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0124] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0125] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0126] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0127] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0128] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, and can also make some improvements and modifications. These changes, substitutions, improvements and modifications should also be considered to be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.< / t>

Claims

1. A method for extracting RPC interface definition, characterized in that: include: In an environment where JDK and Maven framework are installed, start the interface definition extraction process by executing the mvn command or using IDEA to open the project and call the parsing plug-in; The Maven framework automatically generates project management information based on the project's pom file, including MavenProject, MavenSession, and ProjectDependenciesResolver, to obtain the list of jar packages that the project depends on and the local dependency library directory address; Load the project source code and dependent jar package files into the CombinedTypeSolver parser, and construct the JavaParser class based on the parser; Traverse the Java source code files in the project and use JavaParser to parse the code text into an AST abstract syntax tree; Rewrite JavaParser's VoidVisitorAdapter access adapter to access and manipulate AST abstract syntax tree nodes and extract interface definition information.

2. The method according to claim 1, characterized in that Also includes: In the process of accessing the AST abstract syntax tree, interface information, method information, method parameter information, method parameter associated entity class information, entity class information and entity class attribute information are collected and organized to form structured data.

3. The method according to claim 2, characterized in that The interface information includes interface name, package path, Chinese name, description information, and author; the method information includes method ID, method name, belonging interface name, Chinese name, description information, and author; the method parameter information includes parameter name, input and output parameter category, parameter type name, Chinese name, and description information; the method parameter associated entity class information includes the associated entity class name, package path, and Maven coordinates of the package to which it belongs; the entity class information includes entity class ID, entity class name, package path, Chinese name, description information, and author; the entity class attribute information includes attribute name, attribute type name, Chinese name, and description information.

4. A method for managing RPC interface definition versions, characterized in that: include: Uploading the interface definition information extracted according to the method according to any one of claims 1 to 3 to the server; The server combines the received interface definition information into tree-shaped parameter information and stores it in a relational database; The server records the interface definition information uploaded each time it is scanned and managed as different versions, and compares it with the previous version to generate a change record.

5. An RPC interface definition extraction device, characterized in that: include: The project loading module is used to load projects in an environment where JDK and Maven framework are installed; Dependency parsing module, used to parse project dependencies according to pom files; The syntax tree generation module is used to load the project source code and dependent jar package files into the parser and generate an AST abstract syntax tree; The information extraction module is used to traverse the AST abstract syntax tree and extract interface definition information.

6. The device according to claim 5, characterized in that Also includes: The information sorting module is used to sort the extracted interface definition information into structured data.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

9. An RPC interface definition version management device, characterized in that: include: Information upload module, used to upload interface definition information to the server; The version management module is used to combine the received interface definition information into tree parameter information and store it in the database, and record the interface definition information uploaded each time as different versions, and compare it with the previous version to generate a change record.

10. The device according to claim 9, characterized in that Also includes: The query module is used to provide users with the function of querying detailed information and comparing records on the web page when logging in.