Componentized communication control method, device, system, electronic device and storage medium

By obtaining the page usage requests of the component and dynamically creating component instances using the routing module and reflection mechanism, the problem of hard-coded string dependencies in component-based communication in existing technologies is solved, improving the flexibility and efficiency of communication between components.

CN116684500BActive Publication Date: 2026-02-24SHENZHEN GREEN CONNECTION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310581114.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-22
Publication Date
2026-02-24
Estimated Expiration
2043-05-22

AI Technical Summary

Technical Problem

Existing component-based communication solutions rely on hard-coded strings, which limits the ways in which parameters can be passed between components, reducing communication flexibility and efficiency.

Method used

By obtaining the page usage request of the current component, determining the calling parameters, using the parameter interface and dictionary in the routing module, dynamically creating the target component instance, establishing the communication path between components, and obtaining the class parameters of the target component according to the preset reflection mechanism, the component parameter calling is realized.

Benefits of technology

It improves the flexibility and efficiency of communication between components, can dynamically match target components according to page requests, reduces code failures caused by modifications, and optimizes the component-based communication process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116684500B_ABST
    Figure CN116684500B_ABST
Patent Text Reader

Abstract

The application discloses a kind of component communication control method and device, system, electronic equipment, storage medium, the method includes: obtaining the page use request of at least one current component;For any current component: according to the page use request of current component, determine the call parameter matched with this page use request, and call parameter is used to indicate the parameter call information corresponding to current component;According to call parameter, determine the communication path between current component and target component, and according to communication path, call the component parameters of target component in routing module.It can be seen that the application can determine the call parameter of each current component according to the page use request obtained by the current component, and then call the component parameters of the target component according to the call parameter to open the target page matched with the page use request by the current component, which can improve the communication flexibility between components, and then improve the component communication efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a modular communication control method, apparatus, system, electronic device, and storage medium. Background Technology

[0002] Componentization refers to the process of decoupling and recombining multiple functional modules when decoupling a complex system, with its internal characteristics reflected by various attributes and states.

[0003] Currently, existing component-based communication solutions typically hard-code strings into relevant communication parameters to enable communication between components. However, these existing solutions often rely on hard-coding strings, limiting the ways components can pass parameters. For example, URLs like "register," "implement," and "use" must use the same character rules. If any component makes a change, the code in the other components will become invalid. This reduces the flexibility of communication between components and consequently reduces the efficiency of component-based communication.

[0004] Therefore, it is particularly important to provide a method that can improve the communication flexibility between components and thus improve the efficiency of component-based communication. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a modular communication control method, device, system, electronic device, and storage medium, which can improve the communication flexibility between components and thus improve the modular communication efficiency.

[0006] To address the aforementioned technical problems, the first aspect of this invention discloses a component-based communication control method, the method comprising:

[0007] Get at least one page usage request for the current component;

[0008] For any of the current components described:

[0009] Based on the page usage request of the current component, determine the calling parameters that match the page usage request. The calling parameters are used to indicate the parameter calling information corresponding to the current component.

[0010] Based on the calling parameters, the communication path between the current component and the target component is determined, and based on the communication path, the component parameters of the target component are called in the routing module. The component parameters of the target component are used by the current component to open the target page that matches the page usage request.

[0011] As an optional implementation, in a first aspect of the invention, the calling parameters are used to indicate a page name and / or page title that matches the page usage request;

[0012] And, determining the communication path between the current component and the target component based on the calling parameters includes:

[0013] Based on the calling parameters, the system queries multiple parameter interfaces pre-created by the routing module to see if there is a target parameter interface that matches the calling parameters. Each parameter interface corresponds to a dictionary, which stores the component identifier and component variables of the matching component of the corresponding parameter interface.

[0014] When the target parameter interface is found to exist, the target component corresponding to the call parameter is determined through the target dictionary corresponding to the target parameter interface, and the class parameter of the target component is obtained according to the target dictionary and the preset reflection mechanism.

[0015] Based on the class parameter of the target component, a target instance matching the class parameter is created in the routing module, and based on the target instance, the communication path between the current component and the target component is determined.

[0016] As an optional implementation, in the first aspect of the present invention, the dictionary corresponding to each parameter interface is determined in the following manner:

[0017] Obtain the page service type corresponding to the parameter interface;

[0018] Based on the page service type, determine the matching component for the parameter interface and establish the association between the parameter interface and the matching component;

[0019] Based on the association between the parameter interface and the matching component, the component identifier and component variables of the matching component are obtained, and the dictionary corresponding to the parameter interface is determined based on the component identifier and component variables of the matching component.

[0020] As an optional implementation, in the first aspect of the present invention, the target instance includes a plurality of instance methods;

[0021] And, the step of calling the component parameters of the target component in the routing module according to the communication path includes:

[0022] Based on the communication path and the page usage request, determine at least one target instance method in the target instance that matches the page usage request;

[0023] Through a pre-defined injection mechanism, all methods of the target instance are invoked as component parameters of the target component.

