Method, device, equipment and storage medium for implementing functions in application program

By generating target events in the application and determining the implementation class that supports the protocol, the problem of time consuming for different applications when implementing the same functions is solved, and the effect of quickly realizing the same functions is achieved.

CN119759343APending Publication Date: 2025-04-0458 CHANG LIFE (BEIJING) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411875085.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

When different applications implement the same functions, there is a relatively time-consuming problem. How to enable different applications to quickly implement the same functions has become a technical problem that needs to be solved urgently.

Method used

By generating target events corresponding to the interaction, according to the protocol contained in the target event, the target identification information of the general implementation class and the specific implementation class that support the protocol are determined from the registry in the target application. Then, a general implementation class and a specific implementation class with target identification information are executed to output the interaction results of the interaction.

Benefits of technology

This method allows different applications to directly reuse common implementation classes, and only needs to develop specific implementation classes that describe the different logic that implements the target functions themselves, thereby reducing the workload of developers, improving the efficiency of different applications in achieving target functions, and allowing different applications to quickly implement the same functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759343A_ABST
    Figure CN119759343A_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method, apparatus, device and storage medium for realizing a function in an application, the method comprising: in response to an interactive operation triggered on a target function in a target application, generating a target event corresponding to the interactive operation. Then, according to the protocol contained in the target event, the target identification information of the general implementation class and the specific implementation class supporting the protocol are determined from the registry in the target application. Finally, the general implementation class and the specific implementation class with the target identification information are executed to output the interactive result of the interactive operation. Since the general implementation class describes the general logic for realizing the target function in different applications, different applications can directly use the general implementation class, and they only need to develop a specific implementation class that describes the difference logic for realizing the target function in different applications, without developing a complete implementation of the target function, so that different applications can quickly realize the target function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for realizing functions in an application program. Background Art

[0002] In the process of application development, taking into account the common usage needs of users, different applications (Application, referred to as APP) can provide the same functions, that is, general functions, such as payment function, instant messaging function, sharing function, etc.

[0003] However, in practice, different applications often have the problem of being time-consuming when implementing the same function. Based on the above description, how to enable different applications to quickly implement the same function becomes a technical problem that needs to be solved urgently. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method, apparatus, device and storage medium for implementing a function in an application program, so as to enable different application programs to quickly implement the same function.

[0005] In a first aspect, an embodiment of the present invention provides a method for implementing a function in an application, including:

[0006] In response to an interactive operation triggered on a target function in a target application, generating a target event corresponding to the interactive operation;

[0007] According to the protocol contained in the target event, determine the target identification information of the general implementation class and the specific implementation class supporting the protocol from the registry in the target application, wherein the general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the difference logic for implementing the target function in different applications;

[0008] The general implementation class and the specific implementation class having the target identification information are executed to output an interaction result of the interaction operation.

[0009] In a second aspect, an embodiment of the present invention provides a device for implementing a function in an application, including:

[0010] An event generation module, configured to generate a target event corresponding to the interaction operation in response to the interaction operation triggered by the target function in the target application program;

[0011] A determination module, used to determine, according to the protocol contained in the target event, target identification information of a general implementation class and a specific implementation class supporting the protocol from a registry in the target application, wherein the general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the difference logic for implementing the target function in different applications;

[0012] An execution module is used to execute the general implementation class and the specific implementation class with the target identification information to output the interaction result of the interaction operation.

[0013] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method for implementing the function in the application in the first aspect. The electronic device may also include a communication interface for communicating with other devices or communication systems.

[0014] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement a method for implementing the functions in an application as described in the first aspect above.

[0015] In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor is enabled to implement a method for implementing the functions in the application as described in the first aspect above.

[0016] In the method for implementing a function in an application provided by an embodiment of the present invention, in response to an interactive operation triggered on a target function in a target application, a target event corresponding to the interactive operation is generated. Then, according to the protocol contained in the target event, the target identification information of the general implementation class and the specific implementation class supporting the protocol are determined from the registry in the target application. Among them, the general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the difference logic for implementing the target function in different applications. Finally, the general implementation class and the specific implementation class with the target identification information can be executed to output the interactive result of the interactive operation.

