CN114416215A - Function calling method and device - Google Patents

Function calling method and device Download PDF

Info

Publication number
CN114416215A
CN114416215A CN202111623975.6A CN202111623975A CN114416215A CN 114416215 A CN114416215 A CN 114416215A CN 202111623975 A CN202111623975 A CN 202111623975A CN 114416215 A CN114416215 A CN 114416215A
Authority
CN
China
Prior art keywords
function
calling
resource identifier
target
call
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
CN202111623975.6A
Other languages
Chinese (zh)
Inventor
崔哲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202111623975.6A priority Critical patent/CN114416215A/en
Publication of CN114416215A publication Critical patent/CN114416215A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure provides a method, a device, equipment, storage media and a computer program product for calling functions, relates to the technical field of software development, and can be applied to scenes such as calling functions. The specific implementation scheme is as follows: receiving a calling request of a target function; generating a calling instruction of the target function based on the resource identifier in the calling request; based on the call instruction, the target function is executed. The flexibility, expandability and compatibility of the calling function are improved.

Description

Function calling method and device
Technical Field
The present disclosure relates to the field of software development technologies, and in particular, to a method, an apparatus, a device, a storage medium, and a computer program product for calling a function.
Background
At present, when the function between each component is subjected to inter-modulation, the inter-modulation is usually performed based on modes of interface sinking, plug-in proxy and page routing, but the modes have insufficient flexibility and constraint force and do not have the capability of dynamically defining the dependency relationship.
Disclosure of Invention
The present disclosure provides a method, apparatus, device, storage medium, and computer program product for calling a function, which improves flexibility of calling a function.
According to an aspect of the present disclosure, there is provided a method of calling a function, including: receiving a calling request of a target function; generating a calling instruction of the target function based on the resource identifier in the calling request; based on the call instruction, the target function is executed.
According to another aspect of the present disclosure, there is provided an apparatus for calling a function, including: a receiving module configured to receive a call request of a target function; the generation module is configured to generate a calling instruction of the target function based on the resource identifier in the calling request; and the execution module is configured to execute the target function based on the calling instruction.
According to still another aspect of the present disclosure, there is provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method for calling the function.
According to yet another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for causing the computer to execute the method of calling a function.
According to yet another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the above-described method of calling a function.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is an exemplary system architecture diagram in which the present disclosure may be applied;
FIG. 2 is a flow diagram for one embodiment of a method of calling a function, according to the present disclosure;
FIG. 3 is a flow diagram of another embodiment of a method of calling a function according to the present disclosure;
FIG. 4 is a flow diagram of yet another embodiment of a method of calling a function according to the present disclosure;
FIG. 5 is a block diagram illustrating one embodiment of an apparatus for calling functions in accordance with the present disclosure;
FIG. 6 is a block diagram of an electronic device for implementing a method of calling a function of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 illustrates an exemplary system architecture 100 to which embodiments of the method of calling a function or the apparatus of calling a function of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to obtain a return value of the call function, and the like. Various client applications, such as a routing table generation application, etc., may be installed on the terminal devices 101, 102, 103.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices including, but not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the above-described electronic apparatuses. It may be implemented as multiple pieces of software or software modules, or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may provide various calling function-based services. For example, the server 105 may analyze and process the requests acquired from the terminal apparatuses 101, 102, 103, and generate a processing result (e.g., generate a call instruction, etc.).
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be noted that the method for calling a function provided by the embodiment of the present disclosure is generally executed by the server 105, and accordingly, a device for calling a function is generally disposed in the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method of calling a function is shown in accordance with the present disclosure. The method for calling the function comprises the following steps:
step 201, receiving a call request of a target function.
In this embodiment, an execution subject of a method of calling a function (e.g., the server 105 shown in fig. 1) may receive a call request of a target function. The target function is a function which requests to call, may be a constructor function for completing instance creation, may be an accessor function for changing or acquiring attributes, or may be a general function for completing page jump and starting system components. The invocation request includes at least two parts: the resource identifier of the target function, the return value type of the target function and the parameter constraint condition. The resource identifier generally comprises a naming mechanism for accessing the resource, a host name for storing the resource and a path of the resource, any resource such as an image, a video and a program can be positioned through a universal resource identifier, and one resource identifier can uniquely determine a function. The return value type, parameter constraint, is the type of parameter and return value specifying the objective function. Illustratively, the call request is app:// com.a/ap ═ xxx, where app:// com.a/a is the resource identifier of the target function, p ═ xxx denotes the parameter and determines the parameter and return value types. The invocation request may be received upon detection of the invocation request.
Step 202, generating a calling instruction of the target function based on the resource identifier in the calling request.
In this embodiment, after obtaining the call request, the execution main body may generate a call instruction of the target function based on the resource identifier in the call request. Specifically, one resource identifier may uniquely determine one function, and therefore, the resource identifier may be determined from the call request first, and then a call instruction of the target function is generated.
And step 203, executing the target function based on the calling instruction.
In this embodiment, the execution subject may execute the target function based on the call instruction after acquiring the call instruction. Specifically, based on the call instruction, the function specified by the resource identifier is obtained first, and is used as the target function, the code of the target function is called, and based on the parameter and the return value type of the target function determined in the call instruction, the target function is executed, and the return value of the target function is obtained.
The method for calling the function, provided by the embodiment of the disclosure, includes the steps of firstly receiving a calling request of a target function, then generating a calling instruction of the target function based on a resource identifier in the calling request, and finally executing the target function based on the calling instruction. The target function can be directly called based on the resource identifier, and the flexibility of function calling is improved.
With further continued reference to FIG. 3, a flow 300 of another embodiment of a method of calling a function is shown in accordance with the present disclosure. The method for calling the function comprises the following steps:
step 301, receiving a call request of a target function.
In this embodiment, the specific operation of step 301 has been described in detail in step 201 in the embodiment shown in fig. 2, and is not described herein again.
Step 302, obtaining the resource identifier in the call request, and determining a target component corresponding to the target function.
In this embodiment, after obtaining the call request, the execution main body may determine, based on the call request, a target component corresponding to the target function. Specifically, the resource identifier may be obtained from the call request, and the resource identifier representing the component may be further determined from the obtained resource identifier, where for some huge source code projects, the source code project may be decoupled in a logical level by a componentization method, the componentization divides the source code project into a plurality of components, each component is a reusable functional module, and each component may include one or more functions. Illustratively, the call request is app:// com.a/ap ═ xxx, where app:// com.a/a is the resource identifier of the target function, further, app:// com.a is the resource identifier of the a component, and/a is the a function in the a component, so it can be determined that the a component is the target component corresponding to the target function.
Step 303, obtaining meta-annotation of the target assembly.
In this embodiment, after the execution subject obtains the target component, the execution subject may obtain a meta-annotation of the target component. The annotation is equivalent to the annotation in the code, the annotation does not provide the description of the code function, but an important component for realizing the program function, the annotation can be marked on a package, a class, an attribute, a method parameter and a local variable, a plurality of annotations can be marked at the same position, and the meta-annotation is the annotation for the annotation. The meta-annotation of the target component may be obtained based on a meta-annotation obtaining function.
And step 304, acquiring functions contained in the target component and call relations among the functions from the meta-annotation.
In this embodiment, after obtaining the meta-annotation of the target component, the execution subject may obtain the function included in the target component and the call relationship between the functions from the meta-annotation. Specifically, in order to improve the code running efficiency and improve the stability of program running, in this embodiment, an implementation manner such as reflection is not used, but a call relationship between functions is generated based on meta-annotation, which may be implemented by using an APT (annotation Processing tool), where the APT is a tool for Processing annotations, and may generate a source file when Processing the annotations, and the APT may also compile the generated source file and an original source file, and generate a class file together with them. The APT can be used for processing the meta-annotation of the target assembly, the generated source file is obtained, and the functions contained in the target assembly and the call relation among the functions are obtained from the generated source file.
Step 305, obtain the target component, resource identifier of each function from the meta-annotation.
In this embodiment, the execution subject may further obtain the resource identifier of each function and the target component from the meta-annotation. Specifically, when the meta-annotation is written, the resource identifier of each component and function may be defined, and therefore, after the meta-annotation is obtained, the resource identifier of each function in the target component and the target component may also be read from the meta-annotation.
Step 306, determining the corresponding relation between each function and the resource identifier and the calling relation between the functions as a routing table.
In this embodiment, the executing entity may generate a routing table based on the function and the resource identifier information of the target component after acquiring the information. Specifically, the resource identifier of the target component, the correspondence between each function and the resource identifier, and the call relationship between the functions may be stored in the routing table, for example, in addition to the resource identifier app:// com.a of the target component, the app:// com.a/a may be corresponding to a function a in the routing table, the function a may call b function as one piece of stored data, and similar sets of correspondence are stored in the routing table, so as to finally form the routing table of the target component.
Step 307 is to determine an objective function corresponding to the resource identifier from at least one function included in the objective component based on the routing table.
In this embodiment, the executing entity may determine the objective function corresponding to the resource identifier based on the routing table. Specifically, the routing table of the target component stores resource identifiers of a plurality of functions, the resource identifier in the call request is compared with the plurality of resource identifiers in the routing table of the target component, and the function corresponding to the successfully matched resource identifier is determined as the target function.
And 308, generating a calling instruction based on the target function, the return value type in the calling request and the parameter constraint condition.
In this embodiment, after obtaining the target function, the execution subject may generate a call instruction based on the target function. Specifically, an instruction that restricts the type of the parameter and return value of the target function may be generated, where the restriction condition is the same as that in the call request, the instruction and the code of the target function are made up into a call instruction, and the call instruction may be code indicating how to call the bytecode of the target function.
Step 309, based on the call instruction, the target function is executed.
In this embodiment, the specific operation of step 309 has been described in detail in step 203 in the embodiment shown in fig. 2, and is not described herein again.
As can be seen from fig. 3, compared with the embodiment corresponding to fig. 2, the method for calling a function in this embodiment may obtain a function corresponding to a resource identifier in a call request based on a routing table, and further execute the function, and may call any function of other components through one resource identifier, thereby further improving flexibility and extensibility of function call, and the function call is independent of a platform, thereby improving compatibility of function call.
With further continued reference to FIG. 4, a flow 400 of yet another embodiment of a method of calling a function according to the present disclosure is shown. The method for calling the function comprises the following steps:
step 401, receiving a call request of a target function.
Step 402, generating a calling instruction of the target function based on the resource identifier in the calling request.
In the present embodiment, the specific operations of steps 401 and 402 have been described in detail in step 201 and 202 in the embodiment shown in fig. 2, and are not described herein again.
Step 403, abstracting the call instruction into an implementation class.
In this embodiment, after obtaining the call instruction, the execution subject may abstract the call instruction into an implementation class. The abstract implementation class can describe basic characteristics and functions which one type of the interface should have, the abstract class has design, complexity and expansibility, a common class implementation interface needs to implement all methods of the interface, code redundancy is easy to cause, and when the abstract implementation interface is implemented, all methods in the interface are not needed to be implemented. Specifically, all call instructions of tiger hill can be defined as one abstract implementation class based on the definition format of the abstract class.
Step 404, binding the implementation class to the resource identifier of the target component.
In this embodiment, after the execution subject generates the implementation class, the implementation class may be bound to the resource identifier of the target component. Specifically, the implementation class can be bound to the resource identifier of the target component based on a dependent injection manner, wherein dependent injection means that when a certain class needs methods that depend on other classes, an instance is newly built through a container and injected into the class that needs the object. After binding the implementation class to the resource identifier of the target component, the implementation class is distributed to the specific code implementation according to the/a path in app:// com.a/a.
Step 405, based on the call instruction, executes the target function.
In this embodiment, the specific operation of step 405 has been described in detail in step 203 in the embodiment shown in fig. 2, and is not described herein again.
As can be seen from fig. 4, in the method for calling a function in this embodiment, a call instruction can be abstracted into an implementation class, and code redundancy is not caused.
With further reference to fig. 5, as an implementation of the method for calling a function, the present disclosure provides an embodiment of an apparatus for calling a function, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be applied to various electronic devices.
As shown in fig. 5, the apparatus 500 for calling a function according to this embodiment may include a receiving module 501, a generating module 502, and an executing module 503. The receiving module 501 is configured to receive a call request of a target function; a generating module 502 configured to generate a calling instruction of the target function based on the resource identifier in the calling request; an execution module 503 configured to execute the target function based on the call instruction.
In the present embodiment, the apparatus 500 for calling a function: the specific processing and the technical effects thereof of the receiving module 501, the generating module 502, and the executing module 503 can refer to the related descriptions of step 201 and step 203 in the corresponding embodiment of fig. 2, which are not described herein again.
In some optional implementations of this embodiment, the generating module 502 includes: the obtaining sub-module is configured to obtain the target function based on the resource identifier in the calling request; and the generation submodule is configured to generate a calling instruction based on the target function, the return value type in the calling request and the parameter constraint condition.
In some optional implementations of this embodiment, the obtaining sub-module includes: the first determining unit is configured to obtain the resource identifier in the calling request and determine a target component corresponding to the target function; an acquisition unit configured to acquire a meta-annotation of a target component; a generating unit configured to generate a routing table of the target component with the meta-annotation; a second determining unit configured to determine an objective function corresponding to the resource identifier from the at least one function included in the objective component based on the routing table.
In some optional implementations of this embodiment, the generating unit includes: the first obtaining subunit is configured to obtain functions contained in the target component and call relations among the functions from the meta-annotation; a second obtaining subunit configured to obtain the target component, the resource identifier of each function, from the meta-annotation; and the determining subunit is configured to determine the corresponding relation between each function and the resource identifier and the calling relation between the functions as the routing table.
In some optional implementations of the present embodiment, the apparatus 500 for calling a function further includes: the abstract processing module is configured to abstract the calling instruction into an implementation class; a binding module configured to bind the implementation class to the resource identifier of the target component.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 6 illustrates a schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data required for the operation of the device 600 can also be stored. The calculation unit 601, the ROM602, and the RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, or the like; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 601 executes the respective methods and processes described above, such as a method of calling a function. For example, in some embodiments, the method of calling a function may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM602 and/or the communication unit 609. When the computer program is loaded into RAM603 and executed by the computing unit 601, one or more steps of the method of calling a function described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured by any other suitable means (e.g., by means of firmware) to execute a method of calling a function.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a server of a distributed system or a server incorporating a blockchain. The server can also be a cloud server, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology. The server may be a server of a distributed system or a server incorporating a blockchain. The server can also be a cloud server, or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (13)

