CN111240856B - Message processing method and device and storage medium - Google Patents

Message processing method and device and storage medium Download PDF

Info

Publication number
CN111240856B
CN111240856B CN202010005769.8A CN202010005769A CN111240856B CN 111240856 B CN111240856 B CN 111240856B CN 202010005769 A CN202010005769 A CN 202010005769A CN 111240856 B CN111240856 B CN 111240856B
Authority
CN
China
Prior art keywords
message processing
message
class
registration information
processing mechanism
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010005769.8A
Other languages
Chinese (zh)
Other versions
CN111240856A (en
Inventor
谢鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN202010005769.8A priority Critical patent/CN111240856B/en
Publication of CN111240856A publication Critical patent/CN111240856A/en
Application granted granted Critical
Publication of CN111240856B publication Critical patent/CN111240856B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The disclosure relates to a message processing method and device and a storage medium. The method comprises the following steps: processing a message processing mechanism when compiling a source code to obtain a target code containing registration information, wherein the registration information is used for calling the message processing mechanism; and when the calling message for calling the message processing mechanism is detected in the execution process of the target code, calling and executing the message processing mechanism according to the registration information. By the method, flexibility of message processing mechanism calling is improved.

Description

Message processing method and device and storage medium
Technical Field
The disclosure relates to the field of electronic technology, and in particular, to a message processing method and device, and a storage medium.
Background
A scenario is often encountered in software development, where module a needs to invoke a method of module B, and the most intuitive way is to let module a directly depend on module B. However, as software engineering becomes larger and more complex, the responsible personnel of different modules may come from different departments or even different companies, so that it is inconvenient for module a to directly and explicitly rely on module B, and a message communication mechanism is needed to allow module B to register with the message processing method, through which when a sends out a message, B can receive and process the message.
Disclosure of Invention
The disclosure provides a message processing method and device and a storage medium.
According to a first aspect of embodiments of the present disclosure, there is provided a message processing method, the method including:
Processing a message processing mechanism when compiling a source code to obtain a target code containing registration information, wherein the registration information is used for calling the message processing mechanism;
And when the calling message for calling the message processing mechanism is detected in the execution process of the target code, calling and executing the message processing mechanism according to the registration information.
Optionally, the processing the message processing mechanism in the source code to obtain the target code containing the registration information includes:
and registering the message processing mechanism when the source code is compiled to obtain the target code containing the registration information.
Optionally, the registering the message processing mechanism at the compiling time of the source code to obtain the target code containing the registration information includes:
the registration information of the message processing mechanism is added in compiled object code at the time of compiling the source code by a compiling plug-in.
Optionally, the adding, by the compiling plug-in, the registration information of the message processing mechanism in the compiled object code when the source code is compiled includes:
and loading a file containing the registration information through the compiling plug-in when the source code is compiled, and adding the registration information into a registration interface in the source code.
Optionally, the registration information includes: the message identification and the meta information corresponding to the message identification, wherein the meta information at least comprises: a class name of a method class included in the message processing mechanism;
When detecting that a call message for calling the message processing mechanism is generated in the execution process of the target code, calling the message processing mechanism according to the registration information, wherein the method comprises the following steps:
And in the execution process of the target code, calling a class method pointed by the class name of the method class corresponding to the message identifier when the calling message carrying the message identifier is detected.
Optionally, the executing the message processing mechanism includes:
Loading classes of the message processing method;
Instantiating the class to obtain an instance of the class;
obtaining the class method declared by the class;
The class method is performed on the instance.
According to a second aspect of embodiments of the present disclosure, there is provided a message processing apparatus, the apparatus comprising:
the obtaining module is configured to process the message processing mechanism when the source code is compiled to obtain target code containing registration information, wherein the registration information is used for calling the message processing mechanism;
and the execution module is configured to call and execute the message processing mechanism according to the registration information when the call message for calling the message processing mechanism is detected in the execution process of the target code.
Optionally, the obtaining module is specifically configured to register the message processing mechanism when the source code is compiled, so as to obtain the target code containing the registration information.
Optionally, the obtaining module is specifically configured to add the registration information of the message processing mechanism to the compiled object code when the source code is compiled through a compiling plug-in.
Optionally, the obtaining module is specifically configured to load a file containing the registration information through a compiling plug-in when the source code is compiled, and add the registration information to a registration interface in the source code.
Optionally, the registration information includes: the message identification and the meta information corresponding to the message identification, wherein the meta information at least comprises: a class name of a method class included in the message processing mechanism;
And the execution module is specifically configured to call a class method pointed by a class name of the method class when the call message carrying the message identifier is detected to be generated in the execution process of the target code.
Optionally, the execution module is specifically configured to load a method class of the message processing mechanism; instantiating the method class to obtain an instance of the method class; obtaining class methods declared by the method class; the class method is performed on the instance.
According to a third aspect of embodiments of the present disclosure, there is provided a message processing apparatus comprising:
A processor;
A memory for storing processor-executable instructions;
wherein the processor is configured to perform the message processing method as described in the first aspect above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium comprising:
The instructions in the storage medium, when executed by a processor of a computer, enable the computer to perform the message processing method as described in the first aspect above.
The technical scheme provided by the embodiment of the disclosure can comprise the following beneficial effects:
In the embodiment of the disclosure, the message processing mechanism is processed when the code is compiled, so that the target code containing the registration information for calling the message processing mechanism is obtained, and the call to the message processing mechanism can be realized in the operation stage of the target code. The embodiments of the present disclosure make it possible to invoke a message processing module (e.g., a tool module) that does not include an initializing interface by registering at compile time without requiring that the initializing interface provided by the message processing module be displayed in advance in source code (by a developer writing code to invoke the initializing interface) and implementing registration at code run stage (display registration); in the second aspect, for items with complex dependency, the registration message processing mechanism is not required to be displayed in each calling module needing to call the message processing module, but only registration information is obtained during compiling, and the call of the message processing mechanism is realized through the registration information in the operation stage, so that the flexibility of the call of the message processing mechanism is improved, and loose coupling can be realized among the modules.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a flow chart of a message processing method shown in an embodiment of the present disclosure.
Fig. 2 is a flowchart illustrating an example of a message processing method according to an embodiment of the present disclosure.
Fig. 3 is a diagram of a message processing apparatus according to an exemplary embodiment.
Fig. 4 is a block diagram of a server shown in an embodiment of the disclosure.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Fig. 1 is a flowchart of a message processing method according to an embodiment of the present disclosure, and as shown in fig. 1, the message processing method includes the following steps:
S11, processing the message processing mechanism during source code compiling to obtain target codes containing registration information, wherein the registration information is used for calling the message processing mechanism.
S12, when the calling message for calling the message processing mechanism is detected in the execution process of the target code, calling and executing the message processing mechanism according to the registration information.
In the embodiment of the disclosure, a message processing method is taken as an example to be applied to a server supporting an android system.
In the application development process, a broadcast mechanism (BroadcastReceiver component) supported by the android system can be utilized to receive messages sent by the android system or other applications, or a broadcast mechanism can be utilized to transfer some messages between applications. Using a broadcast mechanism requires at least three steps: 1. registering a broadcast receiver; 2. creating a broadcast receiver; 3. and transmitting the broadcast. Among them, there are two ways to register for broadcast: registration in the manifest file and run-time registration in the code. However, both of these approaches require the display registration of the message handling module to be invoked, i.e. by invoking an initialisation interface provided by the message handling module at the code run-time stage, to effect invocation of the message handling method in the message handling module. It should be noted that, the message processing method in the message processing module is a functional implementation presented in a code form, that is, the message processing mechanism of the present disclosure.
In addition, based on the android system, the class library EventBus supported by the android platform can be used for realizing the call of the message processing method in the message processing module. In the EventBus-based message bus mechanism, three steps are included: 1. initializing registration at a caller; 2. declaring a message processing method; 3. and sending a call message. However, this method is also a method of displaying registration.
When registration is displayed on the basis of the broadcasting mechanism supported by the android system or the class library EventBus supported by the android platform, an initialization interface is required to be provided by a message module supporting a message processing method, however, for a message processing module (for example, a tool module) which does not comprise the initialization interface, calling cannot be realized; in addition, code needs to be written in advance at the caller based on the provided initialization interface to achieve registration, which also increases the degree of coupling between modules.
Based on the above, the method and the device process the message processing mechanism during source code compiling to obtain the target code containing the registration information, so that when the message processing method in the message processing module is subsequently called, the call can be realized based on the registration information. According to the method and the device, the registration information for calling the message processing method in the message processing module is obtained in the source code compiling period, on one hand, registration in the source code in the operation stage based on the provided initialization interface is not needed in advance, so that the message processing method is more flexibly called, and the coupling degree between modules is also reduced; on the other hand, the message processing module without the message processing method is not required to be provided with an initialization interface, and the method of the embodiment of the disclosure can realize calling for the message processing module without the initialization interface, thereby improving the universality of calling the message processing method.
It should be noted that, in an embodiment of the present disclosure, processing a message processing mechanism at the time of source code compilation includes: declaring a class object to which the message handling mechanism belongs, obtaining an implementation of a class method comprised by the message handling mechanism, and obtaining registration information. The registration information is used to indicate a calling class method to enable calling and execution of the message handling mechanism.
In an embodiment of the present disclosure, step S11 includes:
The message processing mechanism is registered at the time of compiling the source code to obtain the target code containing the registration information.
In this embodiment, the registration message handling mechanism is equivalent to an initialization (init) interface that loads the message handling module. Typically, the initialization is done by preparing some information needed for code execution in advance, e.g., by assigning variables to default values, by setting controls to default states, or by loading content in files needed for code execution, etc. While for execution of code, it may not be necessary to initialize multiple times. For example, the message processing mechanism includes a plurality of class methods, and before executing each class method, the message processing mechanism may not be registered first, but some information required for executing the code based on one registration setting may be adopted to implement the execution of each class method.
In this embodiment, the object code containing the registration information is obtained, which is equivalent to obtaining a correspondence between the class object to which the message processing mechanism belongs and the class method contained in the message processing mechanism, so that the object code realizes the call to the class method based on the correspondence obtained in advance in the execution process.
In one embodiment, the registration information includes: the message identifier and meta information corresponding to the message identifier at least comprise: the message processing mechanism includes class names of method classes, and step S12 includes:
and in the execution process of the target code, calling a class method pointed by the class name of the method class corresponding to the message identifier when the calling message carrying the message identifier is detected.
In this embodiment, the registration information includes a message identifier and meta information corresponding to the message identifier, that is, the registration information includes a correspondence between the message identifier and the meta information, and the meta information includes at least a class name of a method class included in the message processing mechanism. It should be noted that, the message identifier is used for uniquely identifying a message processing module, similar to the name of a dynamic link library to be called; whereas meta information refers to information contained in the information, in this embodiment, the class name of the method class of the message handling mechanism included in the meta information refers to the name of the message handling method in the message handling module, similar to the function name of the function included in the dynamic link library. However, since message processing methods with the same name may be included in different message processing modules, in implementations of the present disclosure, a class method included in a message processing mechanism is uniquely indicated by a message identification along with a class name of the method class.
During execution of the object code, the message manager detects whether a call message carrying a message identifier is generated, for example, the message manager is EVENTMANAGER message management classes supported in the android Unity component. If the message manager detects that the calling message carrying the message identifier exists, calling a class method pointed by the class name of the method class corresponding to the message identifier according to the corresponding relation.
It should be noted that, in the embodiment of the present disclosure, the meta information may also include a message identifier and the like in addition to a class name of a method class of the message processing mechanism. For example, the message identifier is "a", the class name of the message processing method included in the message processing module is "AEVENTTARGET", and the meta information may include "AEVENTTARGET" and may also include "a".
In one embodiment, adding registration information of a message handling mechanism in compiled object code at source code compilation time by a compilation plug-in includes:
when the source code is compiled through the compiling plug-in, registration information of a message processing mechanism is added in the compiled target code.
In the embodiment of the disclosure, when the message processing mechanism is registered at the time of compiling the source code to obtain the target code containing the registration information, the code can be added through a compiling plug-in, namely, the registration information of the message processing mechanism is added into the compiled target code through the compiling plug-in at the time of compiling the source code. A compilation plug-in may be understood as an automated code generation tool, for example, a gradle compilation plug-in.
The code is automatically generated at the source code compilation stage by an automated code generation tool without requiring a developer to manually add code to register the message processing method prior to code compilation based on an initialization interface provided by the message processing module.
In one embodiment, adding registration information of a message handling mechanism in compiled object code at source code compilation time by a compilation plug-in includes:
the method comprises the steps of loading a file containing registration information through a compiling plug-in when the source code is compiled, and adding the registration information into a registration interface in the source code.
In this implementation, the predetermined registration interface in the source code refers to a predefined message identification class interface and an implementation interface of a predefined class method, and the content implementation in the interfaces is empty. And the compiling plug-in loaded file comprises specific implementation of the message identification class and specific implementation of the class method. At the source code compilation time, the compilation plug-in will add the specific implementation included in the file to the corresponding message identification class interface and class method interface. Wherein the message identification class interface is an interface for declaring class objects to which the message handling mechanism belongs. Illustratively, the predefined message identification class interface in the source code is:
public interface Event{
String getName();
}
The implementation interface of the predefined class method in the source code is:
public interface EventTarget{
void invoke(Event event);
}
from the above, the specific implementation in the message identification class interface "getName" and the implementation interface "invoke" of the class method are both empty.
The compiling plug-in can load a file in a JavaScript object numbered notation (JavaScript Object Notation, JSON) format when compiling a source code, and class implementation of a message processing module A is defined in the JSON format file, and is specifically as follows:
in the JSON format file, the implementation of the class method declared in the message processing module a is specifically as follows:
Wherein the annotation of @ Override represents a method of overwriting a parent class, and the compilation plug-in adds a specific implementation of "getName" to a predefined message identification class interface in the source code, adds a specific implementation of "invoke" to an implementation interface of a predefined class method in the source code, and stores a mapping structure between the message identification and meta information of the message identification, for example, to map < key, value > (map < key, value >) to characterize a correspondence between the message identification and the meta information of the message identification. The key in the map is the message identifier "a", and the value is the meta information "AEVENTTARGET".
In this embodiment, the registration information includes a mapping relationship between the message identifier and a class name of a method class included in the message processing mechanism by adding code automatically by the compiling tool. Therefore, when the target code runs and the calling message for calling the message processing mechanism is detected, the class method included in the message processing mechanism can be called and executed according to the registration information. It can be appreciated that in this way, the developer is not required to display the registration message processing method, and flexibility of calling the message processing method is improved.
In embodiments of the present disclosure, after object code including registration information of a message processing mechanism is obtained, at a run phase of the object code, a reflection mechanism may be employed to instantiate a class of a message processing method and execute a class method of the class. The reflection mechanism can enable all the attributes and methods of any entity class to be known in the running state of the code; any method and attribute can be invoked on any object.
In one embodiment, a message processing mechanism is performed comprising:
loading a method class of a message processing mechanism;
instantiating the method class to obtain an instance of the method class;
obtaining class methods declared by the method class;
class methods are performed on the instances.
In this embodiment, the method class may be loaded by a class name of a method class included in the message processing mechanism, for example, in java, the method class may be loaded with a class name of "AEVENTTARGE" based on the class. Instantiating a method class to get an instance of a method class can be understood as creating a class object that belongs to the method class, e.g., creating a class object "coder" through class. Obtaining a class method stated by a method class, such as obtaining an "invoke" method in "AEVENTTARGE" by a class. Getmethod () method, and assigning "method"; and executing a class method on an instance refers to executing a class method, such as executing a "method. By the method, the reflection calling of the class method in the message processing mechanism is completed.
In the embodiment of the disclosure, the message processing mechanism is processed when the code is compiled, so that the target code containing the registration information for calling the message processing mechanism is obtained, and the call to the message processing mechanism can be realized in the operation stage of the target code. The first aspect makes it possible to call a message processing module (e.g., a tool module) that does not include an initialization interface, with respect to the manner in which registration (call an initialization interface) needs to be displayed at the code run stage; in the second aspect, for the project with complex dependency, the registration message processing mechanism does not need to be displayed in each calling module needing to call the message processing module, but only registration information is obtained in compiling, so that the flexibility of calling the message processing mechanism is improved.
Fig. 2 is an exemplary diagram of a message processing method in an android system according to an embodiment of the disclosure, where, as shown in fig. 2, the message processing method includes the following steps:
S21, registering a message processing method during code compiling through gradle compiling plug-ins.
In this embodiment, the message processing method is a message processing mechanism. The plug-in registration message processing method is compiled through gradle in the code compiling stage, and the target code containing the registration information is obtained. The registration information includes a correspondence between the message identifier and meta information of the message processing method.
S22, when the code runs, a calling message carrying a message identifier is sent through a message manager.
In this embodiment, the code that is run is the object code in which the registration information of the message processing method has been included. The registration information includes a correspondence between the message identifier and a class name of the message processing method. The class name of the message processing method is the class name of the method class included in the message processing mechanism.
S23, the codes acquire the corresponding message processing method through the message identification, and the message processing method is executed.
In this embodiment, the message manager will obtain the corresponding message handling method by means of the message identifier, e.g. message identifier "a", obtain the corresponding "AEVENTTARGE" class, instantiate "AEVENTTARGE" by means of reflection when executing the message handling method, and execute the "invoke" method therein.
Fig. 3 is a diagram of a message processing apparatus according to an exemplary embodiment. Referring to fig. 3, the message processing apparatus includes:
An obtaining module 101, configured to process a message processing mechanism when compiling a source code, to obtain a target code containing registration information, where the registration information is used to invoke the message processing mechanism;
And the execution module 102 is configured to call and execute the message processing mechanism according to the registration information when the call message for calling the message processing mechanism is detected in the execution process of the target code.
Optionally, the obtaining module 101 is specifically configured to register the message processing mechanism when the source code is compiled, so as to obtain the target code containing the registration information.
Optionally, the obtaining module 101 is specifically configured to add, by means of a compiling plug-in, the registration information of the message processing mechanism to the compiled object code when the source code is compiled.
Optionally, the obtaining module 101 is specifically configured to load a file containing the registration information when the source code is compiled through a compiling plug-in, and add the registration information to a registration interface in the source code.
Optionally, the registration information includes: the message identification and the meta information corresponding to the message identification, wherein the meta information at least comprises: a class name of a method class included in the message processing mechanism;
The execution module 102 is specifically configured to invoke a class method pointed by a class name of the method class when the invocation message carrying the message identifier is detected to be generated in the execution process of the object code.
Optionally, the execution module 102 is specifically configured to load a method class of the message processing mechanism; instantiating the method class to obtain an instance of the method class; obtaining class methods declared by the method class; the class method is performed on the instance.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 4 is a block diagram of a server apparatus 900, according to an example embodiment. Referring to FIG. 4, apparatus 900 includes a processing component 922 that further includes one or more processors, and memory resources represented by memory 932, for storing instructions, such as applications, executable by processing component 922. The application programs stored in memory 932 may include one or more modules that each correspond to a set of instructions. Further, processing component 922 is configured to execute instructions to perform the message processing methods described above.
The apparatus 900 may also include a power component 926 configured to perform power management of the apparatus 900, a wired or wireless network interface 950 configured to connect the apparatus 900 to a network, and an input output (I/O) interface 958. The device 900 may operate based on an operating system stored in the memory 932, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as memory 932, that includes instructions executable by processing component 922 of apparatus 900 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of a computer, causes the computer to perform a message processing method, the method comprising:
Processing a message processing mechanism when compiling a source code to obtain a target code containing registration information, wherein the registration information is used for calling the message processing mechanism;
And when the calling message for calling the message processing mechanism is detected in the execution process of the target code, calling and executing the message processing mechanism according to the registration information.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any adaptations, uses, or adaptations of the disclosure following the general principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (14)

1. A method of message processing, the method comprising:
Processing a message processing mechanism during source code compiling to obtain target code containing registration information, wherein the registration information is used for calling the message processing mechanism, and the registration information comprises: the message identifier is used for uniquely identifying a message processing mechanism, and the meta information at least comprises: a class name of a method class included in the message processing mechanism;
And when the calling message for calling the message processing mechanism is detected in the execution process of the target code, calling and executing the message processing mechanism according to the registration information.
2. The method of claim 1, wherein processing the message processing mechanism in the source code results in object code containing registration information, comprising:
and registering the message processing mechanism when the source code is compiled to obtain the target code containing the registration information.
3. The method of claim 2, wherein registering the message handling mechanism at the source code compilation time results in object code containing the registration information, comprising:
the registration information of the message processing mechanism is added in compiled object code at the time of compiling the source code by a compiling plug-in.
4. A method according to claim 3, wherein said adding said registration information of said message handling mechanism in compiled object code at the time of compiling said source code by means of a compiling plug-in comprises:
and loading a file containing the registration information through the compiling plug-in when the source code is compiled, and adding the registration information into a registration interface in the source code.
5. The method according to any one of claims 1 to 4, wherein when a call message for calling the message processing mechanism is detected during execution of the object code, calling the message processing mechanism according to the registration information comprises:
And in the execution process of the target code, calling a class method pointed by the class name of the method class corresponding to the message identifier when the calling message carrying the message identifier is detected.
6. The method of claim 5, wherein said executing said message handling mechanism comprises:
Loading a method class of the message processing mechanism;
instantiating the method class to obtain an instance of the method class;
obtaining class methods declared by the method class;
The class method is performed on the instance.
7. A message processing apparatus, the apparatus comprising:
the obtaining module is configured to process the message processing mechanism when the source code is compiled to obtain target code containing registration information, wherein the registration information is used for calling the message processing mechanism, and the registration information comprises: the message identifier is used for uniquely identifying a message processing mechanism, and the meta information at least comprises: a class name of a method class included in the message processing mechanism;
and the execution module is configured to call and execute the message processing mechanism according to the registration information when the call message for calling the message processing mechanism is detected in the execution process of the target code.
8. The apparatus of claim 7, wherein the device comprises a plurality of sensors,
The obtaining module is specifically configured to register the message processing mechanism when the source code is compiled, and obtain the target code containing the registration information.
9. The apparatus of claim 8, wherein the device comprises a plurality of sensors,
The obtaining module is specifically configured to add the registration information of the message processing mechanism to the compiled object code when the source code is compiled through a compiling plug-in.
10. The apparatus of claim 9, wherein the device comprises a plurality of sensors,
The obtaining module is specifically configured to load a file containing the registration information through a compiling plug-in when the source code is compiled, and add the registration information into a registration interface in the source code.
11. The device according to any one of claims 7 to 10, wherein,
And the execution module is specifically configured to call a class method pointed by a class name of the method class when the call message carrying the message identifier is detected to be generated in the execution process of the target code.
12. The apparatus of claim 11, wherein the device comprises a plurality of sensors,
The execution module is specifically configured to load a method class of the message processing mechanism; instantiating the method class to obtain an instance of the method class; obtaining class methods declared by the method class; the class method is performed on the instance.
13. A message processing apparatus, comprising:
A processor;
A memory for storing processor-executable instructions;
Wherein the processor is configured to perform the message processing method of any of claims 1 to 6.
14. A non-transitory computer readable storage medium, wherein instructions in the storage medium, when executed by a processor of a computer, enable the computer to perform the message processing method of any one of claims 1 to 6.
CN202010005769.8A 2020-01-03 2020-01-03 Message processing method and device and storage medium Active CN111240856B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010005769.8A CN111240856B (en) 2020-01-03 2020-01-03 Message processing method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010005769.8A CN111240856B (en) 2020-01-03 2020-01-03 Message processing method and device and storage medium

Publications (2)

Publication Number Publication Date
CN111240856A CN111240856A (en) 2020-06-05
CN111240856B true CN111240856B (en) 2024-04-23

Family

ID=70872128

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010005769.8A Active CN111240856B (en) 2020-01-03 2020-01-03 Message processing method and device and storage medium

Country Status (1)

Country Link
CN (1) CN111240856B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5579518A (en) * 1993-03-19 1996-11-26 Fuji Xerox Co., Ltd. Message compiler for object-oriented language that statically produces object code by provisionally identifying a set of candidate types
US7127707B1 (en) * 2002-10-10 2006-10-24 Microsoft Corporation Intellisense in project upgrade
CN101126981A (en) * 2007-09-28 2008-02-20 华为技术有限公司 Script order registration method, method and device for calling source program code
FR2947648A1 (en) * 2009-07-02 2011-01-07 Trusted Logic Compilation device i.e. computer, for compiling source code into compiled code to program smart card, has unit to replace second call by second reference in case of second call detection, where second reference is direct/indirect reference
CN107391219A (en) * 2017-07-07 2017-11-24 腾讯科技(深圳)有限公司 Function Compilation Method and device
CN109901885A (en) * 2019-01-22 2019-06-18 中电和瑞科技有限公司 A kind of data interactive method, plugin manager and computer readable storage medium
CN109918101A (en) * 2019-01-28 2019-06-21 努比亚技术有限公司 Terminal and its application component management method, computer readable storage medium
CN110309002A (en) * 2019-05-29 2019-10-08 北京达佳互联信息技术有限公司 Message treatment method, device, electronic equipment and storage medium
CN110580226A (en) * 2019-09-23 2019-12-17 上海创景信息科技有限公司 object code coverage rate testing method, system and medium for operating system level program

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5579518A (en) * 1993-03-19 1996-11-26 Fuji Xerox Co., Ltd. Message compiler for object-oriented language that statically produces object code by provisionally identifying a set of candidate types
US7127707B1 (en) * 2002-10-10 2006-10-24 Microsoft Corporation Intellisense in project upgrade
CN101126981A (en) * 2007-09-28 2008-02-20 华为技术有限公司 Script order registration method, method and device for calling source program code
FR2947648A1 (en) * 2009-07-02 2011-01-07 Trusted Logic Compilation device i.e. computer, for compiling source code into compiled code to program smart card, has unit to replace second call by second reference in case of second call detection, where second reference is direct/indirect reference
CN107391219A (en) * 2017-07-07 2017-11-24 腾讯科技(深圳)有限公司 Function Compilation Method and device
CN109901885A (en) * 2019-01-22 2019-06-18 中电和瑞科技有限公司 A kind of data interactive method, plugin manager and computer readable storage medium
CN109918101A (en) * 2019-01-28 2019-06-21 努比亚技术有限公司 Terminal and its application component management method, computer readable storage medium
CN110309002A (en) * 2019-05-29 2019-10-08 北京达佳互联信息技术有限公司 Message treatment method, device, electronic equipment and storage medium
CN110580226A (en) * 2019-09-23 2019-12-17 上海创景信息科技有限公司 object code coverage rate testing method, system and medium for operating system level program

Also Published As

Publication number Publication date
CN111240856A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
US10740115B2 (en) Structural identification of dynamically-generated, pattern-based classes
US9811360B2 (en) Dynamic determination of application server runtime classloading
CN110908738B (en) Method and device for running small program
CN110187910B (en) Thermal updating method, device, equipment and computer readable storage medium
MX2007014337A (en) Coordinating reference counting between entities executing within separate address spaces.
CN110928548B (en) Data processing method and device
CN111061489B (en) Multi-platform compiling detection method, device, equipment and medium
CN111966357B (en) Operating system application compiling method and device and electronic equipment
EP1739550A2 (en) Method and apparatus for allowing non-generified methods to override generified methods
US6769126B1 (en) Apparatus and method for demand load analysis
EP0627684A2 (en) Specifying contexts in callback style programming
US7900213B2 (en) Generic markup specified object descriptor for a modularized computing application
US9141353B2 (en) Dynamically building locale objects at run-time
CN111240856B (en) Message processing method and device and storage medium
CN109189591B (en) Method and device for calling application component
CN113971019A (en) Data type creating method, device, server and medium
US7308679B2 (en) Method and computer program product for providing a meta-data programming language level interface
CN112052051A (en) Plug-in processing method, device, equipment and storage medium
CN111309319A (en) Inheritable office data dynamic page configuration method and device
CN111930478A (en) Service calling method and device based on dynamic bytecode
CN117056317B (en) Data processing method, device, equipment and computer readable storage medium
CN114416219B (en) System function calling method, device, electronic equipment and readable medium
CN111782282B (en) Start program loading method and device, electronic equipment and storage medium
CN116954889A (en) Resource calling method and device, electronic equipment and storage medium
CN116541029A (en) Method and device for generating application program installation package, electronic equipment and storage medium

Legal Events

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