[0017] It can be seen that compared with the solution in which different applications each implement the target function, in this solution, since the common implementation class describes the common logic for implementing the target function in different applications, different applications can directly reuse the common implementation class, and they only need to develop specific implementation classes that describe the different logic for implementing their own target functions, without having to develop a complete implementation of the target function from scratch. This can obviously reduce the workload of developers to implement the target function, thereby improving the efficiency of different applications in implementing the target function, which means that different applications can quickly implement the same function. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A flowchart of a method for implementing a function in an application program provided by an embodiment of the present invention;

[0020] Figure 2 A flowchart of another method for implementing a function in an application program provided by an embodiment of the present invention;

[0021] Figure 3 A schematic diagram of an implementation class execution method provided by an embodiment of the present invention;

[0022] Figure 4 A schematic diagram of another implementation class execution method provided by an embodiment of the present invention;

[0023] Figure 5 A schematic diagram of the structure of a device for implementing functions in an application program provided by an embodiment of the present invention;

[0024] Figure 6 For Figure 5 A schematic diagram of the structure of an electronic device corresponding to a device for implementing functions in an application provided in the illustrated embodiment. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0026] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.

[0027] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0028] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to identifying", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is identified" may be interpreted as "when determining" or "in response to determining" or "when identifying (stated condition or event)" or "in response to identifying (stated condition or event)", depending on the context.

[0029] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0030] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0031] Before describing in detail the implementation methods of the functions in the application programs provided in the following embodiments of the present invention, the related concepts involved in the following embodiments may also be explained:

[0032] Event: In computer programming, an event is a specific action or state change triggered by a user operation that can be recognized and responded to by an application.

[0033] Implementation class: In object-oriented programming (OOP), an implementation class refers to a class used to implement the methods defined in an interface.

[0034] In some cases, an interface can be viewed as defining a "protocol," that is, the rules and behaviors that implementation classes that implement the interface need to follow.

[0035] Before describing in detail the methods for implementing functions in the application provided by the embodiments of the present invention, an application scenario for implementing the functions in the application may be described schematically:

[0036] As introduced in the background art, during the application development process, taking into account the common usage requirements of users, different applications can provide the same functions, namely, common functions, such as payment functions, instant messaging functions, sharing functions, and the like.

[0037] However, in practice, when different applications implement the same function, the developers of different applications often implement the same function according to their own needs, and different applications may use different programming languages. Therefore, it is time-consuming for different applications to implement the same function. In order to improve the above problem, the method for implementing the function in the application provided in the following embodiments of the present invention can be used.

[0038] Based on the above description, some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0039] Figure 1 The flowchart of a method for implementing a function in an application provided by an embodiment of the present invention. The method for implementing a function in an application provided by an embodiment of the present invention can be executed by a target application. It is understandable that the target application can be implemented as software, or a combination of software and hardware. Figure 1 As shown, the method comprises the following steps:

[0040] 101 , in response to an interactive operation triggered by a target function in a target application, generating a target event corresponding to the interactive operation.

[0041] 102. According to the protocol contained in the target event, determine the target identification information of the general implementation class and the specific implementation class supporting the protocol from the registry in the target application. The general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the different logic for implementing the target function in different applications.

[0042] 103 , executing the general implementation class and the specific implementation class with the target identification information to output the interaction result of the interaction operation.

[0043] A user using the target application may trigger an interactive operation on a target function in the target application, and the target application may generate a target event corresponding to the interactive operation in response to the interactive operation.

[0044] Optionally, the target application may include any application in a plurality of applications, and the plurality of applications may implement the same target function. The target function may include any one of the payment function, instant messaging function, sharing function, etc. mentioned in the above background technology. Optionally, the interactive operation may include a click operation, a touch operation, or a voice command, etc.

[0045] For example, a user may click a payment function button in a target application to trigger the payment function, and the target application may generate a target event corresponding to the click operation in response to the click operation.

[0046] In actual applications, the target event may include the protocol required to implement the target function. Further, the target application may determine the target identification information of the general implementation class and the specific implementation class supporting the protocol from the registry in the target application according to the protocol included in the target event.