1. A method of calling a function, comprising:
receiving a calling request of a target function;
generating a calling instruction of the target function based on the resource identifier in the calling request;
and executing the target function based on the calling instruction.
2. The method of claim 1, wherein the generating the call instruction of the target function based on the resource identifier in the call request comprises:
acquiring the target function based on the resource identifier in the calling request;
and generating the calling instruction based on the target function, the return value type in the calling request and the parameter constraint condition.
3. The method of claim 2, wherein the obtaining the objective function based on the resource identifier in the call request comprises:
acquiring a resource identifier in the calling request, and determining a target component corresponding to the target function;
obtaining a meta-annotation of the target component;
generating a routing table for the target component with the meta-annotation;
determining the target function corresponding to the resource identifier from at least one function included in the target component based on the routing table.
4. The method of claim 3, wherein the generating a routing table for the target component with the meta-annotation comprises:
acquiring functions contained in the target component and call relations among the functions from the meta-annotation;
acquiring the target component and the resource identifier of each function from the meta-annotation;
and determining the corresponding relation between each function and the resource identifier and the calling relation among the functions as the routing table.
5. The method of claim 4, further comprising:
abstracting the calling instruction into an implementation class;
binding the implementation class to the resource identifier of the target component.
6. An apparatus to call a function, the apparatus comprising:
a receiving module configured to receive a call request of a target function;
a generation module configured to generate a call instruction of the target function based on the resource identifier in the call request;
an execution module configured to execute the target function based on the call instruction.
7. The apparatus of claim 6, wherein the generating means comprises:
an obtaining sub-module configured to obtain the target function based on the resource identifier in the call request;
and the generation submodule is configured to generate the calling instruction based on the target function, the return value type in the calling request and a parameter constraint condition.
8. The apparatus of claim 7, wherein the acquisition submodule comprises:
a first determining unit, configured to obtain a resource identifier in the call request, and determine a target component corresponding to the target function;
an acquisition unit configured to acquire a meta-annotation of the target component;
a generating unit configured to generate a routing table of the target component with the meta-annotation;
a second determining unit configured to determine the objective function corresponding to the resource identifier from at least one function included in the objective component based on the routing table.
9. The apparatus of claim 8, wherein the generating unit comprises:
the first obtaining subunit is configured to obtain the functions contained in the target component and the call relations among the functions from the meta-annotation;
a second obtaining subunit configured to obtain the target component, a resource identifier of each function, from the meta-annotation;
and the determining subunit is configured to determine a corresponding relation between each function and the resource identifier and a calling relation between the functions as the routing table.
10. The apparatus of claim 9, further comprising:
the abstract processing module is configured to abstract the calling instruction into an implementation class;
a binding module configured to bind the implementation class to the resource identifier of the target component.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-5.
13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-5.
CN202111623975.6A 2021-12-28 2021-12-28 Function calling method and device Pending CN114416215A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111623975.6A CN114416215A (en) 2021-12-28 2021-12-28 Function calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111623975.6A CN114416215A (en) 2021-12-28 2021-12-28 Function calling method and device

Publications (1)

Publication Number Publication Date
CN114416215A true CN114416215A (en) 2022-04-29

Family

ID=81269317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111623975.6A Pending CN114416215A (en) 2021-12-28 2021-12-28 Function calling method and device

Country Status (1)

Country Link
CN (1) CN114416215A (en)

Similar Documents

Publication Publication Date Title
CN109542399B (en) Software development method and device, terminal equipment and computer readable storage medium
CN113342345A (en) Operator fusion method and device of deep learning framework
JP2009266245A (en) Method, system and program for managing devices in network
CN110688096B (en) Method and device for constructing application program containing plug-in, medium and electronic equipment
CN111143446A (en) Data structure conversion processing method and device of data object and electronic equipment
CN114816393B (en) Information generation method, device, equipment and storage medium
CN116028028A (en) Request function generation method, device, equipment and storage medium
CN115509522A (en) Interface arranging method and system for low-code scene and electronic equipment
CN109033456B (en) Condition query method and device, electronic equipment and storage medium
CN114443076A (en) Mirror image construction method, device, equipment and storage medium
CN112925583B (en) Host application capability extension method, device, equipment and storage medium
CN108959294B (en) Method and device for accessing search engine
CN116302218B (en) Function information adding method, device, equipment and storage medium
CN111831320A (en) Plug-in management method and device, electronic equipment and storage medium
CN110633162A (en) Remote call implementation method and device, computer equipment and storage medium
CN114880020A (en) Software development kit management method, related device and computer program product
CN114416215A (en) Function calling method and device
CN115168358A (en) Database access method and device, electronic equipment and storage medium
CN110554892A (en) Information acquisition method and device
US20140136471A1 (en) Rapid Provisioning of Information for Business Analytics
CN110351350B (en) Client request processing method and system based on multi-server docking and electronic equipment
CN112068814A (en) Method, device, system and medium for generating executable file
CN116561075B (en) Method for generating dynamic link library file, method and device for calling operator
CN115086441B (en) Information transmission method, device, electronic equipment and storage medium
CN116431108B (en) Object type processing method and device, electronic equipment and storage medium

Legal Events

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