CN113391860A - Service request processing method and device, electronic equipment and computer storage medium - Google Patents

Service request processing method and device, electronic equipment and computer storage medium Download PDF

Info

Publication number
CN113391860A
CN113391860A CN202010167925.0A CN202010167925A CN113391860A CN 113391860 A CN113391860 A CN 113391860A CN 202010167925 A CN202010167925 A CN 202010167925A CN 113391860 A CN113391860 A CN 113391860A
Authority
CN
China
Prior art keywords
interface
target
class
implementation class
service request
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.)
Granted
Application number
CN202010167925.0A
Other languages
Chinese (zh)
Other versions
CN113391860B (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 CN202010167925.0A priority Critical patent/CN113391860B/en
Publication of CN113391860A publication Critical patent/CN113391860A/en
Application granted granted Critical
Publication of CN113391860B publication Critical patent/CN113391860B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • G06F9/4486Formation of subprogram jump address

Abstract

The present disclosure provides a service request processing method, apparatus, electronic device and computer-readable storage medium, the method comprising: acquiring a service request to be processed, wherein the service request carries a class object of an interface; determining a target interface based on the class object of the interface; determining a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relation; and performing corresponding business processing on the service request based on the target implementation class. According to the scheme disclosed by the invention, because the corresponding relation is the corresponding relation between the target interface and the target implementation class, when the implementation class is called, the name of the implementation class does not need to be known, and the corresponding implementation class can be called only by knowing which interface is called, so that the calling of the implementation class can be carried out without adopting a reflection mode, and the system performance is improved.

Description

Service request processing method and device, electronic equipment and computer storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a service request processing method and apparatus, an electronic device, and a computer storage medium.
Background
Reflection is a computer processing means that a program accesses, detects, and modifies its own state or behavior. In the prior art, a program generally calls an implementation class corresponding to a function module according to a name of the implementation class in a reflection mode, but the performance of calling the implementation class is poor in such a mode.
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 service request processing method, including:
acquiring a service request to be processed, wherein the service request carries a class object of an interface;
determining a target interface based on the class object of the interface;
determining a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, wherein the corresponding relationship is the corresponding relationship between the target interface and the target implementation class;
and performing corresponding business processing on the service request based on the target implementation class.
In a second aspect, the present disclosure provides a service request processing apparatus, including:
the request acquisition module is used for acquiring a service request to be processed, wherein the service request carries a class object of an interface;
the target interface determining module is used for determining a target interface based on the class object of the interface;
the target implementation class determining module is used for determining a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, wherein the corresponding relationship is the corresponding relationship between the target interface and the target implementation class;
and the business processing module is used for carrying out corresponding business processing on the service request based on the target implementation class.
In a third aspect, the present disclosure provides an electronic device comprising:
a processor and a memory;
a memory for storing computer operating instructions;
a processor for executing the method as shown in any embodiment of the first aspect of the present disclosure by invoking computer operation instructions.
In a fourth aspect, the present disclosure provides a computer readable storage medium having stored thereon at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement a method as set forth in any one of the embodiments of the first aspect of the present disclosure.
The technical scheme provided by the embodiment of the disclosure has the following beneficial effects:
when a service request to be processed is obtained, a target interface corresponding to the identifier can be determined based on a class object of an interface carried in the service request, based on the target interface, it can be known which interface the service request corresponds to, and then based on the target interface and a pre-established corresponding relationship, a target implementation class corresponding to the target interface can be determined, that is, based on the corresponding relationship, it can be determined which implementation class the service request is to call, and further, based on the implementation class, corresponding business processing is performed on the service request. In the scheme, because the corresponding relation is the corresponding relation between the target interface and the target implementation class, when the implementation class is called, the name of the implementation class does not need to be known, and the corresponding implementation class can be called only by knowing which interface is called, so that the calling of the implementation class can be carried out without adopting a reflection mode, and the system performance is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings used in the description of the embodiments of the present disclosure will be briefly described below.
Fig. 1 is a schematic flowchart of a service request processing method according to an embodiment of the present disclosure;
fig. 2 is a schematic structural diagram of a service request processing apparatus according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
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 are shown in the 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 rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the 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. Moreover, 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 "include" and variations thereof as used herein are 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". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing the devices, modules or units, and are not used for limiting the devices, modules or units to be different devices, modules or units, and also for limiting the sequence or interdependence relationship of the functions executed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The following describes the technical solutions of the present disclosure and how to solve the above technical problems in specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
In view of the above technical problem, an embodiment of the present disclosure provides a service request processing method, which may be executed by a user terminal, and as shown in fig. 1, the method may include:
step S110, obtain a service request to be processed, where the service request carries a class object of an interface.
Wherein the class object of the interface can be used to describe the interface, the interface can be understood as a special class, the class is an abstract concept and only represents a template of things, and no specific concept is available, such as 'girlfriend' or 'boyfriend'. An object is a specific entity that can be "seen, felt", and based on the class object of the interface, it can know which interface the service request wants to request.
The service request refers to a request for implementing a function, and based on the request, an implementation class corresponding to the request needs to be acquired, so that the function implemented by the request can be implemented based on the implementation class. An implementation class refers to code corresponding to implementing a function. The above functions may be understood as corresponding functions in an application, for example, playing music.
In this scenario, one service request typically corresponds to one interface.
Step S120, based on the class object of the interface, determining a target interface.
In practical applications, the identity of the interface may be identified by the interface identifier, and based on the class object of the interface, it may be determined which interface corresponds to the request of the service request, and based on the interface identifier, it may be determined which interface corresponds to the request of the service request.
Step S130, determining a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, where the corresponding relationship is a corresponding relationship between the target interface and the target implementation class.
And determining which interface corresponds to the service request and which implementation class corresponds to the interface, namely the target implementation class, based on the pre-established correspondence and the class object of the interface in the service request.
In practical application, the implementation class may be identified by the implementation class identifier, and the corresponding relationship may be a corresponding relationship between the interface identifier and the implementation class identifier.
Step S140, based on the target implementation class, corresponding service processing is performed on the service request.
The performing of the corresponding service processing on the service request based on the target implementation class means that the function of the request implementation corresponding to the service request can be implemented based on the target implementation class.
According to the scheme in the embodiment of the disclosure, when a service request to be processed is obtained, a target interface corresponding to an identifier can be determined based on a class object of an interface carried in the service request, based on the target interface, it can be known which interface the service request corresponds to, and then based on the target interface and a pre-established corresponding relationship, a target implementation class corresponding to the target interface can be determined, that is, based on the corresponding relationship, it can be determined which implementation class the service request is to call, and further, based on the implementation class, corresponding service processing is performed on the service request. In the scheme, because the corresponding relation is the corresponding relation between the target interface and the target implementation class, when the implementation class is called, the name of the implementation class does not need to be known, and the corresponding implementation class can be called only by knowing which interface is called, so that the calling of the implementation class can be carried out without adopting a reflection mode, and the system performance is improved.
In addition, according to the scheme, the scheme is interface-oriented rather than implementation-oriented, so that during development, only corresponding configuration is needed to be carried out on the interface without changing the implementation class, and development of research and development personnel can be facilitated.
In the embodiment of the present disclosure, the corresponding relationship is established in the following manner:
acquiring a byte code corresponding to a functional module, wherein the functional module corresponds to a service logic;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the byte code corresponding to the functional module;
and generating a mapping container class corresponding to the functional module based on the interface corresponding to the functional module and the implementation class corresponding to the interface, wherein the mapping container class stores the corresponding relation between the interface corresponding to the functional module and the implementation class corresponding to the interface.
In practical applications, if the mapping container class corresponding to each function module is generated based on the above-mentioned establishment manner of the correspondence, for convenience of management, the mapping container class corresponding to each function module may be generated into a large mapping container class. The method can be specifically realized by the following steps:
and generating a fused mapping container class based on the mapping container class corresponding to each functional module, wherein the fused mapping container class stores the corresponding relation between the corresponding interface of each functional module and the realization class corresponding to each interface.
For each function module, a mapping container class corresponding to each function module is generated based on a corresponding interface and implementation class of each function module, where the mapping container class may be referred to as a table, and then a fused mapping container class is generated based on the mapping container class corresponding to each function module, where the mapping container class may be referred to as a map. And obtaining the corresponding relation between the corresponding interfaces of the functional modules and the implementation classes corresponding to the interfaces based on the fused mapping container class.
The method comprises the steps that byte codes corresponding to all functional modules can be collected based on an ASM byte code processing framework, the ASM is a java byte code manipulation framework, the ASM byte code processing framework is used for processing class files, and the processed byte codes can be converted into classes. The bytecode corresponding to each function module may be collected based on the ASM, and then the bytecode corresponding to each function module is processed to obtain the mapping container class corresponding to each function module.
It can be understood that the corresponding relationship may be established by other terminal devices, where the other terminal devices are terminal devices that distinguish the user terminal corresponding to the scheme of the present application, and after the corresponding relationship is established on the other terminal devices, the corresponding relationship may be invoked through interaction between the user terminal and the other terminal devices.
In the embodiment of the present disclosure, generating a mapping container class corresponding to the function module based on the interface corresponding to the function module and the implementation class corresponding to the interface includes:
obtaining class annotation information corresponding to the functional module;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the class annotation information;
taking the interface as a key and the implementation class as a Value, and establishing a corresponding relation between the key and the Value;
and generating a mapping container class corresponding to the functional module based on the corresponding relation between the key and the Value.
The class annotation information may be used to identify which interface and which implementation class correspond to the function module, and based on the class annotation information corresponding to the function module, for example, the class annotation information is @ ServiceImpl, the interface corresponding to the function module and the implementation class corresponding to the interface may be determined. The interface is used as a key, the implementation class is used as a Value, and a k-v corresponding relation is established, that is, a mapping relation between one interface and the implementation class of the interface can be represented by a key-Value pair.
The class annotation information can be obtained from the byte code corresponding to the functional module.
It can be understood that, if the interface has a corresponding interface identifier and the implementation class has a corresponding implementation class identifier, in the correspondence between the key and the Value, the interface identifier may be used as the key, and the implementation class identifier may be used as the Value.
Optionally, the type annotation information corresponding to each functional module may be collected and processed by an APT (association Processing tool) -based annotation processor, and one functional module may correspond to one APT annotation processor.
In an embodiment of the present disclosure, the method further includes:
generating a target packaging class corresponding to the target implementation class based on the target implementation class, wherein the target packaging class corresponds to a target packaging interface;
correspondingly, the corresponding relationship may include a first corresponding relationship between the target interface and a target package interface corresponding to the target interface, and a second corresponding relationship between the target package interface and the target implementation class;
correspondingly, the determining the target implementation class corresponding to the service request based on the target interface and the pre-established corresponding relationship includes:
determining a target packaging interface corresponding to the target interface based on the target interface and the first corresponding relation;
and determining a target implementation class corresponding to the service request based on the target packaging interface and the second corresponding relation.
Specifically, in order not to directly access the target implementation class, a target packaging class may be correspondingly set for each target implementation class, where the target packaging class is equivalent to an outer package of the target implementation class, the target packaging class corresponds to a target packaging interface, and the target packaging class may be accessed through the target packaging interface. In an alternative, the packaging interface may also correspond to a packaging interface identifier, and the identity of the packaging interface is identified by the packaging interface identifier. The corresponding relationship may include a first corresponding relationship between the interface identifier of the target interface and the identifier of the target packaging interface, and a second corresponding relationship between the identifier of the target packaging interface corresponding to the target interface and the target implementation class identifier.
In addition, the package class is accessed first, then the implementation class is accessed, so that lazy loading can be avoided, namely the package class is compiled instead of the implementation class during initialization, and the calculation amount of compiling the package class is less than that of compiling the implementation class, so that resources can be saved during initialization.
Wherein, if each implementation class corresponds to a package class, the correspondence described above may include a first correspondence between the interface identifier of each interface and the identifier of the package interface corresponding to each interface, and a second corresponding relationship between the identifier of the packaging interface corresponding to each interface and the implementation class identifier corresponding to each interface, when the target implementation class identifier corresponding to the service request is determined based on the target interface identifier and the pre-established corresponding relationship, the target packaging interface identifier corresponding to the target interface identifier may be determined based on the target interface identifier and the first corresponding relationship, namely which target packaging interface corresponds to the target interface, then determining the target implementation class identifier corresponding to the service request based on the target packaging interface identifier and the second corresponding relation, i.e. which wrapper class the target wrapper interface corresponds to, and which implementation class (target implementation class) the wrapper class corresponds to.
In the embodiment of the present disclosure, if the service request further includes a service parameter, based on the target implementation class, performing corresponding service processing on the service request includes:
transmitting the service parameters to a target implementation class through a target packaging interface;
and performing corresponding business processing on the service request based on the target implementation class containing the service parameters.
The method supports the transmission of service parameters when each implementation class has a corresponding packaging class, and specifically means that the method can transmit the service parameters to functions in the implementation classes through corresponding packaging interfaces, the service parameters serve as variables of the functions, and different results corresponding to the functions can be obtained based on different service parameters. If the service request includes the service parameter, the service parameter may be transmitted to the target implementation class through the corresponding packaging class (the target packaging class corresponding to the target packaging class interface), and then corresponding service processing may be performed on the service request based on the target implementation class including the service parameter. If the service parameter is not included, corresponding business processing can be directly carried out on the service request based on the target implementation class.
In the disclosed scheme, based on the class annotation information @ ServiceImpl, when the method supports service parameter delivery, the class annotation information is changed to @ ServiceImplParam, and the mark function is annotated by using @ ServiceImplProvider, and the function can be a private constructor a non-constructor.
In the embodiment of the present disclosure, the service parameter is an Object array.
After the service parameters are transmitted to the target implementation class, verification can be performed, corresponding service processing is performed on the service request based on the target implementation class containing the service parameters after the verification is passed, and corresponding service processing is not performed if the verification is not passed.
In the embodiment of the present disclosure, the implementation classes include a singleton implementation class and a non-singleton implementation class, and when the target implementation class is the singleton implementation class, determining the target implementation class corresponding to the service request based on the target package interface and the second correspondence includes:
and determining a target implementation class corresponding to the service request through a set function based on the target packaging interface and the second corresponding relation.
Wherein, a singleton refers to an implementation class that can be compiled only once in a cycle, and a singleton refers to an implementation class that can be compiled multiple times in a cycle. If the single instance implementation class is adopted, direct compiling cannot be carried out, and the corresponding target implementation class needs to be called through a set function. If the service request is a non-singleton implementation class, the compiling can be directly carried out, and the target implementation class corresponding to the service request can be determined based on the target packaging interface and the second corresponding relation. Wherein the set function may be a get function.
Based on the same principle as the service request processing method shown in fig. 1, an embodiment of the present disclosure also provides a service request processing apparatus 20, as shown in fig. 2, where the apparatus 20 may include: a request acquisition module 210, a target interface determination module 220, a target implementation class determination module 230, and a service processing module 240, wherein,
a request obtaining module 210, configured to obtain a service request to be processed, where the service request carries a class object of an interface;
a target interface determining module 220, configured to determine a target interface based on the class object of the interface;
a target implementation class determining module 230, configured to determine a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, where the corresponding relationship is a corresponding relationship between the target interface and the target implementation class;
and the service processing module 240 is configured to perform corresponding service processing on the service request based on the target implementation class.
The service request processing apparatus of the embodiment of the disclosure, when acquiring a service request to be processed, may determine a target interface corresponding to the identifier based on a class object of an interface carried in the service request, and based on the target interface, may know which interface the service request corresponds to, and then based on the target interface and a pre-established correspondence, may determine a target implementation class corresponding to the target interface, that is, based on the correspondence, may determine which implementation class the service request is intended to call, and further, based on the implementation class, perform corresponding service processing on the service request. In the scheme, because the corresponding relation is the corresponding relation between the target interface and the target implementation class, when the implementation class is called, the name of the implementation class does not need to be known, and the corresponding implementation class can be called only by knowing which interface is called, so that the calling of the implementation class can be carried out without adopting a reflection mode, and the system performance is improved.
Optionally, the apparatus further includes a corresponding relationship establishing module, where the corresponding relationship establishing module is configured to:
acquiring a byte code corresponding to a functional module, wherein the functional module corresponds to a service logic;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the byte code corresponding to the functional module;
and generating a mapping container class corresponding to the functional module based on the interface corresponding to the functional module and the implementation class corresponding to the interface, wherein the mapping container class stores the corresponding relation between the interface corresponding to the functional module and the implementation class corresponding to the interface.
Optionally, when the mapping container class corresponding to the functional module is generated based on the interface corresponding to the functional module and the implementation class corresponding to the interface, the correspondence establishing module is specifically configured to:
acquiring class annotation information corresponding to the functional module;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the class annotation information;
taking the interface as a key, taking the implementation class as a Value, and establishing a corresponding relation between the key and the Value;
and generating a mapping container class corresponding to the functional module based on the corresponding relation between the key and the Value.
Optionally, the apparatus further comprises:
the package generation module is used for generating a target package class corresponding to the target implementation class based on the target implementation class, and the target package class corresponds to a target package interface;
the corresponding relationship includes a first corresponding relationship between the target interface and the target package interface, and a second corresponding relationship between the target package interface and the target implementation class, and the target implementation class determining module is specifically configured to, when determining the target implementation class corresponding to the service request based on the target interface and the pre-established corresponding relationship:
determining a target packaging interface corresponding to the target interface based on the target interface and the first corresponding relation;
and determining a target implementation class corresponding to the service request based on the target packaging interface and the second corresponding relation.
Optionally, if the service request further includes a service parameter, the service processing module is specifically configured to, when performing corresponding service processing on the service request based on the target implementation class:
transmitting the service parameters to a target implementation class through a target packaging interface;
and performing corresponding business processing on the service request based on the target implementation class containing the service parameters.
Optionally, the service parameter is an Object array.
Optionally, the implementation class includes a singleton implementation class and a non-singleton implementation class, and when the target implementation class is the singleton implementation class, the service processing module is specifically configured to, when determining the target implementation class corresponding to the service request based on the target wrapper interface and the second correspondence:
and determining a target implementation class corresponding to the service request through a set function based on the target packaging interface and the second corresponding relation.
The apparatus of the embodiment of the present disclosure may execute a service request processing method shown in fig. 1, and the implementation principles thereof are similar, the actions executed by the modules in the service request processing apparatus in the embodiments of the present disclosure correspond to the steps in the service request processing method in the embodiments of the present disclosure, and for the detailed functional description of the modules in the service request processing apparatus, reference may be specifically made to the description in the corresponding service request processing method shown in the foregoing, which is not described herein again.
Based on the same principle as the method in the embodiment of the present disclosure, reference is made to fig. 3, which shows a schematic structural diagram of an electronic device (e.g., a terminal device in fig. 1) 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiments of the present disclosure 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 vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The electronic device includes: a memory and a processor, wherein the processor may be referred to as the processing device 601 hereinafter, and the memory may include at least one of a Read Only Memory (ROM)602, a Random Access Memory (RAM)603 and a storage device 608 hereinafter, which are specifically shown as follows:
as shown in fig. 3, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 3 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present 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 contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (Hyper Text Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications 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 network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled 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: receiving a triggering operation of a user aiming at an image area in a video frame image of a currently played video through a video playing interface; if the video frame image contains the designated object and the image area is the designated area corresponding to the designated object, generating an object information acquisition request aiming at the designated object; based on the object information acquisition request, link information of the specified object is acquired and displayed.
Computer program code for carrying out operations for the present disclosure may be written in any combination of 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart 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 or units described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the designation of a module or unit does not in some cases constitute a limitation of the unit itself.
The functions described herein above 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: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), 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. A 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 one ] there is provided a service request processing method, including:
acquiring a service request to be processed, wherein the service request carries a class object of an interface;
determining the target interface based on the class object of the interface;
determining a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, wherein the corresponding relationship is the corresponding relationship between the target interface and the target implementation class;
and performing corresponding business processing on the service request based on the target implementation class.
According to one or more embodiments of the present disclosure, the correspondence is established by:
acquiring a byte code corresponding to a functional module, wherein the functional module corresponds to a service logic;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the bytecode corresponding to the functional module;
and generating a mapping container class corresponding to the functional module based on the interface corresponding to the functional module and the implementation class corresponding to the interface, wherein the mapping container class stores the corresponding relation between the interface corresponding to the functional module and the implementation class corresponding to the interface.
According to one or more embodiments of the present disclosure, the generating a mapping container class corresponding to the function module based on the interface corresponding to the function module and the implementation class corresponding to the interface includes:
acquiring class annotation information corresponding to the functional module;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the class annotation information;
taking the interface as a key, taking the implementation class as a Value, and establishing a corresponding relation between the key and the Value;
and generating a mapping container class corresponding to the functional module based on the corresponding relation between the key and the Value.
In accordance with one or more embodiments of the present disclosure, the method further comprises:
generating a target packaging class corresponding to the target implementation class based on the target implementation class, wherein the target packaging class corresponds to a target packaging interface;
the determining, based on the target interface and a pre-established correspondence, a target implementation class corresponding to the service request includes:
determining a target packaging interface corresponding to the target interface based on the target interface and the first corresponding relation;
and determining a target implementation class corresponding to the service request based on the target packaging interface and the second corresponding relation.
According to one or more embodiments of the present disclosure, if the service request further includes a service parameter, the performing, based on the target implementation class, a corresponding service process on the service request includes:
transmitting the service parameters to the target implementation class through the target wrapper interface;
and performing corresponding business processing on the service request based on the target implementation class containing the service parameters.
According to one or more embodiments of the present disclosure, the service parameter is an Object array.
According to one or more embodiments of the present disclosure, the determining a target implementation class corresponding to the service request based on the target wrapper interface and the second corresponding relationship when the target implementation class is a singleton implementation class includes:
and determining a target implementation class corresponding to the service request through a set function based on the target packaging interface and the second corresponding relation.
According to one or more embodiments of the present disclosure, [ example two ] there is provided a service request processing apparatus comprising:
the request acquisition module is used for acquiring a service request to be processed, wherein the service request carries a class object of an interface;
the target interface determining module is used for determining the target interface based on the class object of the interface;
a target implementation class determining module, configured to determine a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, where the corresponding relationship is a corresponding relationship between the target interface and the target implementation class;
and the business processing module is used for carrying out corresponding business processing on the service request based on the target implementation class.
According to one or more embodiments of the present disclosure, the apparatus further includes a correspondence relationship establishing module, where the correspondence relationship establishing module is configured to:
acquiring a byte code corresponding to a functional module, wherein the functional module corresponds to a service logic;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the bytecode corresponding to the functional module;
and generating a mapping container class corresponding to the functional module based on the interface corresponding to the functional module and the implementation class corresponding to the interface, wherein the mapping container class stores the corresponding relation between the interface corresponding to the functional module and the implementation class corresponding to the interface.
According to one or more embodiments of the present disclosure, when the mapping container class corresponding to the functional module is generated based on the interface corresponding to the functional module and the implementation class corresponding to the interface, the correspondence establishing module is specifically configured to:
acquiring class annotation information corresponding to the functional module;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the class annotation information;
taking the interface as a key, taking the implementation class as a Value, and establishing a corresponding relation between the key and the Value;
and generating a mapping container class corresponding to the functional module based on the corresponding relation between the key and the Value.
According to one or more embodiments of the present disclosure, the apparatus further comprises:
the package generation module is used for generating a target package class corresponding to the target implementation class based on the target implementation class, and the target package class corresponds to a target package interface;
the corresponding relationship includes a first corresponding relationship between the target interface and the target package interface, and a second corresponding relationship between the target package interface and the target implementation class, and the target implementation class determining module is specifically configured to, when determining the target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship:
determining a target packaging interface corresponding to the target interface based on the target interface and the first corresponding relation;
and determining a target implementation class corresponding to the service request based on the target packaging interface and the second corresponding relation.
According to one or more embodiments of the present disclosure, if the service request further includes a service parameter, the service processing module is specifically configured to, when performing corresponding service processing on the service request based on the target implementation class:
transmitting the service parameters to the target implementation class through the target wrapper interface;
and performing corresponding business processing on the service request based on the target implementation class containing the service parameters.
According to one or more embodiments of the present disclosure, the service parameter is an Object array.
According to one or more embodiments of the present disclosure, the implementation class includes a singleton implementation class and a non-singleton implementation class, and when the target implementation class is the singleton implementation class, the service processing module is specifically configured to, when determining the target implementation class corresponding to the service request based on the target wrapper interface and the second correspondence:
and determining a target implementation class corresponding to the service request through a set function based on the target packaging interface and the second corresponding relation.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while 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. Under 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 limitations on the scope of the 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 disclosed as example forms of implementing the claims.

Claims (10)

1. A method for processing a service request, comprising:
acquiring a service request to be processed, wherein the service request carries a class object of an interface;
determining the target interface based on the class object of the interface;
determining a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, wherein the corresponding relationship is the corresponding relationship between the target interface and the target implementation class;
and performing corresponding business processing on the service request based on the target implementation class.
2. The method according to claim 1, wherein the correspondence is established by:
acquiring a byte code corresponding to a functional module, wherein the functional module corresponds to a service logic;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the bytecode corresponding to the functional module;
and generating a mapping container class corresponding to the functional module based on the interface corresponding to the functional module and the implementation class corresponding to the interface, wherein the mapping container class stores the corresponding relation between the interface corresponding to the functional module and the implementation class corresponding to the interface.
3. The method according to claim 2, wherein the generating a mapping container class corresponding to the function module based on the interface corresponding to the function module and the implementation class corresponding to the interface comprises:
acquiring class annotation information corresponding to the functional module;
determining an interface corresponding to the functional module and an implementation class corresponding to the interface based on the class annotation information;
taking the interface as a key, taking the implementation class as a Value, and establishing a corresponding relation between the key and the Value;
and generating a mapping container class corresponding to the functional module based on the corresponding relation between the key and the Value.
4. The method according to any one of claims 1 to 3, further comprising:
generating a target packaging class corresponding to the target implementation class based on the target implementation class, wherein the target packaging class corresponds to a target packaging interface;
the determining, based on the target interface and a pre-established correspondence, a target implementation class corresponding to the service request includes:
determining a target packaging interface corresponding to the target interface based on the target interface and the first corresponding relation;
and determining a target implementation class corresponding to the service request based on the target packaging interface and the second corresponding relation.
5. The method according to claim 4, wherein if the service request further includes a service parameter, performing corresponding service processing on the service request based on the target implementation class includes:
transmitting the service parameters to the target implementation class through the target wrapper interface;
and performing corresponding business processing on the service request based on the target implementation class containing the service parameters.
6. The method of claim 5, wherein the service parameter is an Object array.
7. The method of claim 4, wherein if the target implementation class is a singleton implementation class, the determining the target implementation class corresponding to the service request based on the target wrapper interface and the second correspondence comprises:
and determining a target implementation class corresponding to the service request through a set function based on the target packaging interface and the second corresponding relation.
8. A service request processing apparatus, comprising:
the request acquisition module is used for acquiring a service request to be processed, wherein the service request carries a class object of an interface;
the target interface determining module is used for determining the target interface based on the class object of the interface;
a target implementation class determining module, configured to determine a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relationship, where the corresponding relationship is a corresponding relationship between the target interface and the target implementation class;
and the business processing module is used for carrying out corresponding business processing on the service request based on the target implementation class.
9. An electronic device, comprising:
a processor and a memory;
the memory is used for storing computer operation instructions;
the processor is used for executing the method of any one of claims 1 to 7 by calling the computer operation instruction.
10. A computer readable storage medium storing at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the method of any one of claims 1 to 7.
CN202010167925.0A 2020-03-11 2020-03-11 Service request processing method and device, electronic equipment and computer storage medium Active CN113391860B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010167925.0A CN113391860B (en) 2020-03-11 2020-03-11 Service request processing method and device, electronic equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010167925.0A CN113391860B (en) 2020-03-11 2020-03-11 Service request processing method and device, electronic equipment and computer storage medium

Publications (2)

Publication Number Publication Date
CN113391860A true CN113391860A (en) 2021-09-14
CN113391860B CN113391860B (en) 2024-01-30

Family

ID=77615407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010167925.0A Active CN113391860B (en) 2020-03-11 2020-03-11 Service request processing method and device, electronic equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN113391860B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114756309A (en) * 2022-06-14 2022-07-15 苏州万店掌网络科技有限公司 Service calling method, framework, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726014A (en) * 2018-12-29 2019-05-07 武汉斗鱼网络科技有限公司 Implementation method, system, server and storage medium of the Rpc client based on Netty in Testing Platform
CN109756461A (en) * 2017-11-06 2019-05-14 北京航天长峰科技工业集团有限公司 A kind of remote procedure calling (PRC) method based on NETTY
CN110704200A (en) * 2018-07-09 2020-01-17 北京京东尚科信息技术有限公司 Method and device for converting call interface
CN110764748A (en) * 2019-10-23 2020-02-07 北京字节跳动网络技术有限公司 Code calling method, device, terminal and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109756461A (en) * 2017-11-06 2019-05-14 北京航天长峰科技工业集团有限公司 A kind of remote procedure calling (PRC) method based on NETTY
CN110704200A (en) * 2018-07-09 2020-01-17 北京京东尚科信息技术有限公司 Method and device for converting call interface
CN109726014A (en) * 2018-12-29 2019-05-07 武汉斗鱼网络科技有限公司 Implementation method, system, server and storage medium of the Rpc client based on Netty in Testing Platform
CN110764748A (en) * 2019-10-23 2020-02-07 北京字节跳动网络技术有限公司 Code calling method, device, terminal and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114756309A (en) * 2022-06-14 2022-07-15 苏州万店掌网络科技有限公司 Service calling method, framework, device and storage medium