[0047] Optionally, the registry may be pre-generated, which may specifically include the identification information of the implementation class and the corresponding relationship between the protocols supported by the implementation class. Optionally, the identification information may include the name of the implementation class. The specific generation process of the registry may refer to the description in the following embodiment.

[0048] Among them, the general implementation class describes the general logic of implementing the target function in different applications, and the specific implementation class describes the different logic of implementing the target function in different applications. That is, different applications can reuse the general implementation class, and different applications have different specific implementation classes.

[0049] Optionally, the target application may include a universal implementation class and a specific implementation class with different identification information, and the different identification information may correspond to different protocols. After obtaining the target identification information of the universal implementation class and the specific implementation class supporting the protocol, the target application may determine the universal implementation class and the specific implementation class with the target identification information from the universal implementation class and the specific implementation class with different identification information according to the target identification information.

[0050] Finally, the target application can execute the general implementation class and the specific implementation class with the target identification information to output the interaction result of the interaction operation. Optionally, when the user triggers other interaction operations on other functions in the target application, the output interaction results are also different accordingly. Continuing with the above example, when the interaction operation is specifically a click operation on the payment function button, the interaction result may include a successful payment page containing the payment amount displayed on the target application.

[0051] In this embodiment, compared to the solution in which different applications each implement the target function, in this solution, since the common implementation class describes the common logic for implementing the target function in different applications, different applications can directly reuse the common implementation class, and they only need to develop specific implementation classes that describe the different logic for implementing their own target functions, without having to develop a complete implementation of the target function from scratch. This can obviously reduce the workload of developers to implement the target function, thereby improving the efficiency of different applications in implementing the target function, which means that different applications can quickly implement the same function.

[0052] Figure 1 In the illustrated embodiment, it has been mentioned that the target identification information of the general implementation class and the specific implementation class supporting the protocol can be determined from the registry in the target application.

[0053] In actual applications, an application may include a registry, which may include identification information of implementation classes in any application and the correspondence between protocols supported by implementation classes in any application. Optionally, the identification information may include the names corresponding to all implementation classes in any application.

[0054] Regarding obtaining the registry in the target application, an optional way is that the developer can write code that describes the correspondence between the identification information of the implementation class in the target application and the protocol supported by the implementation class in the target application, so as to obtain a registry containing the correspondence and store the registry in the target application.

[0055] Alternatively, the target application can use the Inversion of Control (IoC) design principle to register the implementation classes contained in it into the factory class (such as AppIOCServiceFactory) of the target application, and the factory class is responsible for creating instances of these implementation classes to obtain a registry corresponding to the target application, and store the registry in the target application. The core idea of ​​the IoC design principle is to transfer the code of the corresponding relationship between the identification information of the implementation class and the protocol, which was originally written by the application developer, to the factory class, so that the factory class can centrally manage the implementation classes in the target application, and multiple implementation classes are in a decoupled state, that is, to reduce the coupling between multiple implementation classes.

[0056] Regarding the registration of the implementation class, the target application may optionally use a class method (such as the +(void)l oad method) in response to the start of the target application to automatically register the implementation class contained in the target application with the factory class of the target application. In practice, the target application may include multiple implementation classes. Since the calling order of the +(void)l oad method is random, it is impossible to determine which implementation class contained in the target application is registered with the target application first, but ultimately, through this +(void)l oad method, all implementation classes contained in the target application can be registered with the factory class of the target application.

[0057] In this embodiment, in response to the start of the target application, the implementation class contained in the target application is automatically registered in the factory class of the target application using a class method to obtain a registration table in the target application. It can be seen that only the implementation class is registered when the target application is started, and there is no need to allocate memory space for these implementation classes, thereby saving memory. In addition, during the registration process, the control inversion design principle is used, so that the factory class in the target application can centrally manage multiple implementation classes in the target application, and these multiple implementation classes are in a decoupled state, thereby making the target application easier to expand and maintain.

[0058] It should be noted that although the embodiment of the present invention only mentions the registration process of the implementation class in the target application, in actual application, the registration process of the implementation class in other applications except the target application in multiple applications can be referred to the description in the above embodiment and will not be repeated here.

[0059] In the above embodiment, it has been mentioned that the general implementation class and the specific implementation class in the target application can be registered in the factory class of the target application. Optionally, before registering the implementation class, the target application can create the implementation class.

