CN111324336A - Method, device, terminal and storage medium for realizing dependency injection - Google Patents

Method, device, terminal and storage medium for realizing dependency injection Download PDF

Info

Publication number
CN111324336A
CN111324336A CN202010066483.0A CN202010066483A CN111324336A CN 111324336 A CN111324336 A CN 111324336A CN 202010066483 A CN202010066483 A CN 202010066483A CN 111324336 A CN111324336 A CN 111324336A
Authority
CN
China
Prior art keywords
component
class
classes
attribute
present disclosure
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
CN202010066483.0A
Other languages
Chinese (zh)
Other versions
CN111324336B (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 Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Infinite Light Field 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 Infinite Light Field Technology Co Ltd filed Critical Beijing Infinite Light Field Technology Co Ltd
Priority to CN202010066483.0A priority Critical patent/CN111324336B/en
Publication of CN111324336A publication Critical patent/CN111324336A/en
Application granted granted Critical
Publication of CN111324336B publication Critical patent/CN111324336B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • 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

Landscapes

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

Abstract

The present disclosure provides a method and apparatus, a terminal, and a storage medium for implementing dependent injection. The method for realizing the dependent injection comprises the following steps: acquiring a first component; wherein the first component comprises a first set of classes, the first set of classes corresponding to a first attribute, the first attribute comprising a first set of protocols; acquiring a second assembly; wherein the second assembly comprises a first subassembly and a second subassembly; acquiring a second class set contained in the first sub-component; wherein the second set of classes corresponds to a second attribute, the second attribute comprising a second set of protocols; establishing a mapping relation between the corresponding classes in the first class set and the second class set according to the same protocol in the first protocol set and the second protocol set; obtaining a third set of classes in the second subcomponent for implementing the first set of protocols; and initializing the third set, and assigning the initialized third set to the first attribute. The method of the present disclosure may facilitate the implementation of handover.

Description

Method, device, terminal and storage medium for realizing dependency injection
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for implementing dependent injection, a terminal, and a storage medium.
Background
Dependent injection means that the component does not make a positioning query, and only provides a common Java method to let the container determine the dependency relationship. And (3) assembling the component responsible for the full container weight, wherein the component responsible for the full container weight can transfer the object conforming to the dependency relationship to the required object through a JavaBean attribute or a constructor. The method of injecting dependency relationship through JavaBean attribute is called value setting method injection; the passing in of dependencies as constructor parameters is called constructor injection.
Disclosure of Invention
To solve the existing problems, the present disclosure provides a method and apparatus for implementing dependency injection, a terminal, and a storage medium.
The present disclosure adopts the following technical solutions.
In some embodiments, the present disclosure provides a method of implementing dependent implantation, comprising:
acquiring a first component; wherein the first component comprises a first set of classes, the first set of classes corresponding to a first attribute, the first attribute comprising a first set of protocols;
acquiring a second assembly; wherein the second assembly comprises a first subassembly and a second subassembly;
acquiring a second class set contained in the first sub-component; wherein the second set of classes corresponds to a second attribute, the second attribute comprising a second set of protocols;
establishing a mapping relation between the corresponding classes in the first class set and the second class set according to the same protocol in the first protocol set and the second protocol set;
obtaining a third set of classes in the second subcomponent for implementing the first set of protocols; and
initializing the third set, and assigning the initialized third set to the first attribute.
In some embodiments, the present disclosure provides an apparatus for implementing dependent implantation, comprising:
the acquisition module is used for acquiring a first component, a second set in a first sub-component included by the second component and a third set in a second sub-component included by the second component;
the establishing module is used for establishing a mapping relation between the first class set and the second class set;
an initialization module for initializing the third set of classes; and
and the assignment module is used for assigning the initialized third class set to the first attribute corresponding to the first class set.
In some embodiments, the present disclosure provides a terminal comprising: at least one memory and at least one processor;
the memory is used for storing program codes, and the processor is used for calling the program codes stored in the memory to execute the method.
In some embodiments, the present disclosure provides a storage medium for storing program code for performing the above-described method.
The method for realizing the dependency injection provided by the embodiment of the disclosure can transfer the call pointing to the basic component to different service components by establishing the mapping relation, thereby providing convenience for switching between different implementations.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and elements are not necessarily drawn to scale.
Fig. 1 is a flow chart of an implementation dependent injection method of an embodiment of the present disclosure.
Fig. 2 is a schematic diagram of establishing a mapping relationship according to an embodiment of the present disclosure.
FIG. 3 is a schematic diagram of a valuation process of an embodiment of the present disclosure.
Fig. 4 is a schematic diagram illustrating an effect of implementing the dependent implantation method according to the embodiment of the present disclosure.
Fig. 5 is a schematic diagram of a structure of an implementation dependent injection device of an embodiment of the present disclosure.
Fig. 6 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 various steps recited in method embodiments of the present disclosure may be performed in parallel and/or 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 different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a" or "an" in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that reference to "one or more" unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
As shown in fig. 1, fig. 1 is a flowchart of an implementation dependent implantation method of an embodiment of the present disclosure, including the following steps.
S100, acquiring a first component; wherein the first component comprises a first set of classes, the first set of classes corresponding to a first attribute, the first attribute comprising a first set of protocols.
Wherein, the first component in the embodiment of the present disclosure may be a binary format file. The component unit of a component is a class, one component may be composed of several classes, each class may correspond to one attribute, which is called a global variable or a member variable of the class, the attribute may include a protocol, and in the embodiment of the present disclosure, the first attribute may be an interface class attribute. Accordingly, the set of classes may be referred to as a first set of classes, and the set of different protocols included in the attributes may be referred to as a first set of protocols. Furthermore, the first component may be a base component that only declares a protocol and does not implement the protocol, in other words, invoking the base component does not achieve the goal of the implementation.
S200, acquiring a second component; wherein the second assembly comprises a first subassembly and a second subassembly.
As mentioned above, the base component can only declare a protocol, and its implementation requires the invocation of upper level components, such as business components. Specifically, in the embodiment of the present disclosure, besides obtaining the basic component, a plurality of service components capable of implementing a basic component protocol may also be obtained.
S300, acquiring a second class set contained in the first sub-assembly; wherein the second set of classes corresponds to a second attribute, the second attribute comprising a second set of protocols.
In particular, embodiments of the present disclosure may obtain a class in one of two business components. As above, the business component may also be in binary format; the service component also comprises a plurality of classes, each class can correspond to an attribute, and the attribute can comprise a protocol; the second attribute may also be an interface class attribute; accordingly, the collection of classes may be referred to as a class set, and for distinguishing from the above class set, may be referred to herein as a second class set; likewise, the set of different protocols included in the attributes may be referred to as a second set of protocols.
S400, according to the same protocol in the first protocol set and the second protocol set, establishing a mapping relation between the corresponding class in the first class set and the class in the second class set.
In the disclosed embodiment, the first protocol set and the second protocol set may include the same protocol, and the difference is that the protocol in the first protocol set is a declaration protocol, and the protocol in the second protocol set can achieve the purpose. In other words, classes in the first set of classes and classes in the second set of classes may be associated classes. As shown in fig. 2, fig. 2 is a schematic diagram of establishing a mapping relationship according to the embodiment of the disclosure. In FIG. 2, component A may be a base component and component B may be a business component. Where component a may include multiple classes, embodiments of the present disclosure take class 1 and class 2 as examples, where attributes of class 1 may include protocol 1 and attributes of class 2 may include protocol 2. Correspondingly, in business component B, the attributes of class 3 include protocol 1 and the attributes of class 4 include protocol 2. In component A, protocol 1 and protocol 2 may be just declarative protocols; in component B, protocol 1 and protocol 2 may be implementation protocols. At this time, a mapping relationship is established between classes with the same protocol, i.e., class 1 corresponds to class 3, and class 2 corresponds to class 4, i.e., a mapping relationship between classes with the same protocol in component a and component B can be established. It is understood that the embodiment is only illustrative in terms of two classes included in each component, and the number of classes may vary in other embodiments of the disclosure, which is not limited by the disclosure. In addition, the embodiment of the disclosure can create a sub data segment in the data (data) segment in the binary format file for recording the mapping relationship, and the mapping relationship can be, for example, in the form of binary format, and the advantage of using this format is high security. In another embodiment of the present disclosure, the mapping relationship may also be recorded in the configuration table in a plaintext form, and the plaintext form is beneficial for the developer to understand; in addition, since the plaintext is modifiable, the configuration table may be updated or pruned as needed, unlike the binary format file. The mapping relationships in the above embodiments are preferably directed from the base component to the business component in a single direction, but it is understood that the mapping relationships in the embodiments of the present disclosure may also be directed in two directions, which may also achieve the call forwarding objective of the present disclosure.
S500, acquiring a third set of classes for realizing the first protocol set in the second sub-assembly.
Specifically, the embodiment of the present disclosure may further obtain a service component, where the service component also includes a protocol existing in the basic component, and the rest of the aspects are similar to the step S300 and are not described herein again.
S600, initializing the third set, and assigning the initialized third set to the first attribute.
Specifically, embodiments of the present disclosure may create objects; and then according to the mapping relation, transferring the first class corresponding to the same protocol in the first class set pointed by the third class set to a function set determined according to the assignment in the second class set corresponding to the same protocol. Taking fig. 3 as an example, fig. 3 is a schematic diagram of a value assignment process according to an embodiment of the disclosure. In fig. 3, a service component C is obtained; multiple classes, e.g., class 5 and class 6, may be included in component C, wherein attributes of class 5 include protocol 1 and attributes of class 6 include protocol 2. When the business component C calls the basic component A, the calling object is transferred to the class with the same protocol in the component B according to the mapping relation. The invocation relationship changes from dotted to broken in fig. 3, i.e. class 5 goes from class 1 in invocation component a to the corresponding function set, e.g. function set 2, in class 3 in invocation component B according to the assignment, and class 6 goes from class 2 in invocation component a to e.g. function set 4 in class 4 in invocation component B according to the assignment. It is understood that each class of the present embodiment only exemplarily includes two function sets, but in other embodiments of the present disclosure, the number of function sets is not limited to two, and the present disclosure does not limit this. In addition, in the present embodiment, a component C is taken as an example, and in other embodiments, the obtained component is not limited to the component C, and other cases such as the component D, the component E, and more components are also included in the scope of the present disclosure.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating an effect of implementing the dependent implantation method according to the embodiment of the disclosure. As can be seen from fig. 4, the method for implementing injection dependency proposed by the embodiments of the present disclosure may provide convenience for function switching. In particular, component 1 may be a base component, and component 2, component 3, component 4, and component 5 may be business modules, including different implementations. If it is desired to switch from the implementation of component 2 to the implementation of component 3, only the mapping direction needs to be selected, i.e., the short-line arrow in fig. 4 is changed to a dotted-line arrow. Further, the method for implementing injection dependence provided by the embodiment of the disclosure can also simplify the modification process. For example, component 3 and component 4 in fig. 4 correspond to the same implementation, except that component 4 is an optimized version of component 3, so that updating of the component does not require relocation of the original code, especially when the amount of source code is large, this implementation can be upgraded by changing the mapping relationship to point to component 4. In addition, the error reporting module can be rapidly positioned according to the direction when the error is reported. It is to be understood that while five components are illustrated in fig. 4, the present disclosure may include a greater or lesser number of components.
As shown in fig. 5, an apparatus 10 for implementing dependent injection is further provided in the embodiments of the present disclosure, and includes an obtaining module 30, a creating module 50, an initializing module 70, and an assigning module 90. Wherein the obtaining module 30 is operable to obtain the first component, the second set in the first sub-component included in the second component, and the third set in the second sub-component included in the second component. The establishing module 50 may be configured to establish a mapping relationship between the first set of classes and the second set of classes. An initialization module 70 may be used to initialize the third set of classes. The assigning module 90 may be configured to assign the initialized third set to the first attribute corresponding to the first set. In other embodiments of the present disclosure, a forwarding module (not shown) may be further included, configured to forward, according to the mapping relationship, the first class corresponding to the same protocol in the first class set pointed by the third class set to the function set determined according to the assignment in the second class corresponding to the same protocol in the second class set.
For the embodiments of the apparatus, since they correspond substantially to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described apparatus embodiments are merely illustrative, wherein the modules described as separate modules may or may not be separate. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
In the above, the method and apparatus for implementing dependent implantation according to the present disclosure are described based on the embodiments and application examples. In addition, the present disclosure also provides a terminal and a storage medium, which are described below.
Referring now to fig. 6, a schematic diagram of an electronic device (e.g., a terminal device or server) 800 suitable for use in implementing embodiments of the present disclosure is shown. 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. 6 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.
As shown in fig. 6, the electronic device 800 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM 802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 6 illustrates an electronic device 800 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 embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, 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 (HyperText transfer protocol), and may be interconnected 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 perform the methods of the present disclosure as described above.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including 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 units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element 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.
In accordance with one or more embodiments of the present disclosure, there is provided a method of implementing dependent implantation, comprising:
acquiring a first component; wherein the first component comprises a first set of classes, the first set of classes corresponding to a first attribute, the first attribute comprising a first set of protocols;
acquiring a second assembly; wherein the second assembly comprises a first subassembly and a second subassembly;
acquiring a second class set contained in the first sub-component; wherein the second set of classes corresponds to a second attribute, the second attribute comprising a second set of protocols;
establishing a mapping relation between the corresponding classes in the first class set and the second class set according to the same protocol in the first protocol set and the second protocol set;
obtaining a third set of classes in the second subcomponent for implementing the first set of protocols; and
initializing the third set, and assigning the initialized third set to the first attribute.
According to one or more embodiments of the present disclosure, there is provided a method, wherein the step of assigning the initialized third set of classes to the first attribute includes:
and transferring the first class corresponding to the same protocol in the first class set pointed by the third class set to a function set which is determined according to the assignment in the second class set corresponding to the same protocol according to the mapping relation.
According to one or more embodiments of the present disclosure, a method is provided wherein the first component is a base component and the second component is a business component.
According to one or more embodiments of the present disclosure, there is provided a method characterized in that the first component and the second component are both binary format files.
According to one or more embodiments of the present disclosure, there is provided a method, wherein the mapping relation is recorded in a binary format in a sub data segment of a data segment in the binary format file.
According to one or more embodiments of the present disclosure, there is provided a method characterized in that the mapping relationship is recorded in a configuration table in a clear text form.
According to one or more embodiments of the present disclosure, there is provided a method, wherein the first attribute and the second attribute are both interface class attributes.
In accordance with one or more embodiments of the present disclosure, a method is provided wherein the mapping relationship is a one-way directional relationship from a class in the first set of classes to a class in the second set of classes.
According to one or more embodiments of the present disclosure, there is provided an apparatus for implementing dependent implantation, including:
the acquisition module is used for acquiring a first component, a second set in a first sub-component included by the second component and a third set in a second sub-component included by the second component;
the establishing module is used for establishing a mapping relation between the first class set and the second class set;
an initialization module for initializing the third set of classes; and
and the assignment module is used for assigning the initialized third class set to the first attribute corresponding to the first class set.
According to one or more embodiments of the present disclosure, there is provided a terminal including: at least one memory and at least one processor;
wherein the at least one memory is configured to store program code, and the at least one processor is configured to call the program code stored in the at least one memory to perform the method of any one of the above.
According to one or more embodiments of the present disclosure, there is provided a storage medium for storing program code for performing the above-described method.
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 (11)

1. A method of implementing dependent implantation, comprising:
acquiring a first component; wherein the first component comprises a first set of classes, the first set of classes corresponding to a first attribute, the first attribute comprising a first set of protocols;
acquiring a second assembly; wherein the second assembly comprises a first subassembly and a second subassembly;
acquiring a second class set contained in the first sub-component; wherein the second set of classes corresponds to a second attribute, the second attribute comprising a second set of protocols;
establishing a mapping relation between the corresponding classes in the first class set and the second class set according to the same protocol in the first protocol set and the second protocol set;
obtaining a third set of classes in the second subcomponent for implementing the first set of protocols; and
initializing the third set, and assigning the initialized third set to the first attribute.
2. The method of claim 1, wherein assigning the initialized third set of classes to the first attribute comprises:
and transferring the first class corresponding to the same protocol in the first class set pointed by the third class set to a function set which is determined according to the assignment in the second class set corresponding to the same protocol according to the mapping relation.
3. The method of claim 1, wherein the first component is a base component and the second component is a business component.
4. The method of claim 1, wherein the first component and the second component are both binary format files.
5. The method of claim 4, wherein the mapping relationship is recorded in binary format in a sub data segment of a data segment in the binary format file.
6. The method according to claim 1 or 4, wherein the mapping relation is recorded in a configuration table in a clear text form.
7. The method of claim 1, wherein the first attribute and the second attribute are both interface class attributes.
8. The method of claim 1, wherein the mapping relationship is a one-way pointing relationship from a class in the first set of classes to a class in the second set of classes.
9. An apparatus for implementing dependent implantation, comprising:
the acquisition module is used for acquiring a first component, a second set in a first sub-component included by the second component and a third set in a second sub-component included by the second component;
the establishing module is used for establishing a mapping relation between the first class set and the second class set;
an initialization module for initializing the third set of classes; and
and the assignment module is used for assigning the initialized third class set to the first attribute corresponding to the first class set.
10. A terminal, comprising:
at least one memory and at least one processor;
wherein the at least one memory is configured to store program code and the at least one processor is configured to invoke the program code stored in the at least one memory to perform the method of any of claims 1 to 8.
11. A storage medium for storing program code for performing the method of any one of claims 1 to 8.
CN202010066483.0A 2020-01-20 2020-01-20 Method, device, terminal and storage medium for implementing dependency injection Active CN111324336B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010066483.0A CN111324336B (en) 2020-01-20 2020-01-20 Method, device, terminal and storage medium for implementing dependency injection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010066483.0A CN111324336B (en) 2020-01-20 2020-01-20 Method, device, terminal and storage medium for implementing dependency injection

Publications (2)

Publication Number Publication Date
CN111324336A true CN111324336A (en) 2020-06-23
CN111324336B CN111324336B (en) 2023-12-12

Family

ID=71167012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010066483.0A Active CN111324336B (en) 2020-01-20 2020-01-20 Method, device, terminal and storage medium for implementing dependency injection

Country Status (1)

Country Link
CN (1) CN111324336B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407163A (en) * 2021-05-18 2021-09-17 中广核工程有限公司 Module association assignment method and device, computer equipment and readable storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6832369B1 (en) * 2000-08-01 2004-12-14 International Business Machines Corporation Object oriented method and apparatus for class variable initialization
CN104407843A (en) * 2014-10-22 2015-03-11 浪潮软件集团有限公司 Dependency inversion optimization method for decoupling high-low layer modules
CN106569835A (en) * 2016-11-14 2017-04-19 济南浪潮高新科技投资发展有限公司 Realization method for inversion-of-control assembly based on go language
US20170255474A1 (en) * 2016-03-03 2017-09-07 International Business Machines Corporation Heuristic process for inferring resource dependencies for recovery planning
CN108762728A (en) * 2018-04-13 2018-11-06 杭州朗和科技有限公司 By integrated method, medium, device and the computing device in the application of communication function
CN109669679A (en) * 2018-12-28 2019-04-23 北京微播视界科技有限公司 Service detection and processing method, device and electronic equipment
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
CA3047939A1 (en) * 2018-06-25 2019-12-25 Tata Consultancy Services Limited Automated extraction of rules embedded in software application code using machine learning

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6832369B1 (en) * 2000-08-01 2004-12-14 International Business Machines Corporation Object oriented method and apparatus for class variable initialization
CN104407843A (en) * 2014-10-22 2015-03-11 浪潮软件集团有限公司 Dependency inversion optimization method for decoupling high-low layer modules
US20170255474A1 (en) * 2016-03-03 2017-09-07 International Business Machines Corporation Heuristic process for inferring resource dependencies for recovery planning
CN106569835A (en) * 2016-11-14 2017-04-19 济南浪潮高新科技投资发展有限公司 Realization method for inversion-of-control assembly based on go language
CN108762728A (en) * 2018-04-13 2018-11-06 杭州朗和科技有限公司 By integrated method, medium, device and the computing device in the application of communication function
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
CA3047939A1 (en) * 2018-06-25 2019-12-25 Tata Consultancy Services Limited Automated extraction of rules embedded in software application code using machine learning
CN109669679A (en) * 2018-12-28 2019-04-23 北京微播视界科技有限公司 Service detection and processing method, device and electronic equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
JEZEK, K: "Dependency Injection Refined by Extra-functional Properties", IEEE, vol. 2012, pages 255 - 256, XP032470222, DOI: 10.1109/VLHCC.2012.6344541 *
REDOUANE ESBAI: "Model-to-model transformation in approach by modeling: From UML model to Model-View-Presenter and Dependency Injection patterns", IEEE, vol. 2015, pages 1 - 5 *
王誉东: "基于机器学习识别SQL注入攻击设计与实现", 《中国优秀硕士学位论文全文数据库》, vol. 2018, pages 7 - 48 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407163A (en) * 2021-05-18 2021-09-17 中广核工程有限公司 Module association assignment method and device, computer equipment and readable storage medium

Also Published As

Publication number Publication date
CN111324336B (en) 2023-12-12

Similar Documents

Publication Publication Date Title
CN110851139B (en) Method and device for checking codes and electronic equipment
CN111291103A (en) Interface data analysis method and device, electronic equipment and storage medium
CN111400068B (en) Interface control method and device, readable medium and electronic equipment
CN114595065A (en) Data acquisition method and device, storage medium and electronic equipment
CN114035879A (en) Page theme color changing method and device, electronic equipment and computer readable medium
CN111881216A (en) Data acquisition method and device based on shared template
CN111857720A (en) Method and device for generating user interface state information, electronic equipment and medium
CN115357350A (en) Task configuration method and device, electronic equipment and computer readable medium
CN111309304A (en) Method, device, medium and electronic equipment for generating IDL file
CN111324336B (en) Method, device, terminal and storage medium for implementing dependency injection
CN110704050B (en) Module initializing method and device, electronic equipment and computer readable storage medium
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN113391860A (en) Service request processing method and device, electronic equipment and computer storage medium
CN113518183A (en) Camera calling method and device and electronic equipment
CN113778566A (en) Native application calling method and device, electronic equipment and computer readable medium
CN112445820A (en) Data conversion method and device
CN111240738A (en) File processing method, device, equipment and medium
CN110619079A (en) Method and device for pushing information
CN111309323A (en) Parameter initialization method and device and electronic equipment
CN111258786A (en) Decoupling method and device in layered architecture, terminal and storage medium
CN112306317A (en) Unread message notification method and device and electronic equipment
CN111290812A (en) Application control display method and device, terminal and storage medium
CN110704767B (en) Page opening method and device, electronic equipment and storage medium
CN118012470A (en) Updating method and device for power information management application, electronic equipment and medium
CN117971275A (en) Method, device, equipment and medium for loading flow management application of electric power Internet of things

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20230406

Address after: Room 802, Information Building, 13 Linyin North Street, Pinggu District, Beijing, 101299

Applicant after: Beijing youzhuju Network Technology Co.,Ltd.

Address before: No. 715, 7th floor, building 3, 52 Zhongguancun South Street, Haidian District, Beijing 100081

Applicant before: Beijing infinite light field technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant