CN111400068B - Interface control method and device, readable medium and electronic equipment - Google Patents

Interface control method and device, readable medium and electronic equipment Download PDF

Info

Publication number
CN111400068B
CN111400068B CN202010187235.1A CN202010187235A CN111400068B CN 111400068 B CN111400068 B CN 111400068B CN 202010187235 A CN202010187235 A CN 202010187235A CN 111400068 B CN111400068 B CN 111400068B
Authority
CN
China
Prior art keywords
interface
proxy
method call
proxy class
mapping relation
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
CN202010187235.1A
Other languages
Chinese (zh)
Other versions
CN111400068A (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 ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology 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 ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010187235.1A priority Critical patent/CN111400068B/en
Publication of CN111400068A publication Critical patent/CN111400068A/en
Application granted granted Critical
Publication of CN111400068B publication Critical patent/CN111400068B/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/541Interprogram communication via adapters, e.g. between incompatible applications
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure relates to a control method and a device for an interface, a readable medium and an electronic device, and relates to the technical field of electronic information, the method is applied to an SDK, and host APP is accessed to the SDK, and the method comprises the following steps: creating a proxy class, wherein the proxy class is used for realizing a platform interface on the SDK, when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class so as to enable the host APP to realize the method call, the mapping relation comprises the platform interface and a corresponding relation between the host APP and an application interface on the host APP, the first interface is any one of the platform interfaces, and the second interface is an interface which is indicated by the mapping relation and corresponds to the first interface. According to the method and the device, forwarding from the platform interface to the application interface is realized according to the mapping relation through the proxy class, so that the association degree between the SDK and the host APP can be reduced, and the development and maintenance efficiency is improved.

Description

Interface control method and device, readable medium and electronic equipment
Technical Field
The disclosure relates to the technical field of electronic information, and in particular relates to a control method and device of an interface, a readable medium and electronic equipment.
Background
With the continuous development of electronic information technology, various APPs (Application program) appear in the Application market to meet the diversified demands of users. Some APP's with similar or related functions usually depend on the same set of SDKs (english: software Development Kit, chinese: software development kit), i.e. a set of SDKs has multiple host APPs connected to them. The host APP and the SDK realize the method call through various interfaces. Typically, the SDK includes multiple interfaces, and each host APP that accesses the SDK needs to include all of the interfaces. If the function of a host APP is only needed to be in butt joint with a part of interfaces, other unused interfaces are needed to be added to the host APP in an empty implementation mode in order to compile and pass, the writing difficulty of a developer is increased, and the development and maintenance efficiency is reduced.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a control method of an interface, applied to a software development kit SDK, where a host application APP is accessed on the SDK, the method includes:
creating a proxy class, wherein the proxy class is used for realizing a platform interface on the SDK;
when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class so as to enable the host APP to realize the method call;
the mapping relation comprises a corresponding relation between the platform interfaces and the application interfaces on the host APP, wherein the first interface is any one of the platform interfaces, the second interface is one of the application interfaces, and the mapping relation indicates an interface corresponding to the first interface.
In a second aspect, the present disclosure provides a control device for an interface, which is applied to a software development kit SDK, where a host application APP is accessed on the SDK, and the device includes:
the creation module is used for creating a proxy class which is used for realizing a platform interface on the SDK;
The forwarding module is used for forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class when executing the method call of the first interface so as to enable the host APP to realize the method call;
the mapping relation comprises a corresponding relation between the platform interfaces and the application interfaces on the host APP, wherein the first interface is any one of the platform interfaces, the second interface is one of the application interfaces, and the mapping relation indicates an interface corresponding to the first interface.
In a third aspect, the present disclosure provides a computer readable medium having stored thereon a computer program which when executed by a processing device performs the steps of the method of the first aspect of the present disclosure.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method of the first aspect of the disclosure.
Through the technical scheme, the proxy class capable of realizing the platform interface on the SDK is firstly created, then when the method call of the first interface in the platform interface is executed, the proxy object of the proxy class is used for forwarding the content of the method call from the first interface to the second interface according to the preset mapping relation so as to enable the host APP accessed into the SDK to realize the method call, wherein the mapping relation comprises the corresponding relation between the platform interface and the application interface on the host APP, the second interface is indicated by the mapping relation in the application interfaces, and the interface corresponding to the first interface. According to the method and the device, forwarding from the platform interface on the SDK to the application interface on the host APP is realized according to the mapping relation through the proxy class, so that the application interface is not required to be concerned when the SDK is used for executing the method, the platform interface is not required to be concerned when the host APP is used for realizing the method, the association degree between the SDK and the host APP can be reduced, the writing difficulty is reduced, and the development and maintenance efficiency is improved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
FIG. 1 is a schematic diagram of a deployment according to one SDK and a host APP;
FIG. 2 is a flow chart illustrating a method of controlling an interface according to an exemplary embodiment;
FIG. 3 is a flow chart illustrating another interface control method according to an exemplary embodiment;
FIG. 4 is a flowchart illustrating another interface control method according to an exemplary embodiment;
FIG. 5 is a flowchart illustrating another interface control method according to an exemplary embodiment;
FIG. 6 is a flowchart illustrating another interface control method according to an exemplary embodiment;
FIG. 7 is a block diagram of a control device of an interface, according to an example embodiment;
FIG. 8 is a block diagram of a control device of another interface shown according to an exemplary embodiment;
FIG. 9 is a block diagram of a control device of another interface shown in accordance with an exemplary embodiment;
FIG. 10 is a block diagram of a control device of another interface shown in accordance with an exemplary embodiment;
fig. 11 is a schematic diagram showing a structure of an electronic device according to an exemplary embodiment.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Before introducing the control method, the device, the readable medium and the electronic equipment of the interface provided by the disclosure, application scenarios related to various embodiments of the disclosure are first described. The application scenario may include an SDK, and a host APP accessing the SDK. The SDK may be disposed on a server, the host APP may be disposed on a terminal device, and data transmission may be performed between the terminal device and the server, as shown in fig. 1. The terminal device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a car-mounted terminal (e.g., car navigation terminal), etc., and a fixed terminal such as a digital TV, a desktop computer, etc. Only one host APP can be accessed to the SDK, a plurality of host APP can be accessed to the SDK, and the plurality of host APP can be deployed on one terminal device or on different terminal devices.
Fig. 2 is a flowchart of a control method of an interface according to an exemplary embodiment, and as shown in fig. 2, the method is applied to an SDK, where a host APP is accessed, and includes the following steps:
in step 101, creating a proxy class, wherein the proxy class is used for realizing a platform interface on the SDK.
For example, an agent class may be created on the SDK that includes implementations (or methods) of all platform interfaces on the SDK. The Proxy class may be, for example, a Proxy class. It is understood that the proxy class encapsulates all of the platform interfaces on the SDK. The host APP side also comprises a plurality of application interfaces, and any application interface needs to be in butt joint with one platform interface of the SDK and is realized through a proxy object of a proxy class. The proxy class may be a static proxy class or a dynamic proxy class.
Step 102, when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to the preset mapping relation through the proxy object of the proxy class, so that the host APP realizes the method call.
The mapping relation comprises a corresponding relation between a platform interface and an application interface on the host APP, wherein the first interface is any one of the platform interfaces, and the second interface is an interface corresponding to the first interface and indicated by the mapping relation in the application interfaces.
For example, for a first interface in the platform interfaces, when the SDK executes the method call of the first interface, the content of the method call can be forwarded through the proxy object of the proxy class according to a preset mapping relationship. The content of the method call can be understood as information such as a method name, a package name, a path, and the like. The mapping relationship can be preset according to the requirements of the host APP and the SDK, wherein the mapping relationship comprises the corresponding relationship between the platform interface and the application interface on the host APP. The mapping relationship may be understood as including a plurality of corresponding relationships, where each corresponding relationship is a key-value pair (i.e., key-value), a "key" is one of the platform interfaces, and a "value" is one or more of the application interfaces.
Specifically, when forwarding the content called by the method, if the Proxy class is a static Proxy class, the second interface corresponding to the first interface can be determined through the mapping relation, then the Proxy object corresponding to the host APP can be created through the newProxyInstance method of the Proxy class, or the Proxy object can be created through the mode that APT (English: annotation Processing Tool, chinese: annotation processor) reads in the source code. And finally, forwarding the content called by the method from the first interface to the second interface through the proxy object. When forwarding the content called by the method, if the proxy class is a dynamic proxy class, a proxy object can be created according to the mapping relation, wherein the proxy object comprises a corresponding relation that a key is a first interface and a value is a second interface, and then the content called by the method is forwarded from the first interface to the second interface through the proxy object. After forwarding the content of the method call from the first interface to the second interface, the host APP realizes the method call according to the content of the method call, and further can forward the content returned by the method call from the second interface to the first interface through the proxy object, so that the SDK processes or stores the content returned by the method call.
The method and the device encapsulate the platform interface of the SDK by creating the proxy class, and realize the forwarding from the platform interface on the SDK to the application interface on the host APP according to the preset mapping relation. The platform interface is isolated from the application interface, so that the application interface is not required to be paid attention to when the SDK is used for executing the method, the platform interface is not required to be paid attention to when the host APP is used for realizing the method, the association degree between the SDK and the host APP can be reduced, and decoupling is realized on the SDK and the host APP. The difficulty of writing by a developer is reduced, a large number of empty realizations in the code are avoided, and the code is simplified, so that the constraint capacity and unified standard of the code are ensured, and the aim of improving the development and maintenance efficiency is fulfilled.
In summary, the present disclosure firstly creates a proxy class capable of implementing a platform interface on an SDK, and then, when executing a method call of a first interface in the platform interface, forwards, through a proxy object of the proxy class, content of the method call from the first interface to a second interface according to a preset mapping relationship, so that a host APP accessing the SDK implements the method call, where the mapping relationship includes a correspondence between the platform interface and an application interface on the host APP, the second interface is an interface corresponding to the first interface and indicated by the mapping relationship in the application interfaces. According to the method and the device, forwarding from the platform interface on the SDK to the application interface on the host APP is realized according to the mapping relation through the proxy class, so that the application interface is not required to be concerned when the SDK is used for executing the method, the platform interface is not required to be concerned when the host APP is used for realizing the method, the association degree between the SDK and the host APP can be reduced, the writing difficulty is reduced, and the development and maintenance efficiency is improved.
FIG. 3 is a flow chart illustrating another method of controlling an interface, as shown in FIG. 3, where the proxy class is a dynamic proxy class and the proxy object is a dynamic proxy object, according to an exemplary embodiment. Accordingly, step 102 may include:
step 1021, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation when executing the method call.
Step 1022, forwarding the content of the method call from the first interface to the second interface through the dynamic proxy object.
In an application scenario where the proxy class is a dynamic proxy class (e.g., dynamicProxy class), the dynamic proxy object may be created by way of dynamic loading. For example, the dynamic proxy object can be dynamically loaded according to the mapping relation, the dynamic proxy object includes a correspondence relation that a key in the mapping relation is a first interface, a value is a second interface, and finally, the content called by the method is forwarded from the first interface to the second interface through the dynamic proxy object.
FIG. 4 is a flowchart of another method for controlling an interface, as shown in FIG. 4, according to an exemplary embodiment, in a scenario where there are multiple host APPs, the implementation of step 102 may include the following steps:
step 1023, when executing method call, determining a second interface corresponding to the first interface according to the mapping relation, and determining a target host APP to which the second interface belongs.
In step 1024, the content of the method call is forwarded from the first interface to the second interface according to the mapping relation through the target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
For example, a plurality of host APPs may be accessed to one SDK, and when the method is invoked, a second interface corresponding to the first interface may be determined according to the mapping relationship, and a target host APP to which the second interface belongs may be further determined. It should be noted that, the second interface is indicated by the mapping relationship in the application interfaces, and the number of interfaces corresponding to the first interface may be one or more, that is, the number of interfaces corresponding to the first interface may be one or more. Accordingly, the target host APP may be one or more, that is, the host APP that needs to interface with the first interface may be one or more. For example, N host APPs are connected to the SDK, where M (m.ltoreq.n) host APPs need to interface with the first interface, and in the mapping relationship, a "key" may be included as a corresponding relationship of the first interface, and a "value" in the corresponding relationship includes a plurality of application interfaces, which are all used as the second interface. The system also can comprise a plurality of mapping relations, wherein each mapping relation comprises a first interface and a corresponding application interface, and the application interfaces in the plurality of mapping relations are used as second interfaces.
After the second interface and the target host APP are determined, the content of the method call can be forwarded from the first interface to the second interface through the target proxy object corresponding to the target host APP in the proxy class according to the mapping relation, so that the target host APP realizes the method call. Specifically, if the proxy class is a static proxy class, the method of determining the target proxy object may be that a proxy object corresponding to each host APP is created in advance, then the proxy object corresponding to the target host APP is used as the target proxy object, and finally the content called by the method is forwarded from the first interface to the second interface through the target proxy object. If the proxy class is a dynamic proxy class, the target proxy object corresponding to the target host APP can be dynamically loaded according to the corresponding relation between the first interface and the second interface, and then the content called by the method is forwarded from the first interface to the second interface through the target proxy object.
Fig. 5 is a flowchart illustrating another method of controlling an interface according to an exemplary embodiment, as shown in fig. 5, after step 101, the method further includes:
and 103, caching the proxy object corresponding to each host APP in the proxy class.
For example, after creating the proxy class, the proxy object corresponding to each host APP may be cached before executing the method call of the first interface. Since the SDK may execute multiple method calls during running, in order to avoid repeatedly creating the proxy object each time the method call is executed, the proxy object may be cached first, for example, in the format of the WeakHashMap. Since there may be a plurality of host APPs, there may be a corresponding plurality of proxy objects, each proxy object corresponding to a host APP may be cached.
Fig. 6 is a flowchart illustrating another method of controlling an interface, according to an exemplary embodiment, as shown in fig. 6, the method further comprising:
and 104, updating the proxy class according to the newly-built third interface in the platform interfaces, so that the proxy class comprises the realization of the third interface.
Step 105, adding the third interface and the fourth interface as a corresponding relation to the mapping relation, wherein the fourth interface is newly built in application interfaces on the host APP, corresponds to the third interface, and is used for realizing the method call of the third interface.
For example, the need for adding a specific interface to some host APPs may occur during the use and maintenance of the SDK, in which case, only a third interface needs to be created in the platform interfaces of the SDK, and the proxy class is updated according to the third interface, so that the proxy class includes an implementation of the third interface, that is, an implementation of adding the third interface in the proxy class, where the third interface may be one or more. And then, updating the mapping relation, taking the third interface and the fourth interface as a corresponding relation, and adding the third interface and the fourth interface into the mapping relation, namely adding the key as the third interface and the value as the key value pair of the fourth interface into the mapping relation. The fourth interface is a newly built interface in an application interface on the host APP, the fourth interface corresponds to the third interface, and implementation of the fourth interface is further needed to be added on the host APP, so that method calling of the third interface is achieved. In this way, in the development or maintenance process, if an interface is required to be added, each host APP does not need to be changed, and only the host APP which is in butt joint with the newly added interface is required to be added, the realization of the newly added interface is realized, and the proxy class and the mapping relation are updated, so that the development and maintenance efficiency is further improved.
In summary, the present disclosure firstly creates a proxy class capable of implementing a platform interface on an SDK, and then, when executing a method call of a first interface in the platform interface, forwards, through a proxy object of the proxy class, content of the method call from the first interface to a second interface according to a preset mapping relationship, so that a host APP accessing the SDK implements the method call, where the mapping relationship includes a correspondence between the platform interface and an application interface on the host APP, the second interface is an interface corresponding to the first interface and indicated by the mapping relationship in the application interfaces. According to the method and the device, forwarding from the platform interface on the SDK to the application interface on the host APP is realized according to the mapping relation through the proxy class, so that the application interface is not required to be concerned when the SDK is used for executing the method, the platform interface is not required to be concerned when the host APP is used for realizing the method, the association degree between the SDK and the host APP can be reduced, the writing difficulty is reduced, and the development and maintenance efficiency is improved.
Fig. 7 is a block diagram of a control apparatus of an interface, which is applied to an SDK, to which a host APP is connected, as shown in fig. 7, according to an exemplary embodiment, and the apparatus 200 includes:
the creation module 201 is configured to create a proxy class, where the proxy class is used to implement a platform interface on the SDK.
And the forwarding module 202 is configured to forward, when executing the method call of the first interface, the content of the method call from the first interface to the second interface according to a preset mapping relationship through the proxy object of the proxy class, so that the host APP realizes the method call.
The mapping relation comprises a corresponding relation between a platform interface and an application interface on the host APP, wherein the first interface is any one of the platform interfaces, and the second interface is an interface corresponding to the first interface and indicated by the mapping relation in the application interfaces.
Optionally, the proxy class is a dynamic proxy class, and the proxy object is a dynamic proxy object. The forwarding module 202 is configured to:
when the method is called, the dynamic proxy object of the dynamic proxy class is loaded according to the mapping relation. And forwarding the content of the method call from the first interface to the second interface through the dynamic proxy object.
Fig. 8 is a block diagram of a control device of another interface, according to an exemplary embodiment, as shown in fig. 8, in a scenario where there are a plurality of host APPs, the forwarding module 202 includes:
the determining submodule 2021 is configured to determine, according to the mapping relationship, a second interface corresponding to the first interface when the method call is performed, and determine a target host APP to which the second interface belongs.
And the forwarding submodule 2022 is used for forwarding the content of the method call from the first interface to the second interface according to the mapping relation through the target proxy object corresponding to the target host APP in the proxy class so as to enable the target host APP to realize the method call.
Fig. 9 is a block diagram of a control device of another interface, shown in accordance with an exemplary embodiment, as shown in fig. 9, the device 200 further includes:
and the caching module 203 is configured to cache, after the proxy class is created, a proxy object corresponding to each host APP in the proxy class.
Fig. 10 is a block diagram of a control device of another interface, shown in accordance with an exemplary embodiment, as shown in fig. 10, the device 200 further includes:
and a new module 204, configured to update the proxy class according to the third interface newly created in the platform interfaces, so that the proxy class includes implementation of the third interface.
The adding module 205 is configured to add the third interface and the fourth interface as a corresponding relationship to the mapping relationship, where the fourth interface is a newly created interface in the application interfaces on the host APP and corresponds to the third interface, and the fourth interface is used to implement method call of the third interface.
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.
In summary, the present disclosure firstly creates a proxy class capable of implementing a platform interface on an SDK, and then, when executing a method call of a first interface in the platform interface, forwards, through a proxy object of the proxy class, content of the method call from the first interface to a second interface according to a preset mapping relationship, so that a host APP accessing the SDK implements the method call, where the mapping relationship includes a correspondence between the platform interface and an application interface on the host APP, the second interface is an interface corresponding to the first interface and indicated by the mapping relationship in the application interfaces. According to the method and the device, forwarding from the platform interface on the SDK to the application interface on the host APP is realized according to the mapping relation through the proxy class, so that the application interface is not required to be concerned when the SDK is used for executing the method, the platform interface is not required to be concerned when the host APP is used for realizing the method, the association degree between the SDK and the host APP can be reduced, the writing difficulty is reduced, and the development and maintenance efficiency is improved.
Referring now to fig. 11, a schematic diagram of an electronic device (which may include, for example, a terminal device or server) 300 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The SDK in the embodiments of the present disclosure may be deployed on the server, and the host APP may be deployed on the terminal device. The electronic device shown in fig. 11 is merely an example, and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 11, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 308 including, for example, magnetic tape, hard disk, etc.; and communication means 309. The communication means 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. While fig. 11 shows an electronic device 300 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via a communication device 309, or installed from a storage device 308, or installed from a ROM 302. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing means 301.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the terminal device for deploying the host APP, the server for deploying the SDK may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: creating a proxy class, wherein the proxy class is used for realizing a platform interface on the SDK; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class so as to enable the host APP to realize the method call; the mapping relation comprises a corresponding relation between the platform interfaces and the application interfaces on the host APP, wherein the first interface is any one of the platform interfaces, the second interface is one of the application interfaces, and the mapping relation indicates an interface corresponding to the first interface.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of a module is not limited to the module itself in some cases, and, for example, a creation module may also be described as a "module that creates a proxy class".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, example 1 provides a control method of an interface, applied to a software development kit SDK, where a host application APP is accessed on the SDK, the method including: creating a proxy class, wherein the proxy class is used for realizing a platform interface on the SDK; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class so as to enable the host APP to realize the method call; the mapping relation comprises a corresponding relation between the platform interfaces and the application interfaces on the host APP, wherein the first interface is any one of the platform interfaces, the second interface is one of the application interfaces, and the mapping relation indicates an interface corresponding to the first interface.
Example 2 provides the method of example 1, the proxy class being a dynamic proxy class and the proxy object being a dynamic proxy object, according to one or more embodiments of the present disclosure; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including: when the method call is executed, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation; and forwarding the content of the method call from the first interface to the second interface through the dynamic proxy object.
Example 3 provides the method of example 1 or 2, the host APP being a plurality of; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including: when the method call is executed, determining the second interface corresponding to the first interface according to the mapping relation, and determining a target host APP to which the second interface belongs; and forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
In accordance with one or more embodiments of the present disclosure, example 4 provides the method of example 3, after the creating the proxy class, the method further comprising: and caching the proxy object corresponding to each host APP in the proxy class.
Example 5 provides the method of example 1, according to one or more embodiments of the present disclosure, the method further comprising: updating the proxy class according to a newly-built third interface in the platform interfaces, so that the proxy class comprises the realization of the third interface; and adding the third interface and a fourth interface serving as a corresponding relation to the mapping relation, wherein the fourth interface is newly built in the application interfaces on the host APP and corresponds to the third interface, and the fourth interface is used for realizing the method call of the third interface.
According to one or more embodiments of the present disclosure, example 6 provides a control apparatus of an interface applied to a software development kit SDK having a host application APP accessed thereon, the apparatus comprising: the creation module is used for creating a proxy class which is used for realizing a platform interface on the SDK; the forwarding module is used for forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class when executing the method call of the first interface so as to enable the host APP to realize the method call; the mapping relation comprises a corresponding relation between the platform interfaces and the application interfaces on the host APP, wherein the first interface is any one of the platform interfaces, the second interface is one of the application interfaces, and the mapping relation indicates an interface corresponding to the first interface.
Example 7 provides the apparatus of example 6, the proxy class being a dynamic proxy class, the proxy object being a dynamic proxy object, in accordance with one or more embodiments of the present disclosure; the forwarding module is used for: when the method call is executed, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation; and forwarding the content of the method call from the first interface to the second interface through the dynamic proxy object.
Example 8 provides the apparatus of example 6 or 7, the host APP being a plurality of; the forwarding module includes: a determining submodule, configured to determine, according to the mapping relationship, the second interface corresponding to the first interface and determine a target host APP to which the second interface belongs when the method call is executed; and the forwarding sub-module is used for forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class so as to enable the target host APP to realize the method call.
According to one or more embodiments of the present disclosure, example 9 provides a computer-readable medium having stored thereon a computer program which, when executed by a processing device, implements the steps of the methods described in examples 1 to 5.
In accordance with one or more embodiments of the present disclosure, example 10 provides an electronic device, comprising: a storage device having a computer program stored thereon; processing means for executing the computer program in the storage means to realize the steps of the method described in examples 1 to 5.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims. 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.

Claims (10)

1. The control method of the interface is characterized by being applied to a Software Development Kit (SDK), wherein a host Application (APP) is accessed to the SDK, and the method comprises the following steps:
creating a proxy class, wherein the proxy class is used for realizing a platform interface on the SDK; the proxy class encapsulates a platform interface on the SDK;
when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class so as to enable the host APP to realize the method call;
the mapping relation comprises a corresponding relation between the platform interfaces and the application interfaces on the host APP, wherein the first interface is any one of the platform interfaces, the second interface is one of the application interfaces, and the mapping relation indicates an interface corresponding to the first interface.
2. The method of claim 1, wherein the proxy class is a dynamic proxy class and the proxy object is a dynamic proxy object; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including:
when the method call is executed, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation;
and forwarding the content of the method call from the first interface to the second interface through the dynamic proxy object.
3. The method of claim 1 or 2, wherein the host APP is a plurality; when executing the method call of the first interface, forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class, including:
when the method call is executed, determining the second interface corresponding to the first interface according to the mapping relation, and determining a target host APP to which the second interface belongs;
and forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class, so that the target host APP realizes the method call.
4. A method according to claim 3, wherein after the creation of the proxy class, the method further comprises:
and caching the proxy object corresponding to each host APP in the proxy class.
5. The method according to claim 1, wherein the method further comprises:
updating the proxy class according to a newly-built third interface in the platform interfaces, so that the proxy class comprises the realization of the third interface;
and adding the third interface and a fourth interface serving as a corresponding relation to the mapping relation, wherein the fourth interface is newly built in the application interfaces on the host APP and corresponds to the third interface, and the fourth interface is used for realizing the method call of the third interface.
6. An interface control device, which is applied to a software development kit SDK, wherein a host application APP is accessed on the SDK, the device comprises:
the creation module is used for creating a proxy class which is used for realizing a platform interface on the SDK; the proxy class encapsulates a platform interface on the SDK;
the forwarding module is used for forwarding the content of the method call from the first interface to the second interface according to a preset mapping relation through the proxy object of the proxy class when executing the method call of the first interface so as to enable the host APP to realize the method call;
The mapping relation comprises a corresponding relation between the platform interfaces and the application interfaces on the host APP, wherein the first interface is any one of the platform interfaces, the second interface is one of the application interfaces, and the mapping relation indicates an interface corresponding to the first interface.
7. The apparatus of claim 6, wherein the proxy class is a dynamic proxy class and the proxy object is a dynamic proxy object; the forwarding module is used for:
when the method call is executed, loading the dynamic proxy object of the dynamic proxy class according to the mapping relation; and forwarding the content of the method call from the first interface to the second interface through the dynamic proxy object.
8. The apparatus of claim 6 or 7, wherein the host APP is a plurality; the forwarding module includes:
a determining submodule, configured to determine, according to the mapping relationship, the second interface corresponding to the first interface and determine a target host APP to which the second interface belongs when the method call is executed;
and the forwarding sub-module is used for forwarding the content of the method call from the first interface to the second interface according to the mapping relation through a target proxy object corresponding to the target host APP in the proxy class so as to enable the target host APP to realize the method call.
9. A computer readable medium on which a computer program is stored, characterized in that the program, when being executed by a processing device, carries out the steps of the method according to any one of claims 1-5.
10. An electronic device, comprising:
a storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method according to any one of claims 1-5.
CN202010187235.1A 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment Active CN111400068B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010187235.1A CN111400068B (en) 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010187235.1A CN111400068B (en) 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111400068A CN111400068A (en) 2020-07-10
CN111400068B true CN111400068B (en) 2023-09-22

Family

ID=71434336

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010187235.1A Active CN111400068B (en) 2020-03-17 2020-03-17 Interface control method and device, readable medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111400068B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112068903B (en) * 2020-09-21 2024-05-03 深圳市欢太科技有限公司 Application program loading method, application program loading device, medium and equipment
CN112486826B (en) * 2020-11-30 2023-08-01 北京字跳网络技术有限公司 Test method, test device, electronic equipment and computer readable medium
CN112463128A (en) * 2020-12-08 2021-03-09 北京指掌易科技有限公司 Software development kit behavior control method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104965722A (en) * 2014-07-29 2015-10-07 腾讯科技(深圳)有限公司 Method and apparatus for displaying information
CN106528304A (en) * 2016-10-31 2017-03-22 努比亚技术有限公司 Shared adapter, configuration method and calling method and device thereof and mobile terminal
CN108958842A (en) * 2018-07-12 2018-12-07 北京猫眼文化传媒有限公司 The business plug-in unit application method of application program and application program
CN109582400A (en) * 2018-11-30 2019-04-05 北京小米移动软件有限公司 Routine call method and device
CN109710333A (en) * 2018-12-28 2019-05-03 上海掌门科技有限公司 Processing method, equipment and the computer readable storage medium of boarding application

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294710A1 (en) * 2006-06-19 2007-12-20 Alps Automotive Inc. Simple bluetooth software development kit
US9954874B2 (en) * 2014-10-07 2018-04-24 Symantec Corporation Detection of mutated apps and usage thereof
CN107465949B (en) * 2017-07-13 2019-06-14 彭茂笑 A kind of sharing method keeping multimedia messages real-time display on intelligent terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104965722A (en) * 2014-07-29 2015-10-07 腾讯科技(深圳)有限公司 Method and apparatus for displaying information
CN106528304A (en) * 2016-10-31 2017-03-22 努比亚技术有限公司 Shared adapter, configuration method and calling method and device thereof and mobile terminal
CN108958842A (en) * 2018-07-12 2018-12-07 北京猫眼文化传媒有限公司 The business plug-in unit application method of application program and application program
CN109582400A (en) * 2018-11-30 2019-04-05 北京小米移动软件有限公司 Routine call method and device
CN109710333A (en) * 2018-12-28 2019-05-03 上海掌门科技有限公司 Processing method, equipment and the computer readable storage medium of boarding application

Also Published As

Publication number Publication date
CN111400068A (en) 2020-07-10

Similar Documents

Publication Publication Date Title
CN111400068B (en) Interface control method and device, readable medium and electronic equipment
CN111581555B (en) Document loading method, device, equipment and storage medium
CN111367516B (en) Application interface generation method and device and electronic equipment
CN112256231B (en) Volume control method, device, terminal and storage medium
CN111324376B (en) Function configuration method, device, electronic equipment and computer readable medium
CN114595065A (en) Data acquisition method and device, storage medium and electronic equipment
WO2023174013A1 (en) Video memory allocation method and apparatus, and medium and electronic device
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
CN113518183B (en) Camera calling method and device and electronic equipment
CN113886105B (en) Cross-process calling method and device, storage medium and electronic equipment
CN111459893B (en) File processing method and device and electronic equipment
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN111258786B (en) Decoupling method, device, terminal and storage medium in layered architecture
CN113778566A (en) Native application calling method and device, electronic equipment and computer readable medium
CN111796865A (en) Byte code file modification method and device, terminal equipment and medium
CN112445820A (en) Data conversion method and device
CN111240738A (en) File processing method, device, equipment and medium
CN113448550B (en) Method and device for realizing collection management of classes, electronic equipment and computer medium
CN112346728B (en) Device adaptation method, apparatus, device and computer readable medium
CN111626787B (en) Resource issuing method, device, medium and equipment
CN112688863B (en) Gateway data processing method and device and electronic equipment
CN112486826B (en) Test method, test device, electronic equipment and computer readable medium
CN111562913B (en) Method, device and equipment for pre-creating view component and computer readable medium
CN116382804A (en) Application running method, device, medium and equipment

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