[0060] Specifically, the target application can create a general implementation class and a specific implementation class that support the protocol in the target application according to the protocol defined in the service interface. Figure 1 The target events mentioned in the illustrated embodiments include the same protocol.

[0061] That is to say, a service interface allows multiple implementation classes to be processed in a unified manner and jointly comply with the protocol defined in the service interface. The protocol can specify how to implement the target function in the application, but different applications can create different implementation classes according to their own needs.

[0062] In practical applications, the service interface may optionally include multiple ones. Correspondingly, the service interface may also include multiple protocols. Furthermore, the target application may sequentially create general implementation classes and specific implementation classes supporting different protocols in the target application according to the multiple protocols defined in the service interface.

[0063] And because there is a corresponding relationship between the protocol and the implementation class, and the general implementation class can be reused by multiple applications, other applications except the target application can directly reuse the general implementation class without creating it again. For other applications, they only need to create specific implementation classes that support the protocol according to the protocol defined in the service interface.

[0064] After the universal implementation class and the specific implementation class in the target application are created, the target application can register the universal implementation class and the specific implementation class in the target application with the factory class of the target application according to the methods mentioned in the above embodiments. The specific process can be referred to the description in the above embodiments, which will not be repeated here.

[0065] In this embodiment, the target application creates a general implementation class and a specific implementation class in the target application according to the protocol defined in the service interface. Since the service interface defines a standardized protocol, and the protocol can ensure that the implementation classes that implement the service interface in the target application follow the same specification, it can ensure that the created implementation classes have a consistent behavior pattern, that is, they are all used to implement the target function in the target application, that is, the creation effect of the implementation class in the target application can be guaranteed.

[0066] And because the service interface can be reused in different applications, different applications can comply with the protocol defined in the service interface. Therefore, this solution can also ensure the reuse of common implementation classes, thereby reducing duplicate code and improving the efficiency of different applications in achieving target functions.

[0067] In addition, the contents not described in detail in this embodiment and the technical effects that can be achieved can all be found in the relevant descriptions in the above embodiments, and will not be repeated here.

[0068] Figure 2 A flowchart of another method for implementing a function in an application provided by an embodiment of the present invention.

[0069] like Figure 2 As shown, the method may include the following steps:

[0070] 201 : In response to an interactive operation triggered by a target function in a target application, a target event corresponding to the interactive operation is generated.

[0071] 202. According to the protocol contained in the target event, determine the target identification information of the general implementation class and the specific implementation class that support the protocol from the registry in the target application. The general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the different logic for implementing the target function in different applications.

[0072] 203. According to the calling statement in the general implementation class, the general implementation class and the specific implementation class are respectively executed to output the interaction result of the interaction operation. The calling statement describes the calling relationship between the general implementation class and the specific implementation class.

[0073] The specific implementation process of the above steps 201 to 202 can be found in Figure 1 The specific description of the illustrated embodiments will not be repeated here.

[0074] In actual applications, in order to achieve the target function, there is usually a calling relationship between the general implementation class and the specific implementation class. The target application can determine the calling statement that describes the calling relationship between the general implementation class and the specific implementation class, and the calling statement can be located in the general implementation class.

[0075] Furthermore, the target application can respectively execute the general implementation class and the specific implementation class according to the calling statements in the general implementation class to output the interaction result of the interaction operation.

[0076] An alternative implementation is as follows: Figure 3 As shown, the target application may first execute the general implementation class. If the call statement in the general implementation class is executed, the target application may execute the specific implementation class to jump from the target application to the external application to output the interaction results on the target application and the external application respectively. The external application refers to an application running outside the target application, which can be called by the target application to implement a specific function. Optionally, the interaction results output on the target application and the external application may be the same or different.

[0077] For example, suppose that the general implementation class and the specific implementation class are used to implement the order payment function in the target application. The general implementation class can describe the general logic of implementing order payment on the payment page in different applications, and the specific implementation class in the target application can describe the different payment methods used when the target application and other applications implement the order payment function, which may include jumping to an external application (i.e., a third-party payment platform) for payment.

[0078] The target application can first execute the general logic of implementing order payment on the order payment page, and then, when executing the call statement in the general implementation class, jump to the external application for payment, so as to output the payment results on the target application and the external application respectively.

[0079] In another optional execution mode, the target application may first execute the general implementation class. If a call statement in the general implementation class is executed, the target application may execute the specific implementation class to output the interaction result of the interaction operation.

[0080] For example, if Figure 4 As shown, it is assumed that the general implementation class describes the general logic of implementing payment in different applications, such as determining the order selected by the user, then displaying the payment amount, and then sending the payment request containing the payment amount to the server, so that the server returns the payment result, and finally the application displays the payment result.

[0081] In actual applications, the general logic of payment is the same in different applications, but different applications may provide different coupons and promotions, such as discounts, free gifts, etc., which require different applications to implement them in specific implementation classes. For example, the specific implementation class in the target application can describe the calculation method of the payment amount. In this case, the call statement can be placed before "display payment amount" in the general implementation class.

[0082] Based on the above description, the execution process of the implementation class is as follows: the target application can first execute to determine the order selected by the user, and then when executing the call statement in the general implementation class, execute the specific implementation class of the target application to calculate the payment amount. Then, the target application can display the payment amount. After that, the target application can send a payment request containing the payment amount to the server, so that the server returns the payment result. Finally, the target application can display the payment result.

[0083] It should be noted that, in actual applications, the call statement can also be located before the general logic in the general implementation class, that is, if the target application first executes the call statement in the general implementation class, the target application can first execute the specific implementation class and then execute the general implementation class to output the interaction result of the interaction operation. The specific execution process can be referred to the description in the above embodiment, which will not be repeated here.

[0084] In this embodiment, with the help of calling statements that describe the calling relationship between the general implementation class and the specific implementation class, the general implementation class and the specific implementation class are executed respectively, so that the target application can accurately output the interaction results of the interactive operation, thereby ensuring that the target application achieves the target function.

[0085] The following will describe in detail the implementation means of the functions in the application program of one or more embodiments of the present invention. It will be appreciated by those skilled in the art that the implementation means of the functions in these application programs can be configured using commercially available hardware components through the steps taught in this solution.

[0086] Figure 5 A schematic diagram of a structure of a device for implementing a function in an application program provided by an embodiment of the present invention, such as Figure 5 As shown, the device comprises:

[0087] The event generation module 11 is used to generate a target event corresponding to the interactive operation in response to the interactive operation triggered by the target function in the target application.

[0088] The determination module 12 is used to determine the target identification information of the general implementation class and the specific implementation class that support the protocol from the registry in the target application according to the protocol contained in the target event, the general implementation class describes the general logic of implementing the target function in different applications, and the specific implementation class describes the different logics of implementing the target function in different applications.

[0089] The execution module 13 is used to execute the general implementation class and the specific implementation class with the target identification information to output the interaction result of the interaction operation.

[0090] Optionally, the device also includes a registration module 14, which is used to register the implementation class contained in the target application into the factory class of the target application to obtain a registration table in the target application, wherein the registration table includes identification information of the implementation class and the correspondence between the protocols supported by the implementation class.

[0091] Optionally, the registration module 14 is used to register the implementation class included in the target application into the factory class of the target application using a class method in response to the start of the target application.

[0092] Optionally, the execution module 13 is used to execute the general implementation class and the specific implementation class respectively according to the calling statement in the general implementation class to output the interaction result of the interactive operation, and the calling statement describes the calling relationship between the general implementation class and the specific implementation class.

[0093] Optionally, the execution module 13 is used to execute the general implementation class; if a call statement in the general implementation class is executed, the specific implementation class is executed to jump from the target application to the external application to output the interaction result on the target application and the external application respectively.

[0094] Optionally, the apparatus further comprises a creation module 15, configured to create the general implementation class and the specific implementation class in the target application according to the protocol defined in the service interface.

[0095] Figure 5 The device shown can perform Figures 1 to 4 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figures 1 to 4 The implementation process and technical effects of this technical solution refer to Figures 1 to 4 The description in the illustrated embodiment will not be repeated here.