[0024] As an optional implementation, in the first aspect of the present invention, the method further includes:

[0025] Determine the number of components in all current components, and determine whether the number of components is greater than a preset number threshold;

[0026] When it is determined that the number of components is greater than the preset number threshold, a parameter calling order table for all current components is determined based on the page usage request of each current component. The parameter calling order table is used to indicate the parameter calling order of each current component.

[0027] And, the step of calling the component parameters of the target component in the routing module according to the communication path includes:

[0028] The component parameters of the target component are called in the routing module according to the parameter call order table and the communication path.

[0029] As an optional implementation, in the first aspect of the present invention, determining the parameter call order table of all current components based on the page usage request of each current component includes:

[0030] Based on the page usage requests of each current component, predict the amount of page data corresponding to each current component;

[0031] Based on the total amount of data on all the pages and the total number of page usage requests, determine the page usage priority for each current component.

[0032] Based on the page usage priority of all the current components, determine the call order table corresponding to all the current components.

[0033] A second aspect of the present invention discloses a modular communication control device, the device comprising:

[0034] The retrieval module is used to retrieve page usage requests for at least one current component;

[0035] The invocation module is used to determine invocation parameters matching the page usage request of any of the current components, wherein the invocation parameters are used to indicate the parameter invocation information corresponding to the current component; determine the communication path between the current component and the target component based on the invocation parameters; and invoke the component parameters of the target component in the routing module based on the communication path, wherein the component parameters of the target component are used by the current component to open the target page matching the page usage request.

[0036] As an optional implementation, in a second aspect of the invention, the calling parameters are used to indicate a page name and / or page title that matches the page usage request;

[0037] Furthermore, the method by which the calling module determines the communication path between the current component and the target component based on the calling parameters specifically includes:

[0038] Based on the calling parameters, the system queries multiple parameter interfaces pre-created by the routing module to see if there is a target parameter interface that matches the calling parameters. Each parameter interface corresponds to a dictionary, which stores the component identifier and component variables of the matching component of the corresponding parameter interface.

[0039] When the target parameter interface is found to exist, the target component corresponding to the call parameter is determined through the target dictionary corresponding to the target parameter interface, and the class parameter of the target component is obtained according to the target dictionary and the preset reflection mechanism.

[0040] Based on the class parameter of the target component, a target instance matching the class parameter is created in the routing module, and based on the target instance, the communication path between the current component and the target component is determined.

[0041] As an optional implementation, in the second aspect of the invention, the dictionary corresponding to each parameter interface is determined in the following manner:

[0042] Obtain the page service type corresponding to the parameter interface;

[0043] Based on the page service type, determine the matching component for the parameter interface and establish the association between the parameter interface and the matching component;

[0044] Based on the association between the parameter interface and the matching component, the component identifier and component variables of the matching component are obtained, and the dictionary corresponding to the parameter interface is determined based on the component identifier and component variables of the matching component.

[0045] As an optional implementation, in the second aspect of the present invention, the target instance includes a plurality of instance methods;

[0046] Furthermore, the method by which the calling module invokes the component parameters of the target component in the routing module according to the communication path specifically includes:

[0047] Based on the communication path and the page usage request, determine at least one target instance method in the target instance that matches the page usage request;

[0048] Through a pre-defined injection mechanism, all methods of the target instance are invoked as component parameters of the target component.

[0049] As an optional implementation, in a second aspect of the invention, the apparatus further includes:

[0050] The determination module is used to determine the number of components in all the current components.

[0051] The determination module is used to determine whether the number of components is greater than a preset number threshold.

[0052] The determining module is further configured to, when the judging module determines that the number of components is greater than the preset number threshold, determine a parameter calling order table for all current components based on the page usage request of each current component, wherein the parameter calling order table is used to indicate the parameter calling order of each current component;

[0053] Furthermore, the method by which the calling module invokes the component parameters of the target component in the routing module according to the communication path specifically includes:

[0054] The component parameters of the target component are called in the routing module according to the parameter call order table and the communication path.

[0055] As an optional implementation, in the second aspect of the present invention, the method by which the determining module determines the parameter call order table of all current components based on the page usage request of each current component specifically includes:

[0056] Based on the page usage requests of each current component, predict the amount of page data corresponding to each current component;

[0057] Based on the total amount of data on all the pages and the total number of page usage requests, determine the page usage priority for each current component.

[0058] Based on the page usage priority of all the current components, determine the call order table corresponding to all the current components.

[0059] A third aspect of the present invention discloses another modular communication control device, the device comprising:

[0060] Memory containing executable program code;

[0061] A processor coupled to the memory;

[0062] The processor calls the executable program code stored in the memory to execute the componentized communication control method disclosed in the first aspect of the present invention.

[0063] The fourth aspect of the present invention discloses an electronic device for executing the automatic switching method for Internet pages disclosed in the first aspect of the present invention.

[0064] The fifth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute the component-based communication control method disclosed in the first aspect of the present invention.

[0065] The sixth aspect of the present invention discloses a modular communication control system, the system comprising a routing module and multiple components, the system being used to execute the modular communication control method disclosed in the first aspect of the present invention.

[0066] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0067] In this embodiment of the invention, the calling parameters of the current component can be determined based on the page usage request of each current component, and then the component parameters of the target component can be called according to the calling parameters to make the current component open the target page that matches the page usage request. This can improve the communication flexibility between components and thus improve the efficiency of component-based communication. Attached Figure Description

[0068] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.

[0069] Figure 1 This is a flowchart illustrating a component-based communication control method disclosed in an embodiment of the present invention;

[0070] Figure 2 This is a schematic diagram of the structure of a routing module disclosed in an embodiment of the present invention;

[0071] Figure 3 This is a flowchart illustrating another component-based communication control method disclosed in an embodiment of the present invention;

[0072] Figure 4 This is a schematic diagram of another routing module disclosed in an embodiment of the present invention;

[0073] Figure 5 This is a schematic diagram of the structure of a modular communication control device disclosed in an embodiment of the present invention;

[0074] Figure 6 This is a schematic diagram of another componentized communication control device disclosed in an embodiment of the present invention;

[0075] Figure 7 This is a schematic diagram of the structure of another modular communication control device disclosed in an embodiment of the present invention;

[0076] Figure 8 This is a schematic diagram of the structure of a modular communication control system disclosed in an embodiment of the present invention. Detailed Implementation

[0077] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. 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.

[0078] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.

[0079] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0080] Currently, existing traditional component-based communication solutions for iOS, such as URL Scheme and Protocol-Class, often have certain flaws. Specifically, URL Scheme often has limited parameter passing methods and cannot utilize the compiler to check parameter types. In component-based communication implemented through this method, most parameters are converted from strings, making it suitable only for UI modules and not for general modules. Furthermore, URL Scheme often relies on hard-coded strings, failing to guarantee decoupling between components and / or modules. For example, URLs like "register," "implement," and "use" all require the same character rules; any modification to one side will cause the code in other sides to fail. Protocol-Class uses the framework to create all objects. If different objects are created in different ways, parameter transmission between them is impossible. In other words, Protocol-Class does not support complex creation methods and relies heavily on injection mechanisms.

[0081] This invention discloses a component-based communication control method and apparatus, which can determine the calling parameters of each current component based on the page usage request obtained for that current component, and then call the component parameters of the target component according to the calling parameters to enable the current component to open the target page matching the page usage request. This improves the communication flexibility between components and thus improves the efficiency of component-based communication. This can effectively solve the pain points of the prior art, which will be described in detail below.

[0082] Example 1

[0083] Please see Figure 1 , Figure 1 This is a flowchart illustrating a component-based communication control method disclosed in an embodiment of the present invention. Wherein, Figure 1 The described component-based communication control method can be applied to scenarios requiring component-based communication in daily life, and this embodiment of the invention is not limited thereto. Optionally, this method can be implemented by a component-based communication system, or by a local server or cloud server that processes the component-based communication process. The component-based communication system can be integrated into the component-based communication device, or it can exist independently of the component-based communication device; this embodiment of the invention is not limited thereto. Figure 1 As shown, this component-based communication control method can be applied to any current component, and the method includes the following operations:

[0084] 101. Get the page usage request for the current component.

[0085] In this embodiment of the invention, optionally, the current component is used to indicate the component currently initiating a page usage request, such as an iOS component. Optionally, the page usage request is used to indicate the page (ModelView Controller) that the current component needs to open, such as opening a browser's search page. It should be noted that the page usage request of the current component can be determined by the user or automatically by the component-based communication system; this is not limited here.

[0086] 102. Based on the current component's page usage request, determine the calling parameters that match the page usage request.

[0087] In this embodiment of the invention, optionally, the calling parameters are used to indicate the parameter calling information corresponding to the current component. The parameter calling information may be the page name and / or page title of the page that the current component needs to open. The page name is used to indicate the page name of the page that needs to be opened, such as Baidu, Taobao, etc.; the page title is used to indicate the page content of the page that needs to be opened. For example, the page title of Taobao may be shopping, goods, price, etc.

[0088] 103. Determine the communication path between the current component and the target component based on the calling parameters; based on the communication path, call the component parameters of the target component in the routing module.

[0089] In an embodiment of the present invention, optionally, the target component matching the page usage request of the current component can be determined by the content corresponding to the calling parameter, and then the communication path between the current component and the target component can be determined in the routing module. Through the communication path, the current component can call the component parameters of the target component as needed. The component parameters of the target component are used by the current component to open the target page matching the page usage request.

[0090] In this embodiment of the invention, optionally, please refer to... Figure 2 , Figure 2 A schematic diagram of a routing module is shown, such as... Figure 2 As shown, the routing module is essentially middleware that establishes a relationship with both the current component and the target component. By adding parameter interfaces to the routing module, when the current component needs to access the target component's parameters, it can retrieve the target component's parameters through the corresponding parameter interface and return a target instance. It should be noted that... Figure 2The current component and target component shown are only for illustrative purposes. In actual use, there can be multiple current components and multiple target components that are associated with this routing module. Therefore, this routing module can decouple components, so that the component parameters of the target component can be called only according to the page name and / or page title included in the calling parameters of the current component, which is beneficial to improving the efficiency of component-based communication.

