CN113391860B - 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
CN113391860B
CN113391860B CN202010167925.0A CN202010167925A CN113391860B CN 113391860 B CN113391860 B CN 113391860B CN 202010167925 A CN202010167925 A CN 202010167925A CN 113391860 B CN113391860 B CN 113391860B
Authority
CN
China
Prior art keywords
target
interface
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.)
Active
Application number
CN202010167925.0A
Other languages
Chinese (zh)
Other versions
CN113391860A (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.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision 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 Douyin Vision Co Ltd filed Critical Douyin Vision 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

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 carrying out corresponding business processing on the service request based on the target implementation class. According to the scheme, 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 is not required to be known, and only the interface which is required to be called, so that the implementation class can be called 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 disclosure relates to the technical field of computers, and in particular relates to a service request processing method, a device, electronic equipment and a computer storage medium.
Background
Reflection is a form of computer processing that refers to a program accessing, detecting, and modifying its own state or behavior. In the prior art, the program generally calls the implementation class corresponding to the function module according to the name of the implementation class in a reflection mode, but the performance of calling the implementation class is poor in the 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 relation, wherein the corresponding relation is the corresponding relation between the target interface and the target implementation class;
and carrying out 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 relation, wherein the corresponding relation is the corresponding relation between the target interface and the target implementation class;
and the service processing module is used for carrying out corresponding service 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 performing the method as shown in any of the embodiments of the first aspect of the present disclosure by invoking computer operating instructions.
In a fourth aspect, the present disclosure provides a computer readable storage medium storing at least one instruction, at least one program, code set, or instruction set, the at least one instruction, at least one program, code set, or instruction set being loaded and executed by a processor to implement a method as shown in any of the embodiments of the first aspect of the present disclosure.
The technical scheme provided by the embodiment of the disclosure has the beneficial effects that:
according to the service request processing method, the device, the electronic equipment and the computer storage medium, when the service request to be processed is acquired, the target interface corresponding to the identifier can be determined based on the class object of the interface carried in the service request, which interface the service request corresponds to want to access can be known based on the target interface, then the target implementation class corresponding to the target interface can be determined based on the target interface and the pre-established corresponding relation, namely which implementation class is wanted to be called can be determined based on the corresponding relation, and further, corresponding service processing is performed on the service request based on the implementation class. In the scheme, the corresponding relation is the corresponding relation between the target interface and the target implementation class, so that the name of the implementation class is not required to be known when the implementation class is called, and the corresponding implementation class can be called only by knowing which interface is required to be called, and therefore, the implementation class can be called in 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 that are required to be used in the description of the embodiments of the present disclosure will be briefly introduced below.
Fig. 1 is a flow chart of a service request processing method according to an embodiment of the disclosure;
fig. 2 is a schematic structural diagram of a service request processing device 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 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 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 used merely to distinguish one device, module, or unit from another device, module, or unit, and are not intended to limit the order or interdependence of the 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 following describes the technical solutions of the present disclosure and how the technical solutions of the present disclosure solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
In view of the foregoing technical problems, a method for processing a service request according to an embodiment of the present disclosure may be performed by a user terminal, as shown in fig. 1, and may include:
Step S110, a service request to be processed is obtained, wherein the service request carries class objects of interfaces.
Wherein, the class object of the interface can be used for describing 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 exists, such as ' girlfriend ', ' men's friend '. An object is a specific entity that can be "seen" and "touched", and based on the class object of the interface, it is possible to know which interface the service request wants to request.
The service request refers to a request for realizing a function, and based on the request, an implementation class corresponding to the request needs to be acquired, so that the function from the request to the implementation can be realized based on the implementation class. The implementation class refers to code corresponding to implementing a function. The above-mentioned functions are understood to be corresponding functions in a certain application, such as playing music, etc.
In this scenario, a service request typically corresponds to an interface.
Step S120, determining a target interface based on the class object of the interface.
In practical application, the identity of the interface can be identified through the interface identifier, and then based on the class object of the interface, the interface identifier corresponding to which interface is requested corresponding to the service request can be determined, and based on the interface identifier, the interface corresponding to the service request is determined.
Step S130, determining a target implementation class corresponding to the service request based on the target interface and a pre-established corresponding relation, wherein the corresponding relation is the corresponding relation 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 corresponding relation and the class object of the interface in the service request.
In practical application, the implementation class can be identified by the implementation class identification, and the corresponding relationship can be the corresponding relationship between the interface identification and the implementation class identification.
Step S140, based on the target realization class, corresponding business processing is carried out on the service request.
The corresponding business processing of the service request based on the target implementation class means that the function of realizing the request corresponding to the service request can be realized based on the target implementation class.
According to the scheme in the embodiment of the disclosure, when the service request to be processed is acquired, a target interface corresponding to the identifier can be determined based on the class object of the interface carried in the service request, which interface the service request corresponds to want to access can be known based on the target interface, then, based on the target interface and the pre-established corresponding relation, a target implementation class corresponding to the target interface can be determined, namely, which implementation class is want to be called can be determined based on the corresponding relation, and further, based on the implementation class, corresponding service processing is performed on the service request. In the scheme, the corresponding relation is the corresponding relation between the target interface and the target implementation class, so that the name of the implementation class is not required to be known when the implementation class is called, and the corresponding implementation class can be called only by knowing which interface is required to be called, and therefore, the implementation class can be called in a reflection mode, and the system performance is improved.
In addition, as can be seen from the scheme, the scheme is interface-oriented rather than implementation-oriented, so that when in development, only the interfaces are required to be correspondingly configured, and the implementation-oriented is not required to be changed, thereby being convenient for development of research personnel.
In the embodiment of the disclosure, the correspondence is established by:
acquiring byte codes corresponding to a functional module, wherein the functional module corresponds to a business 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;
based on the interface corresponding to the functional module and the implementation class corresponding to the interface, generating a mapping container class corresponding to the functional module, 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 application, if the mapping container class corresponding to each functional module is generated based on the establishment mode of the corresponding relation, for convenience of management, a large mapping container class can be generated by the mapping container class corresponding to each functional module. The method is realized by the following steps:
based on the mapping container class corresponding to each functional module, generating a fused mapping container class, wherein the fused mapping container class stores the corresponding relation between the interfaces corresponding to each functional module and the implementation classes corresponding to each interface.
For each functional module, a mapping container class corresponding to each functional module may be generated based on an interface and an implementation class corresponding to each functional module, where the mapping container class may be called a table, and then a fused mapping container class may be generated based on a mapping container class corresponding to each functional module, where the mapping container class may be called a map. Based on the fused mapping container class, the corresponding relation between the interfaces corresponding to the functional modules and the implementation classes corresponding to the interfaces can be obtained.
The ASM is a java byte code manipulation framework, the ASM byte code processing framework processes class files, and the processed byte codes can be converted into classes. The bytecode corresponding to each functional module may be collected based on the ASM, and then the bytecode corresponding to each functional module may be processed to obtain a mapping container class corresponding to each functional module.
It can be understood that the correspondence 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 correspondence is established on the other terminal devices, the correspondence may be invoked through interaction between the user terminal and the other terminal devices.
In an embodiment of the present disclosure, generating, based on an interface corresponding to the functional module and an implementation class corresponding to the interface, a mapping container class corresponding to the functional module includes:
obtaining class annotation information corresponding to the functional module;
based on class annotation information, determining an interface corresponding to the functional module and an implementation class corresponding to the interface;
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.
The class annotation information may be used to identify which interface and which implementation class corresponds to the functional module, and then, based on the class annotation information corresponding to the functional module, for example, the class annotation information is @ serviceinformation, the interface corresponding to the functional module and the implementation class corresponding to the interface may be determined. And taking the interface as a key, taking the implementation class as a Value, and establishing a k-v corresponding relation, namely, representing the mapping relation between one interface and the implementation class of the interface through a key Value pair.
The class annotation information can be obtained from byte codes corresponding to the functional modules.
It can be understood that if the interface has a corresponding interface identifier and the implementation class has a corresponding implementation class identifier, the interface identifier may be used as a key and the implementation class identifier may be used as a Value in the corresponding relationship between the key and the Value.
Alternatively, class annotation information corresponding to each functional module may be collected and processed based on APT (Annotation Processing Tool) annotation processor, and one functional module may correspond to one APT annotation processor.
In an embodiment 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;
correspondingly, the corresponding relation can comprise a first corresponding relation between the target interface and the target packaging interface corresponding to the target interface and a second corresponding relation between the target packaging 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 relation comprises the following steps:
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 package class may be set for each target implementation class, where the target package class corresponds to an outer package of the target implementation class, and the target package class corresponds to a target package interface through which the corresponding target package class may be accessed. In an alternative, the package interface may also correspond to a package interface identifier, where the identity of the package interface is identified by the package interface identifier. The correspondence may include a first correspondence between an interface identifier of the target interface and an identifier of the target packaging interface, and a second correspondence between an identifier of the target packaging interface corresponding to the target interface and an identifier of the target implementation class.
In addition, the packaging class is accessed first and then the implementation class is accessed, so that lazy loading can be avoided, namely, when the packaging class is compiled instead of the implementation class, the compiling packaging is less in calculation amount than the compiling implementation class, and therefore, resources can be saved when the packaging class is initialized.
If each implementation class corresponds to one package class, the correspondence described above may include a first correspondence between an interface identifier of each interface and an identifier of a package interface corresponding to each interface, and a second correspondence between an identifier of a package interface corresponding to each interface and an implementation class identifier corresponding to each interface, when determining, based on the target interface identifier and a pre-established correspondence, a target implementation class identifier corresponding to the service request, a target package interface identifier corresponding to the target interface identifier, that is, which target package interface corresponds to the target interface, may be determined first based on the target interface identifier and the first correspondence, and then, based on the target package interface identifier and the second correspondence, a target implementation class identifier corresponding to the service request, that is, which package class corresponds to the target package interface, and which implementation class (target implementation class) corresponds to the package class may be determined.
In an embodiment of the present disclosure, if the service request further includes a service parameter, performing corresponding service processing on the service request based on a target implementation class, including:
transmitting the service parameters to a target implementation class through a target packaging interface;
and carrying out corresponding business processing on the service request based on the target implementation class containing the service parameters.
When each implementation class has a corresponding packaging class, the method supports the transmission of service parameters, specifically, the method can transmit the service parameters to functions in the implementation class 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 transferred to the target implementation class through the corresponding wrapper class (the target wrapper class corresponding to the target wrapper class interface), and then the service request is subjected to corresponding service processing based on the target implementation class including the service parameter. If the service parameters are not included, the service request can be processed correspondingly based on the target implementation class directly.
In the disclosed scheme, based on the class annotation information @ serviceoil, when the method supports service parameter transfer, the class annotation information is changed to @ serviceoil Param, and an @ serviceoil provider annotation tag function is used, wherein the function can be a private constructor or non-constructor.
In an embodiment of the present disclosure, the service parameter is an Object array.
After the service parameters are transferred to the target implementation class, checking can be performed first, after the service parameters pass the checking, corresponding service processing is performed on the service request based on the target implementation class containing the service parameters, and if the service parameters do not pass the checking, the corresponding service processing is not performed.
In the embodiment of the disclosure, the implementation classes include a single-instance implementation class and a non-single-instance implementation class, and when the target implementation class is the single-instance implementation class, determining, based on the target packaging interface and the second correspondence, the target implementation class corresponding to the service request 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.
Where a single instance refers to an implementation class that can only be compiled once in one cycle, and a non-single instance refers to an implementation class that can be compiled multiple times in one cycle. If the target implementation class is a single-instance implementation class, the target implementation class can not be directly compiled and needs to be called through a set function. If the service request is a non-single instance implementation class, compiling can be directly performed, 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, there is also provided in an embodiment of the present disclosure a service request processing apparatus 20, as shown in fig. 2, 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 traffic processing module 240, wherein,
a request acquisition module 210, configured to acquire 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;
the target implementation class determining module 230 is configured to determine a target implementation class corresponding to the service request based on the target interface and a pre-established correspondence, where the correspondence is a correspondence between the target interface and the target implementation class;
the service processing module 240 is configured to perform corresponding service processing on the service request based on the target implementation class.
When the service request processing device of the embodiment of the disclosure obtains the service request to be processed, the target interface corresponding to the identifier can be determined based on the class object of the interface carried in the service request, which interface the service request corresponds to want to access can be known based on the target interface, then the target implementation class corresponding to the target interface can be determined based on the target interface and the pre-established corresponding relation, namely which implementation class is wanted to be called can be determined based on the corresponding relation, and further, corresponding service processing is performed on the service request based on the implementation class. In the scheme, the corresponding relation is the corresponding relation between the target interface and the target implementation class, so that the name of the implementation class is not required to be known when the implementation class is called, and the corresponding implementation class can be called only by knowing which interface is required to be called, and therefore, the implementation class can be called in a reflection mode, and the system performance is improved.
Optionally, the device further includes a correspondence establishing module, where the correspondence establishing module is configured to:
acquiring byte codes corresponding to a functional module, wherein the functional module corresponds to a business 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;
based on the interface corresponding to the functional module and the implementation class corresponding to the interface, generating a mapping container class corresponding to the functional module, 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, the correspondence relation establishing module is specifically configured to, when generating the 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:
obtaining class annotation information corresponding to the functional module;
based on class annotation information, determining an interface corresponding to the functional module and an implementation class corresponding to the interface;
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 class generation module is used for generating a target package class corresponding to the target implementation class based on the target implementation class, wherein the target package class corresponds to a target package interface;
the corresponding relation comprises a first corresponding relation between the target interface and the target packaging interface and a second corresponding relation between the target packaging interface and the target implementation class, and the target implementation class determining module is specifically used for determining the target implementation class corresponding to the service request when determining the target implementation class based on the target interface and the pre-established corresponding relation:
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:
transmitting the service parameters to a target implementation class through a target packaging interface;
and carrying out 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 classes include a single-instance implementation class and a non-single-instance implementation class, and when the target implementation class is the single-instance implementation class, the service processing module is specifically configured to:
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 embodiments of the present disclosure may execute a service request processing method shown in fig. 1, and its implementation principle is similar, and actions executed by each module in the service request processing apparatus in each embodiment of the present disclosure correspond to steps in the service request processing method in each embodiment of the present disclosure, and detailed functional descriptions of each module in the service request processing apparatus may be specifically referred to descriptions in the corresponding service request processing method shown in the foregoing, which are not described herein again.
Based on the same principle as the method in the embodiments of the present disclosure, reference is now made to fig. 3, which shows a schematic structural diagram of an electronic device (e.g. terminal device in fig. 1) 600 suitable for implementing the embodiments of the present disclosure. 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 electronic device shown in fig. 3 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
An electronic device includes: a memory and a processor, where the processor may be referred to as a processing device 601 hereinafter, 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, as shown in detail below:
as shown in fig. 3, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to 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 required 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 through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic 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 shows an electronic device 600 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 communication means 609, or from storage means 608, or from ROM 602. 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 device 601.
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 implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (Hyper Text 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: receiving triggering operation of a user on an image area in a video frame image of a currently played video through a video playing interface; if the video frame image contains a specified object and the image area is a specified area corresponding to the specified object, generating an object information acquisition request aiming at the specified object; and acquiring and displaying the link information of the specified object based on the object information acquisition request.
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 or units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Where the name of a module or unit does not in some cases constitute a limitation of the unit itself.
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, 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 relation, wherein the corresponding relation is the corresponding relation between the target interface and the target implementation class;
and based on the target implementation class, carrying out corresponding service processing on the service request.
According to one or more embodiments of the present disclosure, the correspondence is established by:
acquiring byte codes corresponding to a functional module, wherein the functional module corresponds to a business 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.
According to one or more embodiments of the present disclosure, the generating, based on the interface corresponding to the functional module and the implementation class corresponding to the interface, a mapping container class corresponding to the functional module 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, 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 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 correspondence includes a first correspondence between the target interface and the target wrapper interface, and a second correspondence between the target wrapper interface and the target implementation class, and 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 packaging interface;
and carrying out 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 classes include a single-instance implementation class and a non-single-instance implementation class, and when the target implementation class is a single-instance implementation class, determining, based on the target package interface and the second correspondence, the target implementation class corresponding to the service request 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, there is provided a service request processing apparatus [ example two ] 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;
a target interface determining module, configured to determine the target interface based on a 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 relation, wherein the corresponding relation is the corresponding relation between the target interface and the target implementation class;
and the service processing module is used for carrying out corresponding service 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 establishing module, where the correspondence establishing module is configured to:
acquiring byte codes corresponding to a functional module, wherein the functional module corresponds to a business 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.
According to one or more embodiments of the present disclosure, the correspondence establishing module is specifically configured to, when generating a mapping container class corresponding to the functional module based on an interface corresponding to the functional module and an implementation class corresponding to the interface:
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, 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 class generation module is used for generating a target package class corresponding to the target implementation class based on the target implementation class, wherein the target package class corresponds to a target package interface;
the corresponding relation comprises a first corresponding relation between the target interface and the target packaging interface and a second corresponding relation between the target packaging 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 relation:
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 packaging interface;
and carrying out 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 classes include a single-instance implementation class and a non-single-instance implementation class, and when the target implementation class is the single-instance implementation class, the service processing module is specifically configured to, when determining, based on the target packaging interface and the second correspondence, the target implementation class corresponding to the service request:
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 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.

Claims (9)

1. A service request processing 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, wherein the corresponding relation is the corresponding relation between the target interface and the target implementation class;
based on the target realization class, carrying out corresponding service processing on the service request;
the method further comprises the steps of:
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 correspondence includes a first correspondence between the target interface and the target wrapper interface, and a second correspondence between the target wrapper interface and the target implementation class, and 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.
2. The method of claim 1, wherein the correspondence is established by:
acquiring byte codes corresponding to a functional module, wherein the functional module corresponds to a business 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.
3. The method according to claim 2, wherein the generating the 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 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, 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 claim 1, wherein 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 packaging interface;
and carrying out corresponding business processing on the service request based on the target implementation class containing the service parameters.
5. The method of claim 4, wherein the service parameter is an Object array.
6. The method of claim 1, wherein if the target implementation class is a single instance implementation class, the determining, based on the target wrapper interface and the second correspondence, the target implementation class corresponding to the service request 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.
7. 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;
a target interface determining module, configured to determine the target interface based on a 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 relation, wherein the corresponding relation is the corresponding relation between the target interface and the target implementation class;
the service processing module is used for carrying out corresponding service processing on the service request based on the target implementation class;
the apparatus further comprises:
the target package class generation module is used for generating a target package class corresponding to the target implementation class based on the target implementation class, wherein the target package class corresponds to a target package interface;
the correspondence includes a first correspondence between the target interface and the target wrapper interface, and a second correspondence between the target wrapper interface and the target implementation class, and the target implementation class determination module includes:
The target packaging interface determining unit is used for determining a target packaging interface corresponding to the target interface based on the target interface and the first corresponding relation;
and the target implementation class determining unit is used for determining a target implementation class corresponding to the service request based on the target packaging interface and the second corresponding relation.
8. An electronic device, comprising:
a processor and a memory;
the memory is used for storing computer operation instructions;
the processor is configured to perform the method of any one of claims 1 to 6 by invoking the computer operating instructions.
9. A computer readable storage medium storing at least one instruction, at least one program, code set, or instruction set, the at least one instruction, the at least one program, the code set, or instruction set being loaded and executed by a processor to implement the method of any one of claims 1 to 6.
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 CN113391860A (en) 2021-09-14
CN113391860B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114756309B (en) * 2022-06-14 2023-04-21 苏州万店掌网络科技有限公司 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

Also Published As

Publication number Publication date
CN113391860A (en) 2021-09-14

Similar Documents

Publication Publication Date Title
CN110489323B (en) Visual RPC API debugging method, device, medium and equipment
CN111581555B (en) Document loading method, device, equipment and storage medium
CN111291244B (en) House source information display method, device, terminal and storage medium
CN111930534A (en) Data calling method and device and electronic equipment
CN113835992B (en) Memory leakage processing method and device, electronic equipment and computer storage medium
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
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN110765752B (en) Test question generation method and device, electronic equipment and computer readable storage medium
CN114625536B (en) Video memory allocation method, device, medium and electronic equipment
CN110377273B (en) Data processing method, device, medium and electronic equipment
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
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
CN111324376B (en) Function configuration method, device, electronic equipment and computer readable medium
CN111400068B (en) Interface control method and device, readable medium and electronic equipment
CN110888773B (en) Method, device, medium and electronic equipment for acquiring thread identification
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN111290812B (en) Display method, device, terminal and storage medium of application control
CN111258786B (en) Decoupling method, device, terminal and storage medium in layered architecture
CN111240738B (en) File processing method, device, equipment and medium
CN112230986A (en) Project file generation method and device, electronic equipment and computer readable medium
CN113448550B (en) Method and device for realizing collection management of classes, electronic equipment and computer medium
CN110099122B (en) Method and apparatus for sending network request
CN111399902B (en) Client source file processing method and device, readable medium 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