[0096] In a possible design, the structure of the device for implementing the functions in the application program can be implemented as an electronic device, such as Figure 6 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 is used to store the electronic device to perform the above Figures 1 to 4 The processor 21 is configured to execute the program stored in the memory 22 for the method of implementing the function in the application provided in the illustrated embodiment.

[0097] The program includes one or more computer instructions, wherein the one or more computer instructions can implement the following steps when executed by the processor 21:

[0098] In response to an interactive operation triggered on a target function in a target application, generating a target event corresponding to the interactive operation;

[0099] According to the protocol contained in the target event, determine the target identification information of the general implementation class and the specific implementation class supporting the protocol from the registry in the target application, wherein the general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the difference logic for implementing the target function in different applications;

[0100] The general implementation class and the specific implementation class having the target identification information are executed to output an interaction result of the interaction operation.

[0101] Optionally, the processor 21 is further configured to execute the aforementioned Figures 1 to 4 All or part of the steps in the illustrated embodiments.

[0102] The structure of the electronic device may further include a communication interface 23 for the electronic device to communicate with other devices or a communication network.

[0103] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium for storing computer software instructions used by the above electronic device, which includes instructions for executing the above Figure 1 to Figure 4 The procedures involved in implementing the functions in the application program shown.

[0104] In addition, an embodiment of the present invention provides a computer program product. The computer program product includes a computer program or an instruction. When the computer program or the instruction is executed by a processor, the processor is enabled to implement the above Figure 1 to Figure 4 The steps or functions of the method for implementing the functions in the application shown.

[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for implementing a function in an application, characterized in that: include: In response to an interactive operation triggered on a target function in a target application, generating a target event corresponding to the interactive operation; According to the protocol included in the target event, determine the target identification information of the general implementation class and the specific implementation class supporting the protocol from the registry in the target application, wherein the general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the difference logic for implementing the target function in different applications; The general implementation class and the specific implementation class having the target identification information are executed to output an interaction result of the interaction operation.

2. The method according to claim 1, characterized in that The method further comprises: The implementation class included in the target application is registered in the factory class of the target application to obtain a registration table in the target application, wherein the registration table includes identification information of the implementation class and corresponding relationships between protocols supported by the implementation class.

3. The method according to claim 2, characterized in that The step of registering the implementation class included in the target application into the factory class of the target application comprises: In response to the start of the target application, the implementation class included in the target application is registered in the factory class of the target application using a class method.

4. The method according to claim 1, characterized in that: The executing the general implementation class and the specific implementation class having the target identification information to output the interaction result of the interaction operation includes: According to the calling statement in the general implementation class, the general implementation class and the specific implementation class are executed respectively to output the interaction result of the interaction operation, and the calling statement describes the calling relationship between the general implementation class and the specific implementation class.

5. The method according to claim 4, characterized in that The executing the general implementation class and the specific implementation class respectively according to the calling statement in the general implementation class to output the interaction result of the interaction operation includes: Execute the general implementation class; If the call statement in the general implementation class is executed, the specific implementation class is executed to jump from the target application to the external application, so as to output the interaction result on the target application and the external application respectively.

6. The method according to claim 1, characterized in that The method further comprises: The general implementation class and the specific implementation class in the target application are created according to the protocol defined in the service interface.

7. A device for implementing a function in an application, characterized in that: include: An event generation module, configured to generate a target event corresponding to the interaction operation in response to the interaction operation triggered by the target function in the target application program; A determination module, used to determine, according to the protocol contained in the target event, target identification information of a general implementation class and a specific implementation class supporting the protocol from a registry in the target application, wherein the general implementation class describes the general logic for implementing the target function in different applications, and the specific implementation class describes the difference logic for implementing the target function in different applications; An execution module is used to execute the general implementation class and the specific implementation class with the target identification information to output the interaction result of the interaction operation.

8. The device according to claim 7, characterized in that The execution module is used to execute the general implementation class and the specific implementation class respectively according to the calling statement in the general implementation class to output the interaction result of the interactive operation, and the calling statement describes the calling relationship between the general implementation class and the specific implementation class.

9. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the method for implementing the function in the application according to any one of claims 1 to 6.

10. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor executes a method for implementing a function in an application according to any one of claims 1 to 6.