[0091] As can be seen, implementing the embodiments of the present invention can determine the calling parameters of the current component based on the obtained page usage request of the current component, and then call the component parameters of the target component according to the calling parameters so that the current component opens the target page that matches the page usage request, which can improve the communication flexibility between components and thus improve the efficiency of component-based communication.

[0092] In an optional embodiment, the method further includes:

[0093] Determine the number of components in all current components and check if the number of components exceeds a preset threshold.

[0094] When it is determined that the number of components exceeds the preset threshold, the parameter call order table of all current components is determined based on the page usage requests of each current component.

[0095] Furthermore, step 103 above, based on the communication path, calls the component parameters of the target component in the routing module, including:

[0096] Based on the parameter call order table and communication path, the component parameters of the target component are called in the routing module.

[0097] In this optional embodiment, the parameter call order table can be used to indicate the parameter call order of each current component. For example, the parameter call order table can indicate that the call order of current component A takes precedence over current component B, the call order of current component B takes precedence over current component C, and so on. By arranging the call order of all current components through this parameter call order table, the priority of different call operations can be distinguished, allowing more important call operations to be executed first, thereby improving the communication flexibility between components.

[0098] In this optional embodiment, as an optional implementation, the above step of determining whether the number of components is greater than a preset number threshold includes:

[0099] Get the component data volume of each current component, and calculate the average component data volume of all current components based on the component data volume of all current components and the number of components;

[0100] Determine whether the average component data volume is greater than a preset average data volume threshold.

[0101] When it is determined that the average data volume of a component is greater than the preset average data volume threshold, the number of components is determined to be greater than the preset number threshold.

[0102] When it is determined that the average data volume of a component is less than the preset average data volume threshold, the number of components is determined to be less than the preset number threshold.

[0103] In this optional implementation, the preset average data volume threshold can be set by technicians based on component business requirements, or it can be automatically set by the componentized communication system; this is not limited here. Optionally, different current components may have different component data volumes, while each current component has the same data transmission efficiency. When there are multiple current components and each current component has a large component data volume, simultaneous parameter call operations by all current components may cause the routing module to become overloaded. When there are multiple current components and the component data volumes of each current component are different, when all current components perform parameter call operations simultaneously, the current component with a smaller component data volume will complete the parameter call operation earlier than the current component with a larger component data volume, thus freeing up extra call space and preventing the routing module from becoming overloaded. Therefore, the average component data volume of all current components can be compared with the preset average data volume threshold to determine whether the number of components in all current components exceeds the preset number threshold. It should be noted that the preset number threshold can be dynamically adjusted as needed; that is, when the component data volume of all current components is generally large, the preset number threshold corresponding to these current components is lower, and vice versa.

[0104] As can be seen, this optional implementation can calculate the average component data volume of all current components and compare it with a preset average data volume threshold. Then, based on the comparison result, it can determine whether the number of components of all current components is greater than the preset number threshold. This can improve the accuracy of judging whether the number of components is greater than the preset number threshold, provide an accurate data basis for subsequent steps, and thus improve the efficiency of component-based communication.

[0105] As can be seen, this optional embodiment can determine the parameter call order table of all current components when the number of components is greater than a preset threshold, and then instruct each current component to perform parameter call operations according to the set call order based on the call order table. This can further improve the flexibility of communication between components, avoid the phenomenon of busy calls in the routing module, and thus improve the efficiency of component-based communication.

[0106] In another optional embodiment, the above steps, based on the page usage requests of each current component, determine the parameter call order table for all current components, including:

[0107] Based on the page usage requests of each current component, predict the amount of page data corresponding to each current component;

[0108] Based on the total amount of data on all pages and the total number of page usage requests, determine the page usage priority for each current component;

[0109] Determine the call order table for all current components based on their page usage priority.

[0110] In this optional embodiment, optionally, since the page usage request is used to indicate the page that the current component needs to open, the amount of page data required to open different pages varies. For example, the amount of page data required to open a page with many images is often larger than the amount of page data required to open a plain text page. Optionally, when the amount of page data required to open a page is large, its corresponding page usage priority will also be higher; conversely, when the amount of page data required to open a page is small, its corresponding page usage priority will also be lower. This helps to balance the time required for all current components to complete the call operation, reduce the opening interval between all pages that need to be opened for all current components, and thus improve the component-based communication experience.

[0111] In this optional embodiment, each current component is arranged in descending order of page usage priority based on its page usage priority. When the difference between the page component priorities of multiple current components is less than a preset difference, these current components are sorted in parallel, which helps to improve the fault tolerance of the call order list.

[0112] As can be seen, this optional embodiment can predict the amount of page data corresponding to each current component, thereby determining the page usage priority of each current component, and then determining the calling order table of all current components. It can arrange the calling order of each current component as needed, avoiding the phenomenon of busy calling in the routing module, thereby improving the communication flexibility between components, and further improving the efficiency of component-based communication.

[0113] Example 2

[0114] Please see Figure 3 , Figure 3 This is a flowchart illustrating a component-based communication control method disclosed in an embodiment of the present invention. Wherein, Figure 3 The described component-based communication control method can be applied to scenarios requiring component-based communication in daily life, and this embodiment of the invention is not limited thereto. Optionally, this method can be implemented by a component-based communication system, or by a local server or cloud server that processes the component-based communication process. The component-based communication system can be integrated into the component-based communication device, or it can exist independently of the component-based communication device; this embodiment of the invention is not limited thereto. Figure 3As shown, this component-based communication control method can be applied to any current component, and the method includes the following operations:

[0115] 201. Get the page usage request for the current component.

[0116] 202. Based on the current component's page usage request, determine the calling parameters that match the page usage request.

[0117] 203. Based on the calling parameters, query among the multiple parameter interfaces pre-created in the routing module to see if there is a target parameter interface that matches the calling parameters.

[0118] In this embodiment of the invention, optionally, the routing module pre-creates different parameter interfaces to obtain the component identifiers and component variables of different components, and encapsulates them into a dictionary and returns it. That is, each parameter interface corresponds to a dictionary, which is used to store the component identifiers and component variables of the matching components of the corresponding parameter interface. Optionally, the component identifier is used to indicate the name of the matching component of the corresponding parameter interface, such as an illustration component, a video playback component, etc.; the component variable is used to indicate all the parameters included in the matching component of the corresponding parameter interface, such as the image format parameters and image color parameters in the illustration component.

[0119] 204. When a target parameter interface is found, the target component corresponding to the call parameter is determined through the target dictionary corresponding to the target parameter interface, and the class parameters of the target component are obtained according to the target dictionary and the preset reflection mechanism.

[0120] In this embodiment of the invention, optionally, since each parameter interface corresponds to a matching component and a dictionary, the target component corresponding to the target parameter interface can be determined by the component identifier included in the target dictionary. Optionally, the preset reflection mechanism is used to instruct the acquisition of the class parameter of the target component through the component identifier. For example, assuming the component identifier is presented in string form, based on the above assumption, NSClassFromString (preset reflection mechanism) can be used to obtain the class parameter of the target component.

[0121] 205. Based on the class parameters of the target component, create a target instance in the routing module that matches the class parameters, and determine the communication path between the current component and the target component based on the target instance.

[0122] In an embodiment of the present invention, optionally, after type casting the obtained class parameter of the target component, a preset initialization method is called to generate a target instance corresponding to the class parameter, and the target instance is used as the communication path between the current component and the target component. The target instance includes multiple instance methods, and the current component can realize parameter interaction with the target component by calling the instance methods of the target instance.

[0123] 206. Based on the communication path, call the component parameters of the target component in the routing module.

[0124] In this embodiment of the invention, for other descriptions of steps 201, 202 and 206, please refer to the detailed description of steps 101-103 in Embodiment 1. This embodiment of the invention will not repeat them.

[0125] As can be seen, implementing the embodiments of the present invention can determine the calling parameters of the current component based on the obtained page usage request of the current component, and then call the component parameters of the target component according to the calling parameters so that the current component opens the target page matching the page usage request. This can improve the communication flexibility between components and thus improve the efficiency of component-based communication. Furthermore, when the target parameter interface exists in the routing module through the calling parameters, a corresponding target instance can be created based on the target dictionary corresponding to the target interface and the preset reflection mechanism to determine the communication path between the current component and the target component. This can improve the communication accuracy between the current component and the target component and thus improve the efficiency of component-based communication.

[0126] In an optional embodiment, the dictionary corresponding to each parameter interface is determined in the following way:

[0127] The page business type corresponding to the parameter retrieval interface;

[0128] Based on the page's business type, determine the matching components for the parameter interfaces and establish the association between the parameter interfaces and the matching components;

[0129] Based on the association between the parameter interface and the matching component, obtain the component identifier and component variables of the matching component, and determine the dictionary corresponding to the parameter interface based on the component identifier and component variables of the matching component.

[0130] In this optional embodiment, the page service type may optionally include: aggregation type, list type, content type, function type, etc., wherein: aggregation type pages are used to indicate aggregated display pages for function entry; list type pages are used to indicate pages displaying information of the same category for users to filter; content type pages are used to indicate pages displaying specific information; and function type pages are used to indicate pages existing to complete a certain function. Optionally, since opening pages of different service types requires different parameter types, the matching components called are also different. Therefore, the association between the parameter interface and its matching components can be established through the page service type corresponding to the parameter interface. This association can improve the accuracy of the component parameters called by the parameter interface.

[0131] In this optional embodiment, the component identifier and component variables of the matching component can be encapsulated to obtain the dictionary corresponding to the matching component, that is, the dictionary corresponding to the parameter interface.

[0132] In this optional embodiment, as an optional implementation, establishing the association between the parameter interface and the matching component in the above steps includes:

[0133] Retrieve the unique component identifier of the matching component;

[0134] Based on the preset encryption algorithm and the unique component identifier, generate the encrypted string for the corresponding parameter interface of the matching component;

[0135] Based on the preset association protocol and the above encrypted string, establish the association between the parameter interface and the matching component.

[0136] In this optional implementation, the unique component identifier of the matching component may be presented in the form of a string, hash value, component number, etc. Optionally, once an association is established between the parameter interface and the matching component, the parameter interface is only used to connect to the corresponding matching component and cannot connect to other non-matching components.

[0137] As can be seen, this optional implementation can generate an encrypted string corresponding to the parameter interface, and then establish an association between the parameter interface and the matching component according to the preset association protocol and the encrypted string. This can ensure the uniqueness of the parameter interface, avoid parameter calling confusion, and further improve the efficiency of component-based communication.

[0138] As can be seen, this optional embodiment can determine the matching component for each parameter interface based on the page business type corresponding to each parameter interface, thereby establishing the association between each parameter interface and the corresponding matching component, and then determining the dictionary corresponding to each parameter interface. The dictionary is used to realize the call navigation function, reducing redundant program judgment logic and improving the efficiency of component-based communication.

[0139] In another alternative embodiment, the target instance described above includes multiple instance methods;

[0140] Furthermore, step 206 above, based on the communication path, calls the component parameters of the target component in the routing module, including:

[0141] Based on the communication path and page usage request, determine at least one target instance method in the target instance that matches the page usage request;

[0142] By using a pre-defined injection mechanism, all target instance methods are invoked as component parameters for the target component.

[0143] In this optional embodiment, optionally, please refer to Figure 4 , Figure 4 This illustrates the structure of another routing module, such as... Figure 4 As shown, the corresponding instances of the current component include, for example: Figure 4 The example methods are Instance Method 1, Instance Method 2, and Instance Method 3; the target instance corresponding to the target component includes, for example, Instance Method 1, Instance Method 2, and Instance Method 3. Figure 4 The instance methods 4, 5, and 6 shown are for illustrative purposes only. It's important to note that the method numbers are used to distinguish different instance methods and do not limit the number of instance methods an instance contains. In practice, every instance of any current component and every target component includes at least one instance method. Optionally, the current component, based on the page usage request, determines at least one target instance method corresponding to the page to be opened from a pre-defined communication path and calls all target instance methods through a pre-defined injection mechanism. For example, as... Figure 4 As shown, assuming that the page that the current component needs to open is implemented through instance method 4 and instance method 5 of the target component, based on the above assumption, the current component can dynamically call instance method 4 and instance method 5 in the target component through NSInvocation (pre-defined injection mechanism) in the routing module through its corresponding information forwarding function.

[0144] As can be seen, this optional embodiment can determine at least one target instance method based on the communication path and page usage request, and then dynamically call all target instance methods to open the target page according to the preset injection mechanism, which can improve the accuracy of instance method selection and help to further improve the efficiency of component-based communication.

[0145] Example 3

[0146] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a modular communication control device disclosed in an embodiment of the present invention. Figure 5 The described modular communication control device can be applied to scenarios where modular communication is required in daily life, and this embodiment of the invention is not limited thereto. Optionally, the device can be implemented by a modular communication system, or by a local server or cloud server that processes the modular communication process. The modular communication system can be integrated into the modular communication device or exist independently of it, and this embodiment of the invention is not limited thereto. Figure 5 As shown, the modular communication control device may include:

[0147] The acquisition module 301 is used to acquire at least one page usage request for the current component;

[0148] The calling module 302 is used to determine the calling parameters that match the page usage request of any current component. The calling parameters are used to indicate the parameter calling information corresponding to the current component. Based on the calling parameters, the communication path between the current component and the target component is determined. Based on the communication path, the component parameters of the target component are called in the routing module. The component parameters of the target component are used by the current component to open the target page that matches the page usage request.

[0149] It is evident that implementation Figure 5 The described component-based communication control device can determine the calling parameters of the current component based on the page usage request of the current component, and then call the component parameters of the target component according to the calling parameters so that the current component opens the target page that matches the page usage request. This can improve the communication flexibility between components and thus improve the efficiency of component-based communication.

[0150] In an optional embodiment, the calling parameters are used to indicate the page name and / or page title that matches the page usage request;

[0151] Furthermore, the specific methods by which the aforementioned calling module 302 determines the communication path between the current component and the target component based on the calling parameters include:

[0152] Based on the call parameters, the system queries multiple parameter interfaces pre-created in the routing module to see if there is a target parameter interface that matches the call parameters. Each parameter interface corresponds to a dictionary, which stores the component identifier and component variables of the matching component for the corresponding parameter interface.

[0153] When a target parameter interface is found, the target component corresponding to the call parameter is determined through the target dictionary corresponding to the target parameter interface, and the class parameter of the target component is obtained according to the target dictionary and the preset reflection mechanism.

[0154] Based on the class parameters of the target component, a target instance matching the class parameters is created in the routing module, and based on the target instance, the communication path between the current component and the target component is determined.

[0155] It is evident that implementation Figure 5 The described component-based communication control device can, when a target parameter interface is found in the routing module by calling parameters, create a corresponding target instance based on the target dictionary corresponding to the target interface and a preset reflection mechanism to determine the communication path between the current component and the target component. This can improve the accuracy of communication between the current component and the target component, thereby improving the efficiency of component-based communication.

[0156] In another alternative embodiment, the dictionary corresponding to each parameter interface is determined in the following manner:

[0157] The page business type corresponding to the parameter retrieval interface;

[0158] Based on the page's business type, determine the matching components for the parameter interfaces and establish the association between the parameter interfaces and the matching components;

[0159] Based on the association between the parameter interface and the matching component, obtain the component identifier and component variables of the matching component, and determine the dictionary corresponding to the parameter interface based on the component identifier and component variables of the matching component.

[0160] It is evident that implementation Figure 5 The described component-based communication control device can determine the matching component for each parameter interface based on the page service type corresponding to each parameter interface, thereby establishing the association between each parameter interface and the corresponding matching component, and then determining the dictionary corresponding to each parameter interface. This dictionary enables the call navigation function, reduces redundant program judgment logic, and helps improve the efficiency of component-based communication.

[0161] In yet another optional embodiment, the target instance includes multiple instance methods;

[0162] Furthermore, the specific methods by which the aforementioned calling module 302 calls the component parameters of the target component in the routing module according to the communication path include:

[0163] Based on the communication path and page usage request, determine at least one target instance method in the target instance that matches the page usage request;

[0164] By using a pre-defined injection mechanism, all target instance methods are invoked as component parameters for the target component.

[0165] It is evident that implementation Figure 5 The described component-based communication control device can determine at least one target instance method based on the communication path and page usage request, and then dynamically call all target instance methods to open the target page according to a preset injection mechanism. This can improve the accuracy of instance method selection and further improve the efficiency of component-based communication.

[0166] In yet another alternative embodiment, such as Figure 6 As shown, the device also includes:

[0167] Module 303 is used to determine the number of components in all current components;

[0168] Module 304 is used to determine whether the number of components exceeds a preset threshold.

[0169] The aforementioned determining module 303 is further configured to, when the aforementioned judging module 304 determines that the number of components is greater than a preset number threshold, determine the parameter calling order table of all current components based on the page usage request of each current component, wherein the parameter calling order table is used to indicate the parameter calling order of each current component;

[0170] Furthermore, the specific methods by which the aforementioned calling module 302 calls the component parameters of the target component in the routing module according to the communication path include:

[0171] Based on the parameter call order table and communication path, the component parameters of the target component are called in the routing module.

[0172] It is evident that implementation Figure 6 The described component-based communication control device can determine the parameter call order table of all current components when the number of components exceeds a preset threshold. Then, according to the call order table, it instructs each current component to perform parameter call operations according to the set call order. This can further improve the flexibility of communication between components, avoid the phenomenon of busy calls in the routing module, and thus improve the efficiency of component-based communication.

[0173] In yet another optional embodiment, the method by which the determining module 303 determines the parameter call order table of all current components based on the page usage request of each current component specifically includes:

[0174] Based on the page usage requests of each current component, predict the amount of page data corresponding to each current component;

[0175] Based on the total amount of data on all pages and the total number of page usage requests, determine the page usage priority for each current component;

[0176] Determine the call order table for all current components based on their page usage priority.

[0177] It is evident that implementation Figure 6 The described component-based communication control device can predict the amount of page data corresponding to each current component, thereby determining the page usage priority of each current component, and then determining the calling order table of all current components. It can arrange the calling order of each current component as needed, avoiding the phenomenon of busy calling in the routing module, thereby improving the communication flexibility between components and further improving the efficiency of component-based communication.

[0178] Example 4

[0179] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of another modular communication control device disclosed in an embodiment of the present invention. For example... Figure 7As shown, the modular communication control device may include:

[0180] Memory 401 storing executable program code;

[0181] Processor 402 coupled to memory 401;

[0182] The processor 402 calls the executable program code stored in the memory 401 to execute the steps in the componentized communication control method described in Embodiment 1 or Embodiment 2 of the present invention.

[0183] Example 5

[0184] This invention discloses a computer storage medium storing computer instructions. When these computer instructions are invoked, they are used to execute the steps in the componentized communication control method described in Embodiment 1 or Embodiment 2 of this invention.

[0185] Example 6

[0186] This invention discloses an electronic device for executing the steps of the componentized communication control method described in Embodiment 1 or Embodiment 2 of this invention. Optionally, the electronic device refers to an internet device, such as a computer (desktop computer, PDA, tablet computer, portable computer, etc.), a smartphone (Android phone, iOS phone, etc.), a smartwatch, and mobile internet devices (MIDs) capable of componentized communication; this is not limited to any particular type.

[0187] Example 7

[0188] Please refer to Figure 8 , Figure 8 This is a schematic diagram of the structure of a modular communication control system disclosed in an embodiment of the present invention. Figure 8 As shown, the system includes a routing module 501 and multiple components 502. The system is used to execute the componentized communication control method described in Embodiment 1 or Embodiment 2 of the present invention.

[0189] Example 8

[0190] This invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the steps in the componentized communication control method described in Embodiment 1 or Embodiment 2.

[0191] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. 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.

[0192] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method 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, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0193] Finally, it should be noted that the component-based communication control method and apparatus disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit it. 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. Such 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 component-based communication control method, characterized in that, The method includes: Get at least one page usage request for the current component; Determine the number of components in all current components and determine whether the number of components is greater than a preset number threshold; when it is determined that the number of components is greater than the preset number threshold, determine the parameter call order table of all current components according to the page usage request of each current component, the parameter call order table is used to indicate the parameter call order of each current component; For any of the current components described: Based on the page usage request of the current component, determine the calling parameters that match the page usage request. The calling parameters are used to indicate the parameter calling information corresponding to the current component. Based on the calling parameters, a target component matching the page usage request of the current component is determined, and a communication path between the current component and the target component is determined in the routing module. Based on the calling order table of the parameters and the communication path, the component parameters of the target component are called in the routing module. The component parameters of the target component are used by the current component to open the target page matching the page usage request.

2. The component-based communication control method according to claim 1, characterized in that, The calling parameters are used to indicate the page name and / or page title that match the page usage request; And, determining the communication path between the current component and the target component based on the calling parameters includes: Based on the calling parameters, the system queries multiple parameter interfaces pre-created by the routing module to see if there is a target parameter interface that matches the calling parameters. Each parameter interface corresponds to a dictionary, which stores the component identifier and component variables of the matching component of the corresponding parameter interface. When the target parameter interface is found to exist, the target component corresponding to the call parameter is determined through the target dictionary corresponding to the target parameter interface, and the class parameter of the target component is obtained according to the target dictionary and the preset reflection mechanism. Based on the class parameter of the target component, a target instance matching the class parameter is created in the routing module, and based on the target instance, the communication path between the current component and the target component is determined.

3. The component-based communication control method according to claim 2, characterized in that, The dictionary corresponding to each parameter interface is determined in the following way: Obtain the page service type corresponding to the parameter interface; Based on the page service type, determine the matching component for the parameter interface and establish the association between the parameter interface and the matching component; Based on the association between the parameter interface and the matching component, the component identifier and component variables of the matching component are obtained, and the dictionary corresponding to the parameter interface is determined based on the component identifier and component variables of the matching component.

4. The component-based communication control method according to claim 2 or 3, characterized in that, The target instance includes multiple instance methods; And, the step of calling the component parameters of the target component in the routing module according to the communication path includes: Based on the communication path and the page usage request, determine at least one target instance method in the target instance that matches the page usage request; Through a pre-defined injection mechanism, all methods of the target instance are invoked as component parameters of the target component.

5. The component-based communication control method according to any one of claims 1-3, characterized in that, The step of determining the parameter call order table for all current components based on the page usage request of each current component includes: Based on the page usage requests of each current component, predict the amount of page data corresponding to each current component; Based on the total amount of data on all the pages and the total number of page usage requests, determine the page usage priority for each current component. Based on the page usage priority of all the current components, determine the call order table corresponding to all the current components.

6. A modular communication control device, characterized in that, The device includes: The retrieval module is used to retrieve page usage requests for at least one current component; The determination module is used to determine the number of components in all the current components. The determination module is used to determine whether the number of components is greater than a preset number threshold. The determining module is further configured to, when the judging module determines that the number of components is greater than the preset number threshold, determine a parameter calling order table for all current components based on the page usage request of each current component, wherein the parameter calling order table is used to indicate the parameter calling order of each current component; The invocation module is configured to determine, based on any page usage request of the current component, invoking parameters that match the page usage request, wherein the invocation parameters indicate parameter invocation information corresponding to the current component; determine, based on the invocation parameters, a target component that matches the page usage request of the current component, and determine a communication path between the current component and the target component in the routing module; and invoking the component parameters of the target component in the routing module according to the parameter invocation order table and the communication path, wherein the component parameters of the target component are used by the current component to open the target page that matches the page usage request.

7. A modular communication control device, characterized in that, The device includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the componentized communication control method as described in any one of claims 1-5.

8. An electronic device, characterized in that, The electronic device is used to perform the componentized communication control method as described in any one of claims 1-5.

9. A computer storage medium, characterized in that, The computer storage medium stores computer instructions, which, when invoked, are used to execute the componentized communication control method as described in any one of claims 1-5.

10. A modular communication control system, characterized in that, The system includes a routing module and multiple components, and is used to execute the componentized communication control method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • System and method for implementing page invocation

    CN101197812A

  • Page jump and route configuration method, device and system and storage medium

    CN113296856A