CN114637531A - Method and device for dynamically generating application program interface - Google Patents

Method and device for dynamically generating application program interface Download PDF

Info

Publication number
CN114637531A
CN114637531A CN202210313140.9A CN202210313140A CN114637531A CN 114637531 A CN114637531 A CN 114637531A CN 202210313140 A CN202210313140 A CN 202210313140A CN 114637531 A CN114637531 A CN 114637531A
Authority
CN
China
Prior art keywords
interface
definition
bytecode
generating
configuration message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210313140.9A
Other languages
Chinese (zh)
Inventor
郑小虎
张顺
张鹏鹏
郑泽奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202210313140.9A priority Critical patent/CN114637531A/en
Publication of CN114637531A publication Critical patent/CN114637531A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/48Incremental compilation

Abstract

The embodiment of the application provides a method and a device for dynamically generating an application program interface, which can be used in the field of finance, and the method comprises the following steps: receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user; analyzing the interface configuration message and generating a corresponding bytecode definition according to a set interface definition rule; sending the bytecode definition to a target application so that the target application can generate a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition; the method and the device can flexibly and conveniently realize the dynamic development and deployment of the application program interface.

Description

Method and device for dynamically generating application program interface
Technical Field
The application relates to the field of data processing and can also be used in the field of finance, in particular to a method and a device for dynamically generating an application program interface.
Background
With the rapid development of the internet and the mobile internet, the realization period of the service requirement is shorter and shorter, and the API provided by the application system as the final exposed capability interface of the system also needs to meet the requirement of rapid online.
At the same time, system API development often does not contain rich business logic (this part is usually implemented by the business layer), so more and more developers want to be able to implement lightweight development and implementation of APIs. In addition, in the iterative evolution process of the system, the newly added API and the modified API need to be maintained by stopping the application, so that the cost is high.
In the development process of the API of the application system, a developer usually needs to develop a source code based on requirements such as interface definition, a communication protocol, and interface specification, perform links such as compiling and constructing, integrate the developed API interface into the current system, and finally complete generation of the corresponding API by replacing the latest execution code and restarting the application. The whole process is carried out according to the traditional application development mode, and the problems of low efficiency, high cost, poor flexibility and the like exist.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides a method and a device for dynamically generating an application program interface, which can flexibly and conveniently realize dynamic development and deployment of the application program interface.
In order to solve at least one of the above problems, the present application provides the following technical solutions:
in a first aspect, the present application provides a method for dynamically generating an application program interface, including:
receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user;
analyzing the interface configuration message and generating a corresponding bytecode definition according to a set interface definition rule;
and sending the bytecode definition to a target application so that the target application generates a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
Further, before the analyzing the interface configuration packet and generating the corresponding bytecode definition according to the set interface definition rule, the method includes:
carrying out message format check and data format conversion on the received interface configuration message;
and performing local persistent storage on the interface configuration message subjected to the message format check and the data format conversion.
Further, the analyzing the interface configuration packet and generating a corresponding bytecode definition according to a set interface definition rule includes:
analyzing the interface configuration message, and determining a bytecode generation parameter according to an analysis result, wherein the bytecode generation parameter comprises at least one of an interface input parameter, an interface output parameter, interface control logic and interface execution logic;
and generating a corresponding bytecode definition according to the bytecode generation parameters and the set interface definition rule.
Further, after the sending the bytecode definition to the target application, the method includes:
and the target application analyzes the received bytecode definition through a locally integrated software development kit and generates a corresponding interface code instance according to an analysis result and the running environment of the virtual machine.
In a second aspect, the present application provides an apparatus for dynamically generating an application program interface, including:
the message receiving module is used for receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user;
the byte code generating module is used for analyzing the interface configuration message and generating a corresponding byte code definition according to a set interface definition rule;
and the bytecode conversion module is used for sending the bytecode definition to a target application so that the target application can generate a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
Further, still include:
the check and conversion unit is used for carrying out message format check and data format conversion on the received interface configuration message;
and the persistent storage unit is used for locally persistently storing the interface configuration message subjected to the message format check and the data format conversion.
Further, the bytecode generation module includes:
the message analysis unit is used for analyzing the interface configuration message and determining a byte code generation parameter according to an analysis result, wherein the byte code generation parameter comprises at least one of an interface input parameter, an interface output parameter, an interface control logic and an interface execution logic;
and the byte code generating unit is used for generating a corresponding byte code definition according to the byte code generating parameters and the set interface definition rules.
Further, the byte code conversion module comprises:
and the example code generating unit is used for analyzing the received bytecode definition by the target application through a locally integrated software development kit and generating a corresponding interface code example according to an analysis result and the running environment of the virtual machine.
In a third aspect, the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method for dynamically generating an application program interface when executing the program.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method for dynamically generating an application program interface.
In a fifth aspect, the present application provides a computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method for dynamic generation of application program interfaces.
According to the technical scheme, the interface to be generated is converted into the corresponding bytecode definition in advance, and the bytecode definition is sent to the target application, so that the target application can generate the corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition, the effect that the target application can deploy the newly added interface code instance without restarting is achieved, and therefore dynamic development and deployment of the application program interface can be achieved flexibly and conveniently.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following descriptions are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flowchart illustrating a method for dynamically generating an application program interface according to an embodiment of the present disclosure;
FIG. 2 is a second flowchart illustrating a method for dynamically generating an API in an embodiment of the present application;
FIG. 3 is a third flowchart illustrating a method for dynamically generating an API in an embodiment of the present application;
FIG. 4 is a block diagram of an embodiment of an apparatus for dynamically generating an API;
FIG. 5 is a second block diagram of an API dynamic generation apparatus according to an embodiment of the present invention;
FIG. 6 is a third block diagram of an API dynamic generation apparatus according to an embodiment of the present invention;
FIG. 7 is a fourth block diagram of an API dynamic generation apparatus according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a system for dynamically generating API's in an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
In consideration of the development process of the API in the prior art, a developer usually needs to develop a source code based on requirements such as interface definition, a communication protocol, interface specification and the like, perform links such as compiling, constructing and the like, integrate the developed API interface into a current system, and finally complete generation of a corresponding API by replacing a latest execution code and restarting an application. The whole process is carried out according to a traditional application development mode, and the problems of low efficiency, high cost and poor flexibility exist.
In order to flexibly and conveniently implement dynamic development and deployment of an application program interface, the application provides an embodiment of a dynamic generation method of an application program interface, and referring to fig. 1, the dynamic generation method of an application program interface specifically includes the following contents:
step S101: receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user.
Optionally, the application may receive an interface configuration message sent by a user (for example, an interface developer), where the interface configuration message includes an interface to be generated, where the interface to be generated is selected by the user, and the application may provide a variety of interfaces that can be generated for the user through an interface display interface or an interface library.
Step S102: and analyzing the interface configuration message and generating a corresponding bytecode definition according to a set interface definition rule.
Optionally, the application may perform message parsing on the received interface configuration message, and perform message format verification and format conversion operation on the parsed data, so as to obtain message data conforming to a set data format and perform local persistent storage.
Optionally, the parsed message data may generate a corresponding bytecode definition according to a set interface definition rule, where the bytecode definition refers to a Java bytecode and is a virtual instruction format executed by a Java virtual machine.
For example, for an employee management application, an interface needs to be defined, and the interface realizes that detailed information of an employee is queried through an employee number and a company number, and a json message defined by the interface is as follows:
Figure BDA0003569092570000051
Figure BDA0003569092570000061
Figure BDA0003569092570000071
the interface definition rule followed by the interface definition is as shown in the json message, and mainly includes:
1. the interface definition mainly comprises an API interface name apiName, an API interface protocol apiProtocol, an API interface message header apiHeader, an API interface request message body apiReqBody and an API interface return message body apiRespBody.
2. The API interface message header apiHeader, the API interface request message body apiReqBody and the API interface return message body apiRespBody are array types, and corresponding field information in each domain is listed.
And 3, field information in an API interface message header apiHeader, an API interface request message body apiReqBody and an API interface return message body apiRespBody mainly comprises three types of field names, field types and field check rules rule.
4. Wherein the field name whose value identifies the name of the field in the corresponding domain; the field type has a value for identifying the type of the field in the corresponding field, and the type comprises character type String, integer type INT and the like; the field check rule has a value expressed by a traffic restriction rule of a field in a corresponding domain, and includes whether the field can be a control, a restricted number range, and the like.
The interface definition bytecode generated according to the interface definition is as follows:
Figure BDA0003569092570000072
Figure BDA0003569092570000081
Figure BDA0003569092570000082
Figure BDA0003569092570000091
Figure BDA0003569092570000092
Figure BDA0003569092570000101
Figure BDA0003569092570000111
Figure BDA0003569092570000121
step S103: and sending the bytecode definition to a target application so that the target application generates a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
Optionally, after generating the bytecode definition, the application can send it to the target application end,
as can be seen from the above description, the method for dynamically generating an application program interface provided in the embodiment of the present application can convert an interface to be generated into a corresponding bytecode definition in advance, and send the bytecode definition to a target application, so that the target application can generate a corresponding interface code instance according to its own operating environment after parsing the bytecode definition, thereby achieving an effect that the target application can deploy a new interface code instance without restarting, and thus, can flexibly and conveniently implement dynamic development and deployment of an application program interface.
In order to ensure the accuracy of generating the bytecode definition, in an embodiment of the method for dynamically generating the application program interface according to the present application, referring to fig. 2, before the step S102, the following may be specifically included:
step S201: and carrying out message format check and data format conversion on the received interface configuration message.
Step S202: and performing local persistent storage on the interface configuration message subjected to the message format check and the data format conversion.
Optionally, the application may perform message parsing on the received interface configuration message, and perform message format verification and format conversion operation on the parsed data, so as to obtain message data conforming to a set data format and perform local persistent storage.
In order to accurately generate the bytecode definition, in an embodiment of the application program interface dynamic generation method of the present application, referring to fig. 3, the step S102 may further include the following steps:
step S301: and analyzing the interface configuration message, and determining byte code generation parameters according to an analysis result, wherein the byte code generation parameters comprise at least one of interface input parameters, interface output parameters, interface control logic and interface execution logic.
Step S302: and generating a corresponding bytecode definition according to the bytecode generation parameter and a set interface definition rule.
Optionally, the application may perform message parsing on the received interface configuration message, extract, from the parsing result, a bytecode generation parameter required for generating the bytecode definition, for example, at least one of an interface input parameter, an interface output parameter, an interface control logic, and an interface execution logic, and the extraction process may be identified by a specific character identifier.
Optionally, the corresponding bytecode definition is generated according to the bytecode generation parameter and the set interface definition rule.
In order to enable the target application to accurately parse the bytecode definition, in an embodiment of the application program interface dynamic generation method of the present application, after the step S103, the following may be specifically included:
and the target application analyzes the received bytecode definition through a locally integrated software development kit and generates a corresponding interface code instance according to an analysis result and the running environment of the virtual machine.
Optionally, the target application end may be pre-integrated with a software development kit SDK, and may also implement data parsing operation defined on the received bytecode by using the prior art.
Optionally, the target application terminal may generate a corresponding interface instance, that is, an interface code, according to the analysis result in combination with the JAVA virtual machine operating environment of the target application terminal, for example: for an employee management application, an interface is defined, which enables to query detailed information of an employee through an employee number and a company number, and the interface definition bytecode generated according to the interface definition message are as exemplified in step S102.
After receiving the bytecode definition of the interface, the target application terminal analyzes the bytecode definition to generate a corresponding interface code, which includes three Java classes as follows:
Figure BDA0003569092570000141
Figure BDA0003569092570000142
Figure BDA0003569092570000151
Figure BDA0003569092570000161
Figure BDA0003569092570000171
in order to flexibly and conveniently implement dynamic development and deployment of an application program interface, the present application provides an embodiment of an application program interface dynamic generation apparatus for implementing all or part of contents of the application program interface dynamic generation method, and referring to fig. 4, the application program interface dynamic generation apparatus specifically includes the following contents:
the message receiving module 10 is configured to receive an interface configuration message sent by a user, where the interface configuration message includes an interface to be generated selected by the user.
And the bytecode generating module 20 is configured to parse the interface configuration message and generate a corresponding bytecode definition according to a set interface definition rule.
The bytecode transformation module 30 is configured to send the bytecode definition to a target application, so that the target application generates a corresponding interface code instance according to its own operating environment after parsing the bytecode definition.
As can be seen from the above description, the dynamic generation apparatus for an application program interface provided in this embodiment of the present application can convert an interface to be generated into a corresponding bytecode definition in advance, and send the bytecode definition to a target application, so that the target application can generate a corresponding interface code instance according to its own operating environment after parsing the bytecode definition, and thus the target application can deploy a new interface code instance without restarting, and thus, dynamic development and deployment of the application program interface can be flexibly and conveniently implemented.
In order to ensure the accuracy of generating the bytecode definition, in an embodiment of the application program interface dynamic generation apparatus of the present application, referring to fig. 5, the following contents are further included:
and a checksum conversion unit 41, configured to perform message format checksum and data format conversion on the received interface configuration message.
And the persistent storage unit 42 is configured to perform local persistent storage on the interface configuration message after the message format check and the data format conversion.
In order to accurately generate the bytecode definition, in an embodiment of the dynamic generation apparatus for application program interface of the present application, referring to fig. 6, the bytecode generation module 20 includes:
the message parsing unit 21 is configured to parse the interface configuration message, and determine a bytecode generation parameter according to a parsing result, where the bytecode generation parameter includes at least one of an interface input parameter, an interface output parameter, an interface control logic, and an interface execution logic.
And the bytecode generating unit 22 is configured to generate a corresponding bytecode definition according to the bytecode generation parameter and the set interface definition rule.
In order to enable the target application to accurately parse the bytecode definition, in an embodiment of the application program interface dynamic generation apparatus of the present application, referring to fig. 7, the bytecode conversion module 30 includes:
and the instance code generating unit 31 is configured to analyze the received bytecode definition by the target application through a locally integrated software development kit, and generate a corresponding interface code instance according to an analysis result and a running environment of the virtual machine itself.
To further explain the present solution, the present application further provides a specific application example of implementing the method for dynamically generating the application program interface by using the above-mentioned apparatus for dynamically generating the application program interface, which refers to fig. 8 and specifically includes the following contents: the system comprises an API configuration display program, an API dynamic configuration program, an API dynamic analysis SDK and the like, wherein the functions and the components of each part are as follows:
the API configuration display program is responsible for providing an interface for visualizing, configuring and developing the application API for an API developer, and the developer can complete the development of the application API through the interface in a selection and configuration mode.
And 2, the API dynamic configuration program is responsible for receiving the message sent by the API configuration display program, analyzing and generating the byte code based on the received message and sending the byte code to the application system. The program itself includes parts such as an API configuration subprogram, an API configuration persistence subprogram, an API configuration analysis subprogram, an API bytecode generation subprogram, and a communication subprogram.
And 2.1, the API configuration subprogram is responsible for receiving the message sent by the API configuration display program, verifying and converting the message format, and respectively transmitting the converted message to the API configuration persistence subprogram and the API configuration analysis subprogram.
And 2.2, configuring a persistence subprogram by the API, and storing the received message in a persistence manner according to a set format.
And 2.3, configuring an API analysis subprogram, wherein the API analysis subprogram is responsible for analyzing the received message and acquiring information required by byte code generation, such as API input parameters, API output parameters, API control logic, API execution logic and the like.
And 2.4, the API bytecode generation subprogram is responsible for dynamically generating the corresponding bytecode according to the API definition according to the result generated by the API configuration analysis subprogram.
2.5. And the communication subprogram is responsible for sending the dynamic bytecode definition generated by the API bytecode generation subprogram to the application system.
And 3, the API dynamic analysis SDK is responsible for receiving the API dynamic configuration program, analyzing and generating an API operation period instance, and mainly comprises a communication subprogram and an API bytecode analysis subprogram.
SDK communication subprogram for receiving API byte code definition sent by API dynamic configuration program and transmitting byte code definition to API byte code analysis subprogram
And 3.2, the API bytecode parsing subprogram is responsible for parsing the API bytecode definition and generating a corresponding API instance based on the running Java virtual machine environment of the application system.
As can be seen from the above, the interface definition generated by the developer configuration is dynamically analyzed to generate the bytecode by providing the developer with the visually configured interface program, and the bytecode is dynamically validated during the operation of the application system. The period and the cost of API development are reduced, the development requirements of diversified APIs can be met, and the flexibility is high.
In terms of hardware, in order to flexibly and conveniently implement dynamic development and deployment of an application program interface, the present application provides an embodiment of an electronic device for implementing all or part of contents in the method for dynamically generating an application program interface, where the electronic device specifically includes the following contents:
a processor (processor), a memory (memory), a communication Interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete mutual communication through the bus; the communication interface is used for realizing information transmission between the dynamic generation device of the application program interface and relevant equipment such as a core service system, a user terminal, a relevant database and the like; the logic controller may be a desktop computer, a tablet computer, a mobile terminal, and the like, but the embodiment is not limited thereto. In this embodiment, the logic controller may be implemented with reference to the embodiment of the method for dynamically generating an application program interface and the embodiment of the apparatus for dynamically generating an application program interface in the embodiments, and the contents thereof are incorporated herein, and repeated descriptions are omitted.
It is understood that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a Personal Digital Assistant (PDA), an in-vehicle device, a smart wearable device, and the like. Wherein, intelligence wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
In practical applications, part of the method for dynamically generating the application program interface may be executed on the electronic device side as described in the above, or all operations may be completed in the client device. The selection may be specifically performed according to the processing capability of the client device, the limitation of the user usage scenario, and the like. This is not a limitation of the present application. The client device may further include a processor if all operations are performed in the client device.
The client device may have a communication module (i.e., a communication unit), and may be communicatively connected to a remote server to implement data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, the server may also include a server on an intermediate platform, for example, a server on a third-party server platform that is communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster formed by a plurality of servers, or a server structure of a distributed apparatus.
Fig. 9 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 9, the electronic device 9600 can include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this fig. 9 is exemplary; other types of structures may also be used in addition to or in place of the structure to implement telecommunications or other functions.
In one embodiment, the application program interface dynamic generation method function may be integrated into the central processor 9100. The central processor 9100 may be configured to control as follows:
step S101: receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user.
Step S102: and analyzing the interface configuration message and generating a corresponding byte code definition according to a set interface definition rule.
Step S103: and sending the bytecode definition to a target application so that the target application generates a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
As can be seen from the above description, according to the electronic device provided in the embodiment of the present application, the interface to be generated is converted into the corresponding bytecode definition in advance, and the bytecode definition is sent to the target application, so that the target application generates the corresponding interface code instance according to its own operating environment after parsing the bytecode definition, and thus the target application can deploy the new interface code instance without restarting, and thus dynamic development and deployment of the application program interface can be flexibly and conveniently implemented.
In another embodiment, the api dynamic generation apparatus may be configured separately from the central processor 9100, for example, the api dynamic generation apparatus may be configured as a chip connected to the central processor 9100, and the function of the api dynamic generation method may be implemented by the control of the central processor.
As shown in fig. 9, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 also does not necessarily include all of the components shown in fig. 9; in addition, the electronic device 9600 may further include components not shown in fig. 9, which may be referred to in the prior art.
As shown in fig. 9, a central processor 9100, sometimes referred to as a controller or operational control, can include a microprocessor or other processor device and/or logic device, which central processor 9100 receives input and controls the operation of the various components of the electronic device 9600.
The memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to realize information storage or processing, or the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. Power supply 9170 is used to provide power to electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 9140 can be a solid state memory, e.g., Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 9140 could also be some other type of device. Memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 being used for storing application programs and function programs or for executing a flow of operations of the electronic device 9600 by the central processor 9100.
The memory 9140 can also include a data store 9143, the data store 9143 being used to store data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, contact book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
A plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, can be provided in the same electronic device based on different communication technologies. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby implementing ordinary telecommunications functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100, thereby enabling recording locally through the microphone 9132 and enabling locally stored sounds to be played through the speaker 9131.
The embodiment of the present application further provides a computer-readable storage medium capable of implementing all the steps in the method for dynamically generating an application program interface of a server or a client as an execution subject in the foregoing embodiments, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all the steps in the method for dynamically generating an application program interface of a server or a client as an execution subject in the foregoing embodiments, for example, when the processor executes the computer program, the processor implements the following steps:
step S101: receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user.
Step S102: and analyzing the interface configuration message and generating a corresponding bytecode definition according to a set interface definition rule.
Step S103: and sending the bytecode definition to a target application so that the target application generates a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
As can be seen from the above description, in the computer-readable storage medium provided in this embodiment of the present application, the interface to be generated is pre-converted into the corresponding bytecode definition, and the bytecode definition is sent to the target application, so that the target application generates the corresponding interface code instance according to its own operating environment after parsing the bytecode definition, and thus the target application can deploy the new interface code instance without restarting, and thus, dynamic development and deployment of the application program interface can be flexibly and conveniently implemented.
The embodiments of the present application further provide a computer program product capable of implementing all the steps in the method for dynamically generating an application program interface, where an execution subject in the above embodiments is a server or a client, and when executed by a processor, the computer program/instruction implements the steps of the method for dynamically generating an application program interface, for example, the computer program/instruction implements the following steps:
step S101: receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user.
Step S102: and analyzing the interface configuration message and generating a corresponding bytecode definition according to a set interface definition rule.
Step S103: and sending the bytecode definition to a target application so that the target application generates a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
As can be seen from the above description, in the computer program product provided in the embodiment of the present application, the interface to be generated is converted into the corresponding bytecode definition in advance, and the bytecode definition is sent to the target application, so that the target application generates the corresponding interface code instance according to its own operating environment after parsing the bytecode definition, and thus the target application can deploy the new interface code instance without restarting, and thus, dynamic development and deployment of the application program interface can be flexibly and conveniently implemented.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (11)

1.A method for dynamically generating an application program interface, the method comprising:
receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user;
analyzing the interface configuration message and generating a corresponding bytecode definition according to a set interface definition rule;
and sending the bytecode definition to a target application so that the target application generates a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
2. The method according to claim 1, wherein before parsing the interface configuration packet and generating the corresponding bytecode definition according to the set interface definition rule, the method comprises:
carrying out message format check and data format conversion on the received interface configuration message;
and performing local persistent storage on the interface configuration message subjected to the message format check and the data format conversion.
3. The method according to claim 1, wherein the parsing the interface configuration packet and generating the corresponding bytecode definition according to the set interface definition rule includes:
analyzing the interface configuration message, and determining a bytecode generation parameter according to an analysis result, wherein the bytecode generation parameter comprises at least one of an interface input parameter, an interface output parameter, interface control logic and interface execution logic;
and generating a corresponding bytecode definition according to the bytecode generation parameter and a set interface definition rule.
4. The method of claim 1, wherein after the sending the bytecode definition to a target application, the method further comprises:
and the target application analyzes the received bytecode definition through a locally integrated software development kit and generates a corresponding interface code instance according to an analysis result and the running environment of the virtual machine.
5. An apparatus for dynamically generating an application program interface, comprising:
the message receiving module is used for receiving an interface configuration message sent by a user, wherein the interface configuration message comprises an interface to be generated selected by the user;
the byte code generating module is used for analyzing the interface configuration message and generating a corresponding byte code definition according to a set interface definition rule;
and the bytecode conversion module is used for sending the bytecode definition to a target application so that the target application can generate a corresponding interface code instance according to the running environment of the target application after analyzing the bytecode definition.
6. The apparatus for dynamically generating an api according to claim 5, further comprising:
the check and conversion unit is used for carrying out message format check and data format conversion on the received interface configuration message;
and the persistent storage unit is used for carrying out local persistent storage on the interface configuration message subjected to the message format check and the data format conversion.
7. The apparatus according to claim 5, wherein the bytecode generation module includes:
the message analysis unit is used for analyzing the interface configuration message and determining a byte code generation parameter according to an analysis result, wherein the byte code generation parameter comprises at least one of an interface input parameter, an interface output parameter, an interface control logic and an interface execution logic;
and the byte code generating unit is used for generating a corresponding byte code definition according to the byte code generating parameters and the set interface definition rules.
8. The apparatus of claim 5, wherein the bytecode module includes:
and the example code generating unit is used for analyzing the received bytecode definition by the target application through a locally integrated software development kit and generating a corresponding interface code example according to an analysis result and the running environment of the virtual machine.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for dynamic generation of application program interfaces according to any of claims 1 to 4 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for dynamic generation of an application program interface according to any one of claims 1 to 4.
11. A computer program product comprising computer program/instructions, characterized in that the computer program/instructions, when executed by a processor, implement the steps of the method for dynamic generation of application program interfaces of any of claims 1 to 4.
CN202210313140.9A 2022-03-28 2022-03-28 Method and device for dynamically generating application program interface Pending CN114637531A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210313140.9A CN114637531A (en) 2022-03-28 2022-03-28 Method and device for dynamically generating application program interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210313140.9A CN114637531A (en) 2022-03-28 2022-03-28 Method and device for dynamically generating application program interface

Publications (1)

Publication Number Publication Date
CN114637531A true CN114637531A (en) 2022-06-17

Family

ID=81950413

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210313140.9A Pending CN114637531A (en) 2022-03-28 2022-03-28 Method and device for dynamically generating application program interface

Country Status (1)

Country Link
CN (1) CN114637531A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115314573A (en) * 2022-08-05 2022-11-08 中国银行股份有限公司 Dynamic loading method and device for message body, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115314573A (en) * 2022-08-05 2022-11-08 中国银行股份有限公司 Dynamic loading method and device for message body, electronic equipment and storage medium
CN115314573B (en) * 2022-08-05 2024-02-23 中国银行股份有限公司 Dynamic loading method and device for message body, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111031058A (en) Websocket-based distributed server cluster interaction method and device
CN110297944B (en) Distributed XML data processing method and system
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN112463634B (en) Software testing method and device under micro-service architecture
CN112394932A (en) Automatic browser webpage skin changing method and device
CN111464352A (en) Call link data processing method and device
CN112784112A (en) Message checking method and device
CN111857658A (en) Method, device, medium and electronic equipment for rendering dynamic component
CN111369237A (en) Data processing method and device and computer storage medium
CN114153856A (en) Host data double-writing method and device
CN114637531A (en) Method and device for dynamically generating application program interface
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN113342330A (en) Front-end engineering generation method and device
CN113190229A (en) Method and device for generating government affair page
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN113791984B (en) Automatic interface testing method and device
CN112905464B (en) Application running environment data processing method and device
CN115328506A (en) Application package generation method, loading method, device, medium and equipment
CN113050985A (en) Front-end engineering dependence automatic registration method and device
CN110427260B (en) Host job scheduling method, device and system
CN110548285B (en) Game communication control method and device, medium and electronic equipment
CN112102058A (en) Management system parameter configuration method and device
CN112688863B (en) Gateway data processing method and device and electronic equipment
CN112837678B (en) Private cloud recognition training method and device
CN113110828A (en) Front-end prototype debugging method and device

Legal Events

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