Also Published As

Publication number Publication date
CN113391860B (en) 2024-01-30

Similar Documents

Publication Publication Date Title
CN111581563B (en) Page response method and device, storage medium and electronic equipment
CN111581555B (en) Document loading method, device, equipment and storage medium
CN111459364B (en) Icon updating method and device and electronic equipment
CN111930534A (en) Data calling method and device and electronic equipment
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN111625422B (en) Thread monitoring method, thread monitoring device, electronic equipment and computer readable storage medium
CN111596991A (en) Interactive operation execution method and device and electronic equipment
CN114595065A (en) Data acquisition method and device, storage medium and electronic equipment
CN110377273B (en) Data processing method, device, medium and electronic equipment
CN114625536A (en) Video memory allocation method, device, medium and electronic equipment
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
CN111400068B (en) Interface control method and device, readable medium and electronic equipment
CN111324376B (en) Function configuration method, device, electronic equipment and computer readable medium
CN111596992B (en) Navigation bar display method and device and electronic equipment
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN110619101B (en) Method and apparatus for processing information
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN111240801A (en) Method, device, medium and electronic equipment for generating heap memory snapshot file
CN111209205A (en) Configuration method and device and electronic equipment
CN113778566A (en) Native application calling method and device, electronic equipment and computer readable medium
CN113518183A (en) Camera calling method and device and electronic equipment
CN112230986A (en) Project file generation method and device, electronic equipment and computer readable medium
CN111258786A (en) Decoupling method and device in layered architecture, terminal and storage medium
CN111399730A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN111240657A (en) Method and device for generating SDK and electronic 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
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant