Binding method and device of function module, and electronic equipment

By obtaining the list of target methods and executing the bound methods after the application starts, the problem of increased startup time during the binding process of module name and module identifier is solved, realizing efficient module binding in the Swift programming language and adapting to the needs of multi-business development.

CN115344349BActive Publication Date: 2026-03-31BEIJING FANGDUODUO INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-18
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In existing technologies, the process of binding module names and module identifiers requires a strict execution order when the application starts, which increases startup time and affects user experience.

Method used

After the target application starts, the target method list in the target class is obtained, the binding method is determined and executed, and the module name and module identifier are bound together. This avoids hard coding, follows the open/closed principle, and facilitates management and maintenance.

Benefits of technology

It enables the binding of module names and module identifiers without affecting application startup time, reducing development difficulty and complexity, and adapting to the development needs of multiple users and multiple business functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115344349B_ABST
    Figure CN115344349B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a kind of binding method and device of functional module, electronic equipment, which comprises: after target application starts, according to the target class created in advance in the target application, the target method list recording all methods in the target class is acquired, wherein the target class is used to carry out module binding to the functional module in the target application;Determine the plurality of binding methods pointed to by the target method list, and each binding method includes a module name and module identification of the functional module;The plurality of binding methods are executed, and the module name and module identification in each binding method are bound.The present application can realize the binding of module name and module identification in the application program written in Swift programming language without using hard-coded binding mode, and at the same time, the starting time of application program will not be affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network technology, and in particular to a method and apparatus for binding functional modules, and an electronic device. Background Technology

[0002] To make the page content display richer and more flexible, the developers designed a dynamic module scheme, which encapsulates the code for different functions into different functional modules, and each functional module corresponds to an identifier, such as... Figure 1 As shown, the application's container includes binding information between the module names and module identifiers of multiple functional modules. This allows different pages within the application to reuse various functional modules through their module identifiers. During this process, it is necessary to pre-establish... Figure 1 The binding relationship between module names and module identifiers is shown, so that when the module identifier is known, the corresponding module name can be determined, and thus the functional module can be accurately identified.

[0003] Currently, in establishing the binding relationship between module names and module identifiers, injection binding is commonly used to facilitate simultaneous development across multiple business lines. Since the application needs to execute the `+load` method in the programming language during startup, the `+load` method is used to inject the module name and module identifier of the functional module into the container during application startup, thus achieving the binding between module names and module identifiers.

[0004] However, the +load method has a strict execution order; the application will only call the main function after the +load method has completed. This means that the binding of module names and module identifiers for all functional modules needs to be completed during application startup, which undoubtedly increases the application's startup time and severely impacts the user experience. Summary of the Invention

[0005] In view of the above problems, embodiments of the present invention are proposed to provide a binding method, apparatus, and electronic device for functional modules that overcome or at least partially solve the above problems.

[0006] In a first aspect, embodiments of the present invention provide a method for binding functional modules, the method comprising:

[0007] After the target application starts, a target method list is obtained based on the target class created in the target application beforehand, which records all methods in the target class. The target class is used to bind functional modules in the target application.

[0008] Identify multiple binding methods pointed to by the target method list, each binding method including the module name and module identifier of the functional module;

[0009] Execute the multiple binding methods to bind the module name and module identifier in each binding method.

[0010] Optionally, different binding methods may have the same method name, the target class may include multiple categories, and different binding methods may be set in different categories.

[0011] Optionally, the target method list includes multiple function pointers, and each function pointer corresponds one-to-one with a multiple binding method. The function pointers are used to point to their corresponding binding methods. Executing the multiple binding methods, binding the module name and module identifier in each binding method, includes:

[0012] Each binding method is called based on its corresponding function pointer, and the module name and module identifier in each binding method are bound together.

[0013] Optionally, binding the module name and module identifier in each of the binding methods includes:

[0014] For each of the binding methods, an association relationship is established between the module name and the module identifier in the binding method.

[0015] Optionally, determining the multiple binding methods pointed to by the target method includes:

[0016] The target method list is queried based on the name of the binding method to obtain multiple binding methods.

[0017] Optionally, obtaining a target method list that records all methods in the target class based on a target class pre-created in the target application includes:

[0018] The method list is obtained by querying the method list set according to the name of the target class. The method list set includes a set of method lists that record all methods in each class generated for each class in the target application.

[0019] Secondly, embodiments of the present invention also provide a binding device for a functional module, the device comprising:

[0020] The acquisition module is used to acquire a target method list that records all methods in the target class based on the target class that was created in the target application before the target application starts. The target class is used to bind functional modules in the target application.

[0021] The determination module is used to determine multiple binding methods in the target method list. Each binding method includes a module name and module identifier of a functional module, and the module names or module identifiers included in different binding methods belong to different functional modules.

[0022] The binding module is used to execute the plurality of binding methods and bind the module name and module identifier in each of the binding methods.

[0023] Optionally, different binding methods may have the same method name, the target class may include multiple categories, and different binding methods may be set in different categories.

[0024] Thirdly, embodiments of the present invention also provide an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the binding method for functional modules as described in the first aspect.

[0025] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the binding method for functional modules as described in the first aspect.

[0026] In this embodiment of the invention, after the target application starts, a target method list recording all methods in the pre-created target class used for binding functional modules is obtained, thus providing a basis for binding the module name and module identifier in the functional module. Then, the binding method pointed to by the target method list is determined, where the binding method includes the module name and module identifier. By executing the binding method, the binding of the module name and module identifier is completed. This invention eliminates the need for hard-coded binding, enabling the binding of module names and module identifiers in applications written in the Swift programming language without affecting the application's startup time. Furthermore, compared to hard-coded binding, this invention adheres to the open / closed principle, facilitating the management and maintenance of functional modules. Attached Figure Description

[0027] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1A diagram illustrating the binding relationship between module names and module identifiers within a container;

[0029] Figure 2 A flowchart illustrating the steps of the binding method for functional modules provided in this embodiment of the invention;

[0030] Figure 3 A practical application architecture diagram of the binding method for functional modules provided in the embodiments of the present invention;

[0031] Figure 4 A flowchart illustrating the practical application of the binding method for functional modules provided in this embodiment of the invention;

[0032] Figure 5 A flowchart for loading functional modules based on their binding information;

[0033] Figure 6 This is a structural block diagram of the binding device for the functional modules provided in the embodiments of the present invention;

[0034] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0035] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0036] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0037] In various embodiments of the present invention, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0038] See Figure 2 This invention provides a method for binding functional modules, the method comprising:

[0039] Step 201: After the target application starts, obtain the target method list that records all methods in the target class, based on the target class that was created in the target application beforehand.

[0040] It should be noted that the target application startup process requires the execution of multiple methods in the programming language, such as the `start activity safely` method and the `+load` method. After the target application starts, it can be understood that all the methods required for startup have been executed. Alternatively, the target application startup can be based on the call to the main function; the start of the main function call is considered a successful startup. The target class is used to bind functional modules within the target application. Here, code blocks with different functionalities written in a programming language can be encapsulated into one or more functional modules. Preferably, each functional module corresponds to a code block with a specific function written in the programming language, and the code blocks corresponding to different functional modules have different functions. For example, a code block that presents a fixed title style can be written in a programming language and then encapsulated as a title style functional module; a code block that presents a fixed bottom bar style can be written in a programming language and then encapsulated as a bottom bar style functional module. The title style functional module and the bottom bar style functional module are different functional modules.

[0041] A functional module is a reusable module that can be used across different pages in a target application. For example, if pages A and B in the target application have the same title style, the title style functional module can be used directly when displaying page A. Similarly, it can be used directly when displaying page B. Therefore, the title style functional module can be reused by at least two pages (page A and page B), and can be called a reusable functional module. Module binding involves binding the module's name and module identifier. It's understandable that since functional modules are code blocks with different functions written in a programming language, their names follow fixed naming conventions. These could be industry-standard first naming conventions or conventional second naming conventions; no restrictions are placed here. During the loading of a page with a functional module, the server needs to issue the functional module's identifier according to the transmission protocol. If this identifier is the functional module's name, it will not conform to the transmission protocol. Therefore, the identifier must be a module identifier that can be mapped to the functional module's name and conforms to the transmission protocol.

[0042] Step 202: Identify the multiple bound methods that the target method list points to.

[0043] It should be noted that each functional module has a unique module name, and different module identifiers can be mapped to the same module name. That is, the relationship between module identifiers and module names is either one-to-one or many-to-one. In the one-to-one case, there is a one-to-one correspondence between module identifiers and module names, where different module identifiers can correspond to the same or different module names. In the many-to-one case, multiple different module identifiers can correspond to the same module name or different module names. Binding methods are used to bind the corresponding module names and module identifiers. Therefore, each binding method includes the module name and module identifier of a functional module. Different binding methods include different module identifiers, which can be mapped to the module name of the same functional module or to the module names of different functional modules. The module names included in different binding methods can be the same or different.

[0044] Since the target method list records all methods in the target class, it can point to every bound method. Here, the bound methods can be selected from all the methods pointed to by the target method list.

[0045] Step 203: Execute multiple binding methods and bind the module name and module identifier in each binding method.

[0046] It should be noted that multiple binding methods refer to all binding methods in the target class. Here, for each binding method, the module name and module identifier in each binding method will be bound separately, resulting in a binding result. That is, each binding method corresponds to one binding result, and the binding result contains the module name and module identifier from its corresponding binding method.

[0047] In this embodiment of the invention, after the target application starts, a target method list recording all methods in the pre-created target class used for module binding of functional modules is obtained, thus providing a basis for binding the module name and module identifier in the functional module. Then, the binding method pointed to by the target method list is determined, where the binding method includes the module name and module identifier. By executing the binding method, the binding of the module name and module identifier is completed. This invention eliminates the need for hard-coded binding, enabling the binding of module names and module identifiers in applications written in the Swift programming language, without affecting the application's startup time. Furthermore, compared to hard-coded binding, this invention adheres to the open / closed principle, facilitating the management and maintenance of functional modules.

[0048] Optionally, different binding methods may have the same method name, the target class may include multiple categories, and the different binding methods may be set in different categories.

[0049] It should be noted that creating multiple methods with the same name directly within the same class will inevitably lead to conflicts during execution. Therefore, it's advisable to first create different categories within the target class, and then create the binding methods within those categories. This way, even if the binding methods have the same name, due to the nature of categories in Objective-C, there will be no conflicts or overriding during execution. Specifically, the number of categories is equal to the number of binding methods, with a one-to-one correspondence; that is, one binding method is created in each category. Categories are used to extend classes. In Objective-C, for example, categories can be declared using `@interface` and implemented using `@implementation`, allowing binding methods to be created directly within the categories. Of course, when creating categories, binding methods with different names can also be created within the same category. Binding methods in different categories can have the same name, thus reducing the number of categories—that is, the number of categories is less than the number of binding methods.

[0050] Without creating categories, different binding methods can have different method names. In other words, no more than a few binding methods with different names can be created directly under the target class.

[0051] In this embodiment of the invention, when multiple people and multiple services are developing simultaneously, the classification under the target class can prevent multiple binding methods with the same method name from causing code conflicts, thereby reducing the development difficulty and complexity.

[0052] Optionally, the target method list includes multiple function pointers, and each function pointer corresponds one-to-one with a multiple bound method. The function pointer is used to point to its corresponding bound method.

[0053] Execute multiple binding methods, binding the module name and module identifier in each binding method, including:

[0054] Each binding method is called based on its corresponding function pointer, and the module name and module identifier in each binding method are bound together.

[0055] It should be noted that the function pointer points to the starting address of the method implementation. Therefore, a function pointer pointing to a bound method includes: the function pointer being used to point to the starting address of the bound method implementation. Thus, the bound method can be easily invoked through the function pointer. It is understood that the specific form of the function pointer differs in different programming language environments; for example, in the Objective-C programming language environment, the function pointer is IMP. In this embodiment of the invention, the function pointer is not limited to IMP.

[0056] In this embodiment of the invention, by utilizing the characteristics of function pointers, the binding method can be easily invoked, thereby completing the binding of module name and module identifier, reducing the complexity of program execution.

[0057] Optionally, the module name and module identifier in each binding method are bound, including:

[0058] For each binding method, establish a relationship between the module name and the module identifier in the binding method.

[0059] It should be noted that there are multiple binding methods. After establishing the association between module name and module identifier for each binding method, a target file for recording multiple associations can be obtained. This target file can be in any data format. For example, the target file can be a table containing multiple rows of data, where each row records a set of associated module names and module identifiers. Alternatively, the target file can be a file for recording key-value pairs, where each key-value pair corresponds to a set of associated module names and module identifiers, with the key being the module identifier and the value being the module name.

[0060] Of course, target files can also take other data formats, which will not be listed here. It is worth noting that, based on the target file, a unique module name can also be determined if the module identifier is known.

[0061] In this embodiment of the invention, by establishing a corresponding association between module names and module identifiers, the binding of module names and module identifiers can be achieved. Therefore, given a known module identifier, the corresponding module name can be quickly and accurately determined, thereby locating the corresponding functional module.

[0062] Optionally, determine multiple bound methods pointed to by the target method list, including:

[0063] The target method list is queried based on the name of the binding method, resulting in multiple binding methods.

[0064] It should be noted that when recording methods of the target class in the target method list, methods can be recorded by name. Therefore, the target method list will contain the method names of all methods in the target class. It's understandable that when a binding method is created in the target class, the name of the binding method (method name) is already determined. Therefore, by querying the target method list based on this determined method name, information about all methods with that method name can be obtained. Specifically, the target method list can be iterated through, and each method name can be compared with the binding method name. If they match, then that method is the binding method.

[0065] In this embodiment of the invention, the binding method name can be used to quickly and accurately determine the binding method from the target method list, thereby shortening the time required for binding functional modules.

[0066] Optionally, based on the target class pre-created in the target application, obtain a list of target methods that record all methods in the target class, including:

[0067] The method list is obtained by querying the method list set based on the name of the target class. The method list set consists of a collection of method lists of all methods in the record class generated for each class in the target application.

[0068] It should be noted that during the installation process, the target application will create a method list for each class, which will record all methods in that class. This set of method lists is the collection of all method lists, which necessarily includes the method list created for the target class.

[0069] Understandably, since the target application involves a large number of classes, a large number of method lists will be created. To ensure the smooth operation of the target application, a correspondence between classes and method lists is usually established. That is, given a method list, a unique class can be identified based on the correspondence. Therefore, the corresponding class and method list have the same name. For example, if the class name of the first class is "Management," then the name of the corresponding method list for the first class is also "Management." Since the name of the target class (class name) is determined when the target class is created, a query can be performed on the method list set based on this determined class name to obtain information on all method lists with that class name. Specifically, the method list set can be traversed, and the name of each method list can be compared with the name of the target class. If they match, then that method list is the target method list.

[0070] In this embodiment of the invention, the mechanism of creating different method lists for different classes by the target application is utilized, and the target method list with the name of the target class is directly obtained from the created method lists for use, which simplifies the processing steps of the binding process.

[0071] Optionally, when the target class includes multiple categories, some categories are written in Objective-C and some categories are written in Swift.

[0072] It should be noted that when the target class includes multiple categories, different binding methods may have the same method name, and these binding methods may be set in different categories. Since the Swift programming language lacks runtime features, categories written in Swift can be given runtime characteristics by adding the `@objc` annotation.

[0073] In this embodiment of the invention, the target class can be compatible with categories written in both Objective-C and Swift programming languages, enabling seamless integration of Objective-C and Swift programming and reducing differences in underlying code.

[0074] like Figure 3 The diagram illustrates the practical application architecture of the functional module binding method provided in this embodiment of the invention. During the development of the target application, an injection management class needs to be created in the project, and multiple categories are created within this class. This explanation uses three categories, but is not limited to three. The three categories are Category A, Category B, and Category C. Each functional module corresponds to only one category in the injection management class, and each category implements an `enter` method for module binding. The `enter` method injects the module name and module identifier. Specifically, the `enter` method of Category A injects the module name and module identifier of the header module. The `enter` method of Category B injects the module name and module identifier of the title module. The `enter` method of Category C injects the module name and module identifier of the bottom bar module. Figure 3 The container section is for illustrative purposes only. Multiple bound module names and module identifiers can be injected into the container.

[0075] After the target application starts, due to the runtime and category characteristics of the Objective-C programming language, methods with the same name in a category will not be overridden. Therefore, multiple `enter` methods can be used to bind the module names and module identifiers of different functional modules within the container. For details, please refer to... Figure 4 The flowchart illustrates the practical application of the binding method for the functional modules shown. It includes:

[0076] Step 401: Launch the target application. After the electronic device receives the user's input of clicking the target application's icon on the desktop, it will launch the target application and complete the launch process.

[0077] Step 402: Obtain the method list corresponding to the injection management class. This method list is the target method list in the above embodiment of the invention, which records all methods in the injection management class, that is, all methods of all categories in the injection management class. Specifically, it includes all the enter methods.

[0078] Step 403: Obtain the IMP of all enter methods in the method list. That is, obtain the function pointer of each enter method. The method list records the IMP of each method.

[0079] Step 404: Call IMP to execute each enter method. Call the IMP corresponding to each enter method to execute each enter method, and bind the module name and module identifier in the enter method.

[0080] Step 405: For each enter method, obtain a key-value pair consisting of the module name and the module identifier.

[0081] In this embodiment of the invention, the binding process of the module is executed after the target application has finished starting, which does not affect the startup time of the target application; it follows the open / closed principle and the separation of concerns in the design principles, and will not cause conflicts or interference when multiple people and multiple services are developing at the same time.

[0082] Optionally, after executing multiple binding methods and binding the module name and module identifier in each binding method, the method further includes:

[0083] When the target application displays the target page, the data request corresponding to the target page is sent to the backend server of the target application so that the backend server can determine the target module identifier based on the layout information of the target page. The target module identifier is the module identifier corresponding to the target functional module required during the display of the target page.

[0084] Receive the target module identifier returned by the backend server;

[0085] Based on the binding information of module name and module identifier in each functional module, determine the target module name corresponding to the target module identifier;

[0086] Load the functional module with the target module name on the target page.

[0087] It should be noted that during the process of finding functional modules based on module names, the data format of each functional module is converted. Therefore, reflection techniques can be used to obtain the functional modules that can be loaded and used. Specifically, for example... Figure 5 The diagram shown is a flowchart of a binding information loading function module based on a functional module, provided in an embodiment of the present invention, including:

[0088] Step 501: Access the target page and send a data request corresponding to the target page to the server. The server is the backend server of the target application.

[0089] Step 502: Receive the target key returned by the server. The server has pre-set layout information for each page in the target application. Based on the received data request, it can determine the target page to be displayed, the functional modules that the target page needs to load, and the module identifier (target key) corresponding to those functional modules.

[0090] Step 503: Based on the key-value pair composed of module name and module identifier in the above embodiments of the invention, determine the target value corresponding to the target key, that is, determine the module name of the functional module to be loaded by the target page.

[0091] Step 504: Reflect the corresponding functional module based on the target value. That is, using reflection technology, reflect the functional module that the target page needs to load based on the module name. Then load the reflected functional module into the target page.

[0092] In this embodiment of the invention, it is only necessary to receive the identifier of the functional module sent by the server, and determine the required functional module to be loaded locally in the target application. This eliminates the need for the server to directly issue functional modules, reducing the pressure on the server and minimizing the adverse effects of low network speed on loading functional modules.

[0093] The above describes the binding method of functional modules provided by the embodiments of the present invention. The binding device of functional modules provided by the embodiments of the present invention will be described below with reference to the accompanying drawings.

[0094] See Figure 6 This invention also provides a binding device for a functional module, the device comprising:

[0095] The acquisition module 61 is used to obtain a list of target methods that record all methods in the target class after the target application starts, based on the target class that is created in the target application in advance. The target class is used to bind functional modules in the target application.

[0096] Module 62 is used to determine the multiple binding methods pointed to by the target method list. Each binding method includes the module name and module identifier of a functional module.

[0097] Binding module 63 is used to execute multiple binding methods, binding the module name and module identifier in each binding method.

[0098] Optionally, different binding methods may have the same method name, the target class may include multiple categories, and the different binding methods may be set in different categories.

[0099] Optionally, the target method list includes multiple function pointers, and each function pointer corresponds to a different binding method. The function pointers are used to point to their corresponding binding methods. The binding module 63 is specifically used to call each binding method based on the function pointers corresponding to each of the multiple binding methods, and to bind the module name and module identifier in each binding method.

[0100] Optionally, the binding module 63 is specifically used to establish a corresponding association between the module name and the module identifier in each binding method.

[0101] Optionally, module 62 is specifically used to query the list of target methods based on the name of the bound method to obtain multiple bound methods;

[0102] Optionally, module 61 is specifically used to query the method list set based on the name of the target class to obtain the target method list, wherein the method list set includes a set consisting of a list of all methods in the record class generated for each class in the target application.

[0103] Optionally, when the target class includes multiple categories, some categories are written in Objective-C and some categories are written in Swift.

[0104] Optionally, the device further includes:

[0105] The sending module is used to send the data request corresponding to the target page to the backend server of the target application when the target application displays the target page, so that the backend server can determine the target module identifier based on the layout information of the target page. The target module identifier is the module identifier of the target functional module required during the display of the target page.

[0106] The receiving module is used to receive the target module identifier returned by the backend server;

[0107] The query module is used to determine the target module name corresponding to the target module identifier based on the binding information of module name and module identifier in each functional module;

[0108] Load module, used to load functional modules with the target module name into the target page.

[0109] The binding device for functional modules provided in this embodiment of the invention can achieve... Figures 2 to 5 The various processes of the binding method implementation of the functional modules in the method embodiment will not be described again here to avoid repetition.

[0110] In embodiments of this invention, after the target application starts, a target method list recording all methods in the pre-created target class used for binding functional modules is obtained, thus providing a basis for binding the module name and module identifier in the functional module. Then, the binding method pointed to by the target method list is determined, where the binding method includes the module name and module identifier. By executing the binding method, the binding of the module name and module identifier is completed. This invention eliminates the need for hard-coded binding, enabling the binding of module names and module identifiers in applications written in the Swift programming language without affecting application startup time. Furthermore, compared to hard-coded binding, this invention adheres to the open / closed principle, facilitating the management and maintenance of functional modules.

[0111] Optional, such as Figure 7 As shown, this application embodiment also provides an electronic device 700, including a processor 701, a memory 702, and a program or instructions stored in the memory 702 and executable on the processor 701. When the program or instructions are executed by the processor 701, they implement the various processes of the above-mentioned binding method embodiment of the functional modules and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0112] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0113] Furthermore, embodiments of the present invention also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a binding method for the functional modules provided in the above embodiments, for example including:

[0114] After the target application starts, based on the target class created in the target application beforehand, a list of target methods that record all methods in the target class is obtained. The target class is used to bind functional modules in the target application.

[0115] Identify the multiple binding methods that the target method list points to, where each binding method includes the module name and module identifier of a functional module;

[0116] Execute multiple binding methods, binding the module name and module identifier in each binding method.

[0117] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0118] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A binding method of a function module, characterized by, The method comprises: After a target application is started, a target method list recording all methods in a target class is acquired according to the target class created in the target application in advance, wherein the target class is used for module binding of a functional module in the target application; A plurality of binding methods pointed to by the target method list are determined, each of the binding methods comprises a module name and a module identifier of the functional module, different binding methods have the same method name, the target class comprises a plurality of categories, and different binding methods are arranged in different categories; The plurality of binding methods are executed to bind the module name and the module identifier in each of the binding methods.

2. The method of claim 1, wherein, The target method list comprises a plurality of function pointers, and the plurality of function pointers correspond to the plurality of binding methods one by one, and the function pointer is used for pointing to the corresponding binding method; The execution of the plurality of binding methods to bind the module name and the module identifier in each of the binding methods comprises: Each of the binding methods is called based on the function pointer corresponding to each of the binding methods to bind the module name and the module identifier in each of the binding methods.

3. The method according to claim 1 or 2, characterized in that, The binding of the module name and the module identifier in each of the binding methods comprises: For each of the binding methods, an association relationship is established between the module name and the module identifier in the binding method.

4. The method of claim 1, wherein, The determination of the plurality of binding methods pointed to by the target method list comprises: The target method list is queried based on the name of the binding method to obtain a plurality of binding methods.

5. The method of claim 1, wherein, The acquisition of the target method list recording all methods in the target class according to the target class created in the target application in advance comprises: A method list set is queried based on the name of the target class to obtain the target method list, wherein the method list set comprises a set of method list groups respectively generated for each class in the target application and recording all methods in the class.

6. A binding apparatus of a function module, characterized by The device comprises: An acquisition module, configured to acquire a target method list recording all methods in a target class according to the target class created in a target application in advance after the target application is started, wherein the target class is used for module binding of a functional module in the target application; A determination module, configured to determine a plurality of binding methods in the target method list, each of the binding methods comprises a module name and a module identifier of the functional module, different binding methods have the same method name, the target class comprises a plurality of categories, and different binding methods are arranged in different categories; A binding module, configured to execute the plurality of binding methods to bind the module name and the module identifier in each of the binding methods.

7. An electronic device comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, characterized in that, The computer program is executed by the processor to realize the steps of the binding method of the functional module according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium and is executed by the processor to realize the steps of the binding method of the functional module according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Voice command based method and device realizing page interaction

    CN108364645A

  • Application operation method and device and electronic equipment

    CN112905167A