Information calling method, electronic equipment and vehicle
By pre-constructing a mapping call relationship library for each business module during the code compilation stage, the calling module communicates with the business module through static calls, solving the problem of strong dependence on the business module by calling modules, and improving the business call performance and system operation efficiency.
Patent Information
- Application Number
- CN202411915796.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, the strong dependence of the calling module on the service module leads to limited improvement in the performance of the service calling and lack of flexibility.
During the code compilation stage, the mapping call relationship library is pre-built for each business module. This library contains the mapping of the implementation method name and the calling tool. The calling module communicates with the business module through static calls to avoid directly calling the implementation methods of the business module.
It realizes the decoupling of the calling module and the business module, improves the service calling performance, improves the operating efficiency of the system, and consumes almost no performance.
Smart Images

Figure CN119862226A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle technology, and in particular to an information calling method, an electronic device and a vehicle. Background Art
[0002] Generally, an application program includes a user module, a call module, and a business module. A user can input a call request through a user interface. Based on the call request, the call module calls the implementation method for the call request in each business module to respond to the user's call request. However, the existing call module has a strong dependency on the business module due to the call requirements, lacks flexibility, and thus affects the improvement of business call performance. Summary of the invention
[0003] In view of this, the purpose of the present application is to propose an information calling method, an electronic device and a vehicle to solve the problem of affecting the service calling performance due to the strong dependence of the calling module on the service module.
[0004] Based on the above purpose, the present application provides an information calling method, including:
[0005] In response to receiving a call request from a user, determining a target implementation method name in the call request;
[0006] Distribute the target implementation method name to each business module, and determine the target calling tool corresponding to the target implementation method name through the mapping call relationship library pre-built in the business module;
[0007] Calling and executing the target implementation method corresponding to the target implementation method name through the target calling tool to respond to the calling request of the user;
[0008] The mapping call relationship library is a database containing call tools pre-built based on the implementation method name in each business module, and the call tools correspond to the implementation method name.
[0009] Based on the same inventive concept, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method as described above when executing the computer program.
[0010] Based on the same inventive concept, the present disclosure also provides a vehicle, which includes the above-mentioned electronic device.
[0011] From the above, it can be seen that the present application pre-builds a mapping call relationship library containing a calling tool corresponding to the implementation method name in each business module during the code compilation stage. The mapping call relationship library can be used for static calling by the calling module during the code running stage, that is, the calling module realizes communication with the business module by calling the mapping call relationship library in each business module, without directly calling the implementation method in the business module, thus avoiding the strong dependency of the calling module on the business module caused by directly calling the implementation method in the business module, and realizing more sophisticated modular management. The mapping call relationship library is independently configured in the business module, realizing the decoupling of the calling module and the business module. At the same time, the communication process between the two does not involve the dynamic calling of the reflection mechanism, and almost no performance consumption, that is, the business calling performance is improved, and then the operation efficiency of the system is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0013] Figure 1 A schematic diagram of an information calling method according to an embodiment of the present application;
[0014] Figure 2 A schematic diagram of the structure of an information calling device according to an embodiment of the present application;
[0015] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0016] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0017] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0018] In the related art, in an application developed in the Java language in an Android environment, it generally includes a user module (including a UI interface), a calling module and a business module. A user can input a calling request through the user interface, and the calling module calls the implementation method for the calling request in each business module based on the calling request to respond to the user's calling request. Specifically, the user inputs data through the UI interface (such as Activity or Fragment), and the data may be collected through controls such as EditText, Spinner, CheckBox, etc. After the user completes the input, an event is triggered by operations such as clicking a button on the UI interface, that is, a calling request is sent to the calling module. In Java code, this is usually achieved by setting OnClickListener. Among them, the process of the calling module calling the implementation method in the corresponding business module according to the calling request can be implemented in the following ways: (1) directly calling a specific business module, that is, directly accessing the implementation class and the implementation method under the implementation class in the business module through direct instantiation or through static methods. However, this method requires hard-coding the calling code of the implementation class and the implementation method in each business module during the code coding stage. Once a business module is added or removed or the implementation class or implementation method in the business module is added or removed, a large number of hard-coded references need to be modified, which is not conducive to the dynamic replacement and expansion of the business module, and then affects the improvement of the business calling performance; (2) using the reflection mechanism to dynamically call the corresponding business module, for example, the calling module uses Class.forName() to obtain the Class object (i.e., the implementation class) in the business module, and then obtains the Method object (i.e., the implementation method) in the Class object through getMethod() or getDeclaredMethod(), and then dynamically calls the target implementation method through the invoke() method. Although this process enhances the dynamic performance, the frequent use of reflection operations is relatively time-consuming. The calling modules in the above two methods directly call the implementation class in the business module, and then execute the implementation method in the implementation class to respond to the user's calling request. That is, the calling module and the business module will have a strong dependency and lack of flexibility, which will affect the improvement of business calling performance.
[0019] Based on the above problems, the applicant found that in order to improve the performance of business calls, the calling module needs to get rid of its strong dependence on the business module, that is, it is necessary to realize the decoupling of the calling module and the business module. The present application pre-builds the mapping relationship between the implementation class name and the implementation method name in each business module by scanning the implementation class and implementation method in each business module during the code compilation stage, and pre-builds the calling tool between each implementation method name and the implementation class, as well as the calling tool between the implementation method name and the corresponding implementation method in the implementation class. The mapping relationship and the calling tool collection are used as a mapping call relationship library. The mapping call relationship library is independently configured relative to the implementation class and implementation method in the business module, and can be updated based on the update of the implementation class or implementation method. The mapping call relationship library can be used for static calls by the calling module during the code running stage, that is, the calling module realizes communication with the business module by calling the mapping call relationship library in each business module, thereby realizing the decoupling of the calling module and the business module.
[0020] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0021] In some embodiments, reference Figure 1 , an information calling method, the method is executed by a vehicle controller or a server independent of the vehicle, the present application is described with the vehicle controller as the execution subject, the vehicle controller includes a user module, a calling module and multiple business modules, the user can input a calling request through the user module, the calling module calls the implementation method for the calling request in each business module based on the calling request to respond to the user's calling request, the method includes:
[0022] S100: In response to receiving a call request from a user, determine a target implementation method name in the call request.
[0023] Specifically, the user can input a call request through a user module (such as a UI interface), or click a certain control in the user module (such as a play button of a player) to trigger a call request, and the user module can determine the target implementation method name by extracting a specific field in the call request. Exemplarily, the call request is "play, song title", including a first field "play" and a second field "song title", and the first field is extracted as the target implementation method name, then the target implementation method name in the call request is "play".
[0024] S200: Distribute the target implementation method name to each business module, and determine the target calling tool corresponding to the target implementation method name through a mapping calling relationship library pre-built in the business module.
[0025] Among them, the mapping call relationship library is a database containing calling tools pre-built based on the implementation method name in each business module during the code compilation stage. The calling tools correspond to the implementation method names, and each business module corresponds to a pre-built mapping call relationship library.
[0026] For example, in the code compilation stage, an implementation method named play is scanned in a business module, its corresponding implementation class is MediaPlayer(), and the corresponding implementation method is play(), then the corresponding calling tool in the constructed mapping call database is return new MediaPlayer().play().
[0027] This step can be specifically implemented in the following manner: the calling module distributes the target implementation method name to the public query interface of each business module through the call path pre-constructed in the calling module; for each business module, the target implementation method name is queried in the corresponding mapping call relationship library through the public query interface; the mapping call relationship library where the target implementation method name exists is determined as the target mapping call relationship library; the target calling tool corresponding to the target implementation method name is determined in the target mapping call relationship library. Among them, the public query interface is an interface pre-encapsulated for the mapping call relationship library. The encapsulation process is the process of hiding the properties and implementation details of the implementation method and only setting the public query interface for external queries. The public query interface is an interface for querying the corresponding calling tool based on the target implementation method name. The interface cannot be directly instantiated, but it can point to the calling tool corresponding to the target implementation method name when receiving the target implementation method name, and call the implementation method corresponding to the target implementation method name through the calling tool. Exemplarily, the public query interface is public AbsAtomic output(), and when it receives the target implementation method name play transmitted by the calling module, it can point to and call return new MediaPlayer().play() in the mapping call database.
[0028] The calling path is the connection path between the calling module pre-built in the code compilation stage and the public query interface of each business module. That is, in the code compilation stage, the calling module builds a calling path connected to each business module, and each business module also builds a mapping calling relationship library containing calling tools corresponding to the implementation method name, and encapsulates a public query interface for the mapping calling relationship library. In the code running stage, the calling module can distribute the target implementation method name determined from the call request to the public query interface of each business module through the calling path, and search for the implementation method name consistent with the target implementation method name in the mapping calling relationship library corresponding to the public query interface, and then determine the calling tool corresponding to the target method name as the target calling tool.
[0029] Specifically, the calling module uses the calling path between each business module to pass the target implementation method name into the mapping call relationship library of each business module through the public query interface, and determines the target mapping call relationship library where the target implementation method name exists, thereby determining the target calling tool corresponding to the target implementation method name, so as to call the target implementation method in the business module through the calling tool. That is, the calling module in this step only needs to interact with the mapping call relationship library in the business module, and does not need to directly call the implementation method in the business module, thus avoiding the strong dependency of the calling module on the business module caused by directly calling the implementation method in the business module.
[0030] S300: calling and executing the target implementation method corresponding to the target implementation method name through the target calling tool to respond to the calling request of the user.
[0031] In this step, the target calling tool can call and execute the target implementation method corresponding to the target implementation method name in the business module, and the execution result of the target implementation method will be fed back to the user module to meet the user's calling request.
[0032] In addition, the call path and mapping call relationship library generated during the code compilation phase enable the call path and the calling tools in the mapping call relationship library to be directly called using the static calling method during the code running phase, replacing the reflection call in the related technology, reducing energy consumption, shortening the system startup time, and greatly improving the system's operating performance.
[0033] The information calling method of this embodiment, after receiving the calling request of the user, first determines the target implementation method name in the calling request, then distributes the target implementation method name to each business module, and determines the target calling tool corresponding to the target implementation method name through the mapping calling relationship library pre-built in the business module, so as to call and execute the target implementation method corresponding to the target implementation method name through the target calling tool. This embodiment pre-builds a mapping calling relationship library containing calling tools corresponding to the implementation method name in each business module in the code compilation stage, and the mapping calling relationship library can be used for static calling by the calling module in the code running stage, that is, the calling module realizes communication with the business module by calling the mapping calling relationship library in each business module, without directly calling the implementation method in the business module, avoiding the strong dependency of the calling module on the business module caused by directly calling the implementation method in the business module, and realizing more refined modular management. The mapping calling relationship library is independently configured in the business module, realizing the decoupling of the calling module and the business module, and at the same time, the communication process between the two does not involve the dynamic calling of the reflection mechanism, and almost no performance consumption, that is, the business calling performance is improved, and then the operation efficiency of the system is improved.
[0034] In some embodiments, the mapping call relationship library includes a mapping relationship library composed of multiple groups of mapping relationships and a calling tool library composed of multiple groups of calling tools, wherein the mapping relationship is a mapping relationship constructed based on the implementation class name and the implementation method name of the business module during the code compilation stage, and the calling tool is a calling tool between the implementation class and the implementation method corresponding to the implementation method name and constructed based on each mapping relationship during the code compilation stage;
[0035] The method of determining the target calling tool corresponding to the target implementation method name in the target mapping calling relationship library comprises: determining whether the target implementation method name exists in the calling tool library; in response to determining that the target implementation method name exists, determining in the calling tool library the target calling tool between the target implementation class corresponding to the target implementation method name and the target implementation method.
[0036] In this embodiment, in the code compilation stage, by scanning the implementation classes and implementation methods in each business module, the mapping relationship between the implementation class name and the implementation method name is pre-constructed in each business module, and multiple groups of mapping relationships are composed of a mapping relationship library; and the calling tools of the implementation class and the implementation method corresponding to each implementation method name are pre-constructed, and multiple groups of calling tools corresponding to the multiple mapping relationships are composed of a calling tool library, and a public query interface is encapsulated for the calling tool library; correspondingly, in the code running stage, the target implementation method name can be input into the calling tool library through the public query interface, and whether the target implementation method name exists, and if the target implementation method name exists, the target calling tool corresponding to the target implementation method name is determined in the calling tool library, and the target calling tool is a calling tool for obtaining and executing the target implementation class and target implementation method corresponding to the target implementation method name. That is, in the code running stage, the target calling tool in the calling tool library can be called by the target implementation method name, so as to call the target implementation method corresponding to the target implementation method name through the target calling tool, so as to complete the communication with the business module, and realize more refined modular management.
[0037] It should be noted that the mapping relationship library and the calling tool library in the mapping call relationship library are generated during the code compilation stage. During the code running stage, the mapping call relationship library will no longer be called. After receiving the target implementation method name distributed by the calling module, the public query interface directly searches the calling tool library for the target implementation method name and calls the corresponding target calling tool if the target implementation method name exists.
[0038] For example, in the code compilation stage, an implementation class "com.beantechs.player.MyPlayer()" is scanned in a business module, which has three implementation methods: "play()", "pause()", and "reset()", where "com.beantechs.player.MyPlayer" is the implementation class name, and "play", "pause", and "reset" are the implementation method names. Then, a mapping relationship between the implementation class name and the implementation method name will be formed between the implementation class name com.beantechs.player.MyPlayer and the three implementation method names of play, pause, and reset. Afterwards, a calling tool between the implementation class corresponding to the implementation method name and the implementation method is constructed based on each mapping relationship. For example, if the implementation method name is play, its corresponding implementation class is MediaPlayer(), and its corresponding implementation method is play(), then the corresponding calling tool is return new MediaPlayer().play(); if the implementation method name is pause, its corresponding implementation class is MediaPlayer(), and its corresponding implementation method is pause(), then the corresponding calling tool is return new MediaPlayer().pause(); if the implementation method name is reset, its corresponding implementation class is MediaPlayer(), and its corresponding implementation method is reset(), then the corresponding calling tool is return new MediaPlayer().reset(). Therefore, the following is an example of a calling tool library based on the three implementation method names of play, pause, and reset:
[0039]
[0040] Among them, public AbsAtomic output() is the public query interface encapsulated for the calling tool library.
[0041] For example, during the code running phase, if the target method name received by public AbsAtomic output() is play, then play is searched in its corresponding calling tool library. After the target method name play is found, the corresponding calling tool return new MediaPlayer().play() is directly called.
[0042] In addition, based on the target implementation method name, the calling module determines the target mapping calling relationship library where the target implementation method name exists by calling the mapping calling relationship library in each business module, and accurately calls the target implementation class and target implementation method in the business module through the target mapping calling relationship library, thereby realizing communication between the calling module and the business module. Compared with the related technology in which the calling module directly traverses and calls the implementation classes and implementation methods in each business module to determine the target implementation class and target implementation method, the calling method in this embodiment is more accurate and effective, thereby improving the operating efficiency of the system.
[0043] In some embodiments, the calling communication method further includes: caching the calling record, so that when the same calling request is received again, the target mapping calling relationship library is determined in each business module through the cached calling record, and the target calling tool in the target mapping calling relationship library is determined.
[0044] In this embodiment, each time the calling module completes a call, a call record is generated and the call record is cached in a cache area. Each call record includes a call request (including a target implementation method name), a target call path (i.e., a call path connected to a target business module), a target business module (i.e., a business module having a target mapping call relationship library), a target mapping relationship, a target call relationship, and a target call tool. When the same call request is received again, that is, the target implementation method name in the call request is the same as the target implementation method name in a call record, the call record is directly called to call the target mapping relationship and the target call relationship in the target business module through the target call path recorded therein, so as to quickly determine the target call tool that can call the target implementation method corresponding to the target implementation method name, thereby further improving the operating efficiency of the system.
[0045] Of course, if the call record cache reaches a preset number, the call records are deleted in the order of the call time. It should be noted that each call record has a time tag, which can be the generation time of the call record. If the call record is called again after it is generated, the time of the time tag will be updated to the call time. Multiple call records are sorted in the cache area of the call module in chronological order. When the call record cache reaches a preset number (for example, 10), the call records with earlier time tags are deleted to leave space in the cache area to store new call records.
[0046] In some embodiments, the mapping call relationship library includes a guaranteed data calling tool; the method also includes: in response to determining that the target implementation method name is not found in the mapping call relationship library corresponding to each business module, calling and executing the guaranteed implementation method in the business module through the guaranteed data calling tool to indicate that no retrieval result matching the target implementation method name in the call request is found.
[0047] Among them, there are generally two situations in which the target implementation method name is not queried in the mapping call relationship library of the business module. One is that the user inputs a new call request, and the calling module distributes the target implementation method name in the call request to the mapping call relationship library of each business module, and the target call implementation method name is not queried in the mapping call relationship library of each business module; the other is that the call request input by the user is the same as the call request of a cached call record, then the target mapping call relationship library is directly determined in the call record, but due to an update problem, the target implementation method name no longer exists in the target mapping call relationship library, and the result is that the target implementation method name is also not queried.
[0048] The first case above is used for subsequent explanation. A guaranteed data calling tool is set in each mapping call relationship library. Specifically, the guaranteed data calling tool is stored in the calling tool library in the mapping call relationship library, so that when the target implementation method name is not found in the mapping call relationship library corresponding to each business module, the guaranteed implementation class in the business module can be quickly called through the guaranteed data calling tool in any mapping call relationship library as soon as possible, and the guaranteed implementation method in the guaranteed implementation class is executed, so as to feedback to the user that the search result that does not match the target implementation method name in the calling request is found. That is, even if the target implementation method name is not found, the calling module does not need to directly call the guaranteed implementation class and the guaranteed implementation method in the business module (if direct calling is to be implemented, the calling code of the guaranteed implementation class of the business module and the execution code of the guaranteed implementation method in the guaranteed implementation class need to be written in the calling module during the code coding stage, that is, the calling module still has a strong dependence on the business module; or the calling code of the guaranteed implementation class of the business module and the execution code of the guaranteed implementation method in the guaranteed implementation class need to be created during the running stage to implement reflective calling, which makes the feedback time longer and the energy consumption higher). It also calls through the mapping call relationship library to facilitate the refined management of each module.
[0049] In some embodiments, the pre-construction process of the mapping call relationship library in each business module includes:
[0050] Perform a first annotation on the implementation class names of all implementation classes in the business module, and perform a second annotation on the implementation method names of all implementation methods in the business module; construct a mapping relationship between each implementation class name and an implementation method name through the first annotation and the second annotation, and construct multiple groups of mapping relationships into a mapping relationship library; construct a calling tool between the implementation class and the implementation method corresponding to the implementation method name based on each mapping relationship, and construct multiple groups of calling tools into a calling tool library, encapsulate a common query interface for the calling tool library; determine the collection of the mapping relationship library and the calling tool library as the mapping calling relationship library.
[0051] For example, the first annotation is @ClassAnnotation, the second annotation is @MethodAnnotation, and during the code compilation phase, the constructed mapping relationship library example is:
[0052] com.beantechs.mediacenter.MediaPlayer.java@ClassAnnotation
[0053] play @MethodAnnotation
[0054] pause @MethodAnnotation
[0055] com.beantechs.navi.MapController.java@ClassAnnotation
[0056] startNavi@MethodAnnotation
[0057] stopNavi@MethodAnnotation
[0058] An example of the calling tool library logic built based on the above mapping relationship library is as follows:
[0059] If the target implementation method name is play(), then get
[0060] com.beantechs.mediacenter.MediaPlayer.java corresponding implementation class MediaPlayer(), and execute the target implementation method play() corresponding to the target implementation method name play in the implementation class;
[0061] If the target implementation method name is pause(), then get
[0062] The corresponding implementation class MediaPlayer() of com.beantechs.mediacenter.MediaPlayer.java, and execute the target implementation method pause() corresponding to the target implementation method name pause in the implementation class;
[0063] If the target implementation method name is startNavi, then get
[0064] com.beantechs.navi.MapController.java corresponding implementation class MapController(), and execute the target implementation method startNavi() corresponding to the target implementation method name startNavi in the implementation class;
[0065] If the target implementation method name is stopNavi, then get
[0066] The corresponding implementation class MapController() of com.beantechs.navi.MapController.java is executed, and the target implementation method stopNavi() corresponding to the target implementation method name stopNavi in the implementation class is executed.
[0067] The calling tool library generated in the code compilation phase encapsulates a public query interface, an example of which is public AbsAtomic output(), and the public query interface is connected to the calling module through the calling path. In the code running phase, the public query interface is used to pass in the target implementation method name transmitted by the calling module, and search for the target implementation method name in the calling tool library. If the target implementation method name is found, the corresponding target calling tool is directly called to call the target implementation class from the business module as soon as possible and execute the target implementation method in the target implementation class.
[0068] In addition, the call tool library generated during the code compilation phase allows the call tool in the call tool library to be directly called using the static call method during the code running phase, replacing the reflection call in the related technology, greatly improving the performance of the system. For example, in a complex business system, frequent use of reflection calls will cause the system startup time to be delayed by 2-3 seconds. After adopting the static call of the present invention, the startup time is shortened to milliseconds, and the overall performance is significantly improved.
[0069] The construction of the above mapping call relationship library enables the calling module to search for the target method name by calling the calling tool library in the mapping call relationship library in each business module during the code running stage, and call the target calling tool in the calling tool library through the target implementation method name, so as to call the target implementation method corresponding to the target implementation method name through the target calling tool to complete the communication with the business module, thus realizing more refined modular management. That is, the calling module realizes the communication with the business module by calling the calling tool library in each business module, without directly calling the implementation method in the business module, thus avoiding the strong dependency of the calling module on the business module caused by directly calling the implementation method in the business module, thus realizing more refined modular management. The mapping call relationship library is independently configured in the business module, thus realizing the decoupling of the calling module and the business module. At the same time, the communication process between the two does not involve the dynamic calling of the reflection mechanism, and almost no performance consumption, that is, the business calling performance is improved, and then the operation efficiency of the system is improved.
[0070] The example in the above embodiment is to place all the calling tools in a container, but if there are many implementation methods in the business module, there will be many corresponding calling tools, which may cause container overflow and cause program crash during the code running stage.
[0071] In order to solve the above problem, in some embodiments, the second annotation has multiple types, and the calling tool between the implementation method name, the implementation class and the implementation method is constructed based on each mapping relationship, and multiple groups of calling tools are constructed as a calling tool library, including:
[0072] Construct a corresponding container based on the type of the second annotation; construct an auxiliary path between the type of the second annotation and the container; based on the type of the second annotation, allocate calling tools corresponding to different implementation method names to different containers through the auxiliary path, and construct a plurality of the containers filled with calling tools into a calling tool library.
[0073] For example, the second annotation is @MethodAnnotation1, @MethodAnnotation2, and the constructed mapping relationship library example is:
[0074] com.beantechs.mediacenter.MediaPlayer.java@ClassAnnotation
[0075] play @MethodAnnotation1
[0076] pause @MethodAnnotation2
[0077] com.beantechs.navi.MapController.java@ClassAnnotation
[0078] startNavi@MethodAnnotation1
[0079] stopNavi@MethodAnnotation2
[0080] Since the second annotation has two types, two containers are created accordingly. The construction logic example of the auxiliary path is as follows:
[0081] If the annotation type of the implementation method is @MethodAnnotation1, connect to container 1 corresponding to @MethodAnnotation1;
[0082] If the annotation type of the implementation method is @MethodAnnotation2, then connect container 2 corresponding to @MethodAnnotation2.
[0083] An example of the calling tool library logic in container 1 built based on the above mapping relationship library is as follows:
[0084] If the target implementation method name is play, then get
[0085] com.beantechs.mediacenter.MediaPlayer.java corresponding implementation class MediaPlayer(), and execute the target implementation method play() corresponding to the target implementation method name play in the implementation class;
[0086] If the target implementation method name is startNavi, then get
[0087] The corresponding implementation class MapController() of com.beantechs.navi.MapController.java is executed, and the target implementation method startNavi() corresponding to the target implementation method name startNavi in the implementation class is executed.
[0088] An example of the calling tool library logic in container 2 built based on the above mapping relationship library is as follows:
[0089] If the target implementation method name is pause, then get
[0090] The corresponding implementation class MediaPlayer() of com.beantechs.mediacenter.MediaPlayer.java, and execute the target implementation method pause() corresponding to the target implementation method name pause in the implementation class;
[0091] If the target implementation method name is stopNavi, then get
[0092] The corresponding implementation class MapController() of com.beantechs.navi.MapController.java is executed, and the target implementation method stopNavi() corresponding to the target implementation method name stopNavi in the implementation class is executed.
[0093] It should be noted that when there are multiple containers in a business module, it means that the business module corresponds to multiple calling tool libraries, and a public query interface needs to be encapsulated for each calling tool library to receive the target implementation method name transmitted by the calling module.
[0094] In this embodiment, the second annotations corresponding to the implementation method names are classified during the code compilation phase, and a corresponding number of containers are created based on the types of the second annotations. Thus, the generated calling tools can be filled into different containers, and the calling tools can be diverted, effectively avoiding the problem of program crashes caused by container overflows due to the large number of calling tools generated by the implementation methods in the business module. At the same time, during the code running phase, the target implementation method name can be quickly searched in the multiple calling tool libraries corresponding to the business module according to the target implementation method name, and the corresponding target calling tool can be called. Compared with the situation where all calling tools are placed in one container, the time to find the target calling tool is shortened, that is, the code execution efficiency can be accelerated.
[0095] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0096] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0097] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides an information calling device.
[0098] refer to Figure 2 , the information calling device comprises:
[0099] The user module 100 is configured to determine the target implementation method name in the call request in response to receiving a call request from the user;
[0100] The calling module 200 is configured to receive the target implementation method name sent by the user module 100 and distribute the target implementation method name to each business module 300;
[0101] The business module 300 is configured to determine a target calling tool corresponding to the target implementation method name from a pre-built mapping calling relationship library, and call and execute the target implementation method corresponding to the target implementation method name through the target calling tool to respond to the user's calling request;
[0102] The mapping call relationship library is a database containing calling tools that is pre-built based on the implementation method name in each business module 300 during the code compilation phase, and the calling tools correspond to the implementation method names.
[0103] Furthermore, the calling module 200 is also configured to: distribute the target implementation method name to the public query interface of each business module 300 through a pre-built calling path;
[0104] The business module 300 is further configured to: for each business module, query the target implementation method name in the mapping call relationship library corresponding to the business module through the public query interface, determine the mapping call relationship library containing the target implementation method name as the target mapping call relationship library; and determine the target call tool corresponding to the target implementation method name in the target mapping call relationship library. The public query interface is an interface pre-packaged for the mapping call relationship library.
[0105] Further, the mapping call relationship library includes a mapping relationship library composed of multiple groups of mapping relationships and a calling tool library composed of multiple groups of calling tools, wherein the mapping relationship is a mapping relationship constructed based on the implementation class name and the implementation method name of the business module 300 during the code compilation stage, and the calling tool is a calling tool between the implementation class and the implementation method corresponding to the implementation method name constructed based on each mapping relationship during the code compilation stage;
[0106] The service module 300 is further configured as follows:
[0107] Determining whether the target implementation method name exists in the calling tool library;
[0108] In response to determining that the target implementation method name exists, a target calling tool between the target implementation class corresponding to the target implementation method name and the target implementation method is determined in the calling tool library.
[0109] Furthermore, the calling module 200 is also configured to: cache the calling record, so that when the same calling request is received again, the target mapping calling relationship library is determined in each business module 300 through the cached calling record, and the target calling tool in the target mapping calling relationship library is determined.
[0110] Furthermore, the calling module 200 is further configured to: in response to determining that the calling record cache reaches a preset number, delete the calling records in the order of calling time.
[0111] Furthermore, the mapping call relationship library includes a guaranteed data calling tool; the business module 300 is also configured to: in response to determining that the target implementation method name is not found in the corresponding mapping call relationship library, call and execute the guaranteed implementation method in the business module 300 through the guaranteed data calling tool to indicate that no retrieval result matching the target implementation method name in the call request is found.
[0112] Furthermore, the service module 300 is also configured as follows:
[0113] Perform a first annotation on the implementation class names of all implementation classes in the business module 300, and perform a second annotation on the implementation method names of all implementation methods in the business module 300;
[0114] A mapping relationship between each implementation class name and an implementation method name is constructed by using the first annotation and the second annotation, and multiple sets of mapping relationships are constructed into a mapping relationship library;
[0115] Based on each mapping relationship, a calling tool between the implementation class and the implementation method corresponding to the implementation method name is constructed, and multiple groups of calling tools are constructed into a calling tool library, and a public query interface is encapsulated for the calling tool library;
[0116] The set of the mapping relationship library and the calling tool library is determined as the mapping calling relationship library.
[0117] Furthermore, the second annotation has multiple types, and the business module 300 is further configured as follows:
[0118] constructing a corresponding container based on the type of the second annotation;
[0119] constructing an auxiliary path between the type of the second annotation and the container;
[0120] Based on the type of the second annotation, the calling tools corresponding to different implementation method names are allocated to different containers through the auxiliary path, and a plurality of the containers filled with the calling tools are constructed into a calling tool library.
[0121] The system of the above embodiment is used to implement the corresponding information calling method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0122] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the information calling method described in any of the above embodiments is implemented.
[0123] Figure 3 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0124] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0125] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0126] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0127] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WFI, Bluetooth, etc.).
[0128] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0129] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0130] The electronic device of the above embodiment is used to implement the corresponding information calling method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0131] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the information calling method described in any of the above embodiments.
[0132] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0133] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the information calling method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0134] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0135] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0136] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0137] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0138] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0139] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0140] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0141] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
Claims
1. An information calling method, characterized in that: include: In response to receiving a call request from a user, determining a target implementation method name in the call request; Distribute the target implementation method name to each business module, and determine the target calling tool corresponding to the target implementation method name through the mapping call relationship library pre-built in the business module; Calling and executing the target implementation method corresponding to the target implementation method name through the target calling tool to respond to the calling request of the user; The mapping call relationship library is a database containing call tools pre-built based on the implementation method name in each business module, and the call tools correspond to the implementation method name.
2. The method according to claim 1, characterized in that The method of distributing the target implementation method name to each business module and determining the target calling tool corresponding to the target implementation method through a pre-built mapping calling relationship library includes: Distribute the target implementation method name to the public query interface of each business module through a pre-built call path; For each business module, query the target implementation method name in the corresponding mapping call relationship library through the public query interface, and determine the mapping call relationship library that contains the target implementation method name as the target mapping call relationship library; Determining a target calling tool corresponding to the target implementation method name in the target mapping calling relationship library; The public query interface is an interface pre-packaged for the mapping call relationship library.
3. The method according to claim 2, characterized in that The mapping call relationship library includes a mapping relationship library composed of multiple groups of mapping relationships and a calling tool library composed of multiple groups of calling tools, wherein the mapping relationship is a mapping relationship constructed based on the implementation class name and the implementation method name of the business module during the code compilation stage, and the calling tool is a calling tool between the implementation class and the implementation method corresponding to the implementation method name and constructed based on each mapping relationship during the code compilation stage; The step of determining the target calling tool corresponding to the target implementation method name in the target mapping calling relationship library includes: Determining whether the target implementation method name exists in the calling tool library; In response to determining that the target implementation method name exists, a target calling tool between the target implementation class corresponding to the target implementation method name and the target implementation method is determined in the calling tool library.
4. The method according to claim 1, characterized in that: Also includes: The call record is cached, so that when the same call request is received again, the target mapping call relationship library is determined in each business module through the cached call record, and the target call tool in the target mapping call relationship library is determined.
5. The method according to claim 4, characterized in that In response to determining that the call record cache reaches a preset number, the call records are deleted in order of call time.
6. The method according to claim 2, characterized in that The mapping call relationship library includes a guaranteed data call tool; the method further includes: In response to determining that the target implementation method name is not found in the mapping call relationship library corresponding to each business module, the guaranteed implementation method in the business module is called and executed through the guaranteed data calling tool to indicate that no retrieval result matching the target implementation method name in the calling request is found.
7. The method according to claim 3, characterized in that The pre-construction process of the mapping call relationship library in each business module includes: Perform a first annotation on the implementation class names of all implementation classes in the business module, and perform a second annotation on the implementation method names of all implementation methods in the business module; A mapping relationship between each implementation class name and an implementation method name is constructed by using the first annotation and the second annotation, and multiple sets of mapping relationships are constructed into a mapping relationship library; Based on each mapping relationship, a calling tool between the implementation class and the implementation method corresponding to the implementation method name is constructed, and multiple groups of calling tools are constructed into a calling tool library, and a public query interface is encapsulated for the calling tool library; The set of the mapping relationship library and the calling tool library is determined as the mapping calling relationship library.
8. The method according to claim 7, characterized in that The second annotation has multiple types, and the method of constructing a call tool between an implementation method name, an implementation class and an implementation method based on each mapping relationship, and constructing multiple groups of call tools into a call tool library includes: constructing a corresponding container based on the type of the second annotation; constructing an auxiliary path between the type of the second annotation and the container; Based on the type of the second annotation, the calling tools corresponding to different implementation method names are allocated to different containers through the auxiliary path, and a plurality of the containers filled with the calling tools are constructed into a calling tool library.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 8 is implemented.
10. A vehicle, characterized in that: The vehicle comprises the electronic device as claimed in claim 9.