CN111562909B - Class-based application implementation method and device, electronic equipment and storage medium - Google Patents

Class-based application implementation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111562909B
CN111562909B CN202010375199.1A CN202010375199A CN111562909B CN 111562909 B CN111562909 B CN 111562909B CN 202010375199 A CN202010375199 A CN 202010375199A CN 111562909 B CN111562909 B CN 111562909B
Authority
CN
China
Prior art keywords
protocol
function
class
sub
tagged
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
CN202010375199.1A
Other languages
Chinese (zh)
Other versions
CN111562909A (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 Jindi Technology Co Ltd
Original Assignee
Beijing Jindi 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 Jindi Technology Co Ltd filed Critical Beijing Jindi Technology Co Ltd
Priority to CN202010375199.1A priority Critical patent/CN111562909B/en
Publication of CN111562909A publication Critical patent/CN111562909A/en
Application granted granted Critical
Publication of CN111562909B publication Critical patent/CN111562909B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Abstract

The embodiment of the disclosure discloses a class-based application implementation method and device, an electronic device and a storage medium, wherein the method comprises the following steps: acquiring a list of classes in an application program; traversing a list of classes in the application program, and determining at least one class which cannot be realized by the function; marking a protocol corresponding to at least one function which cannot be realized in the class which cannot be realized in the at least one function, and obtaining the at least one protocol with the mark; based on the at least one tagged protocol, a class supporting the at least one tagged protocol is loaded in at least one functionally disabled class. Therefore, the embodiment of the disclosure realizes the multi-inheritance of the class by loading the class supporting the protocol with the mark, avoids the code redundancy and facilitates the change of the later protocol function.

Description

Class-based application implementation method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to application development technologies, and in particular, to a class-based application implementation method and apparatus, an electronic device, and a storage medium.
Background
In the process of program development, the concept of class exists in most of high-level languages, and the class can encapsulate and split functions, so that codes become formatted, modularized and safer to use. If one wants to have the function of a certain class, one needs to inherit from this class and create a subclass to implement. If it is desired to have the functions of multiple classes, it is necessary to implement by multiple inheritance, while inheriting multiple classes.
In carrying out the present disclosure, the inventors found that: when used in an IOS operating system, some programming languages may exhibit multiple inheritance of unsupported classes, such as the Objective-C language, which may be prone to code redundancy, such as: the class a needs to have a plurality of functions corresponding to the protocols, and needs to declare that the protocols are supported and encode the functions corresponding to each protocol, and the class B needs to encode the functions when the functions are supported, so that the class a not only causes code redundancy, but also brings much inconvenience to the modification of the later protocol functions.
Disclosure of Invention
The present disclosure has been made in order to solve the above technical problems. The embodiment of the disclosure provides a class-based application implementation method and device, electronic equipment and storage medium.
According to an aspect of the embodiments of the present disclosure, there is provided a class-based application implementation method, including:
acquiring a list of classes in an application program;
traversing a list of classes in the application program, and determining at least one class which cannot be realized by the function;
marking a protocol corresponding to at least one function which cannot be realized in the class which cannot be realized in the at least one function, and obtaining the at least one protocol with the mark;
and loading a class supporting the at least one tagged protocol in a class in which the at least one function cannot be implemented based on the at least one tagged protocol.
Optionally, in the above method embodiments of the present disclosure, the list of classes includes: at least one function to be realized, protocols supported by each type, and functions corresponding to each protocol.
Optionally, in the above method embodiments of the present disclosure, loading, based on the at least one tagged protocol, a class supporting the at least one tagged protocol in a class that cannot be implemented by the at least one function includes:
determining a code corresponding to the at least one tagged protocol based on the at least one tagged protocol;
generating a class supporting the at least one tagged protocol based on a code corresponding to the at least one tagged protocol;
and loading a class supporting the at least one tagged protocol in the class in which the at least one function cannot be implemented.
Optionally, in the above method embodiments of the present disclosure, the determining, based on the at least one tagged protocol, a code corresponding to the at least one tagged protocol includes:
acquiring functionality supported by the at least one tagged protocol based on the at least one tagged protocol;
determining at least one sub-function supported by the at least one tagged protocol based on the at least one tagged protocol supported function;
determining a code corresponding to the at least one tagged protocol based on at least one sub-function supported by the at least one tagged protocol.
Optionally, in the above method embodiments of the present disclosure, the determining, based on the function supported by the at least one tagged protocol, between the at least one sub-function supported by the at least one tagged protocol and the at least one sub-function supported by the at least one tagged protocol, determining a code corresponding to the at least one tagged protocol includes:
determining attributes of the sub-functions based on at least one sub-function supported by the at least one tagged protocol; wherein the attributes of each sub-function include: functions that must be implemented and functions that may be implemented;
and determining a method which is necessary to be realized or can be realized corresponding to each sub-function based on the attribute of each sub-function.
Optionally, in the above method embodiments of the present disclosure, the determining, based on at least one sub-function supported by the at least one tagged protocol, a code corresponding to the at least one tagged protocol includes:
determining an example method and/or a class method corresponding to each sub-function based on at least one sub-function supported by the at least one marked protocol;
and determining codes corresponding to the at least one marked protocol based on the example method and/or the class method corresponding to each sub-function.
According to another aspect of the embodiments of the present disclosure, there is provided a class-based application implementation apparatus, including:
the acquisition module is used for acquiring a list of classes in the application program; the determining module is used for traversing the list of the classes in the application program and determining at least one class which cannot be realized by the function;
an obtaining module, configured to mark a protocol corresponding to at least one function that cannot be implemented in the class that cannot be implemented by the at least one function, and obtain the at least one marked protocol;
and a loading module, configured to load a class supporting the at least one tagged protocol in a class that cannot be implemented by the at least one function based on the at least one tagged protocol.
Optionally, in the above device embodiments of the present disclosure, the list of classes includes: at least one function to be realized, protocols supported by each type, and functions corresponding to each protocol.
Optionally, in the above device embodiments of the present disclosure, the loading module includes:
a determining unit, configured to determine a code corresponding to the at least one marked protocol based on the at least one marked protocol;
a generating unit, configured to generate a class supporting the at least one tagged protocol based on a code corresponding to the at least one tagged protocol;
and a loading unit, configured to load a class supporting the at least one protocol with a label in a class that cannot be implemented by the at least one function.
Optionally, in the above embodiments of the present disclosure, the determining unit includes:
an acquisition subunit configured to acquire, based on the at least one tagged protocol, a function supported by the at least one tagged protocol;
a first determining subunit configured to determine, based on the functions supported by the at least one markup protocol, a plurality of sub-functions supported by the at least one markup protocol;
and a fourth determining subunit, configured to determine a code corresponding to the at least one tagged protocol based on a plurality of sub-functions supported by the at least one tagged protocol.
Optionally, in the above embodiments of the present disclosure, between the first determining subunit and the fourth determining subunit, the method includes:
a second determining subunit, configured to determine an attribute of each sub-function based on at least one sub-function supported by the at least one tagged protocol; wherein the attributes of each sub-function include: functions that must be implemented and functions that may be implemented;
and the third determining subunit is used for determining a method which is required to be realized or is possible to be realized and corresponds to each sub-function based on the attribute of each sub-function.
Optionally, in the above embodiments of the present disclosure, the fourth determining subunit is specifically configured to:
determining an example method and/or a class method corresponding to each sub-function based on at least one sub-function supported by the at least one marked protocol;
and determining codes corresponding to the at least one marked protocol based on the example method and/or the class method corresponding to each sub-function.
According to yet another aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium storing a computer program for executing the class-based application implementation method according to any of the embodiments of the present disclosure.
According to still another aspect of the embodiments of the present disclosure, there is provided an electronic device including: a processor; a memory for storing the processor-executable instructions; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the class-based application implementation method according to any one of the foregoing embodiments.
The method and the device for realizing class-based application, the electronic equipment and the storage medium provided by the embodiment of the disclosure acquire a list of classes in an application program; traversing a list of classes in the application program, and determining at least one class which cannot be realized by the function; marking a protocol corresponding to at least one function which cannot be realized in the class which cannot be realized in the at least one function, and obtaining the at least one protocol with the mark; based on the at least one tagged protocol, a class supporting the at least one tagged protocol is loaded in at least one functionally disabled class. Therefore, the embodiment of the disclosure realizes the multi-inheritance of the class by loading the class supporting the protocol with the mark, avoids the code redundancy and facilitates the change of the later protocol function.
The technical scheme of the present disclosure is described in further detail below through the accompanying drawings and examples.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing embodiments thereof in more detail with reference to the accompanying drawings. The accompanying drawings are included to provide a further understanding of embodiments of the disclosure, and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure, without limitation to the disclosure. In the drawings, like reference numerals generally refer to like parts or steps.
FIG. 1 is a flow diagram of a class-based application implementation method provided by an exemplary embodiment of the present disclosure.
Fig. 2 is a flow diagram of a class-based application implementation method provided by another exemplary embodiment of the present disclosure.
Fig. 3 is a flow chart illustrating a class-based application implementation method provided in yet another exemplary embodiment of the present disclosure.
Fig. 4 is a flow diagram of a class-based application implementation method provided by yet another exemplary embodiment of the present disclosure.
Fig. 5 is a flow diagram of a class-based application implementation method provided by another exemplary embodiment of the present disclosure.
Fig. 6 is a schematic structural diagram of a class-based application implementation apparatus according to an exemplary embodiment of the present disclosure.
Fig. 7 is a block diagram of an electronic device provided in an exemplary embodiment of the present disclosure.
Detailed Description
Hereinafter, example embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present disclosure and not all of the embodiments of the present disclosure, and that the present disclosure is not limited by the example embodiments described herein.
It should be noted that: the relative arrangement of the components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless it is specifically stated otherwise.
It will be appreciated by those of skill in the art that the terms "first," "second," etc. in embodiments of the present disclosure are used merely to distinguish between different steps, devices or modules, etc., and do not represent any particular technical meaning nor necessarily logical order between them.
It should also be understood that in embodiments of the present disclosure, "plurality" may refer to two or more, and "at least one" may refer to one, two or more.
It should also be appreciated that any component, data, or structure referred to in the presently disclosed embodiments may be generally understood as one or more without explicit limitation or the contrary in the context.
In addition, the term "and/or" in this disclosure is merely an association relationship describing an association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" in the present disclosure generally indicates that the front and rear association objects are an or relationship.
It should also be understood that the description of the various embodiments of the present disclosure emphasizes the differences between the various embodiments, and that the same or similar features may be referred to each other, and for brevity, will not be described in detail.
Meanwhile, it should be understood that the sizes of the respective parts shown in the drawings are not drawn in actual scale for convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but are intended to be part of the specification where appropriate.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further discussion thereof is necessary in subsequent figures.
Embodiments of the present disclosure may be applicable to electronic devices such as terminal devices, computer systems, servers, etc., which may operate with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known terminal devices, computing systems, environments, and/or configurations that may be suitable for use with the terminal device, computer system, server, or other electronic device include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer system mainframe computer systems, and distributed cloud computing technology environments that include any of the foregoing, and the like.
Electronic devices such as terminal devices, computer systems, servers, etc. may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc., that perform particular tasks or implement particular abstract data types. The computer system/server may be implemented in a distributed cloud computing environment in which tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computing system storage media including memory storage devices.
FIG. 1 is a flowchart of a class-based application implementation method provided by an exemplary embodiment of the present disclosure. The embodiment can be applied to an electronic device, as shown in fig. 1, and the class-based application implementation method includes the following steps:
s102, acquiring a list of classes in the application program.
The list of classes in embodiments of the present disclosure may include: at least one function to be realized, protocols supported by each type, and functions corresponding to each protocol.
S104, traversing a list of classes in the application program, and determining the class which cannot be realized by at least one function.
For example, traversing a list of classes in an application, determining classes in which a function cannot be implemented is: class a, class B, and class C.
S106, marking the protocol corresponding to the at least one unrealized function of the class with the unrealized function, and obtaining at least one marked protocol.
For example, the protocols corresponding to the functions which cannot be realized in the class a, i.e. the non-inheritance functions Y and Z, are marked, so that two marked protocols are obtained.
S108, loading a class supporting at least one protocol with a mark in at least one class which can not be realized by the function based on the at least one protocol with the mark.
In a specific example, the class a needs to implement a function X, Y, Z, where the inheritance function X corresponds to a Protocol MyProtocol, and the protocols corresponding to the non-inheritance functions Y and Z are marked to obtain two marked protocols Protocol Y 'and Protocol Z', and the execution procedure is as follows, where the two marked protocols Protocol Y 'and Protocol Z' are loaded when the main function (main function) is executed by using the operation mechanism of the Objective-C:
@interface MyClass
< MyProtocol >// only need to add the line code, and introduce protocol declaration
< Protocol H ', protocol K' … >// if multiple inheritance is needed, multiple protocols are added
@end
The method for implementing class-based application provided by the above embodiment of the present disclosure obtains a list of classes in an application program provided by the above embodiment of the present disclosure; traversing a list of classes in the application program, and determining at least one class of which the function cannot be realized; marking a protocol corresponding to at least one function which cannot be realized in the class which cannot be realized in at least one function, and obtaining at least one protocol with a mark; based on the at least one tagged protocol, a class supporting the at least one tagged protocol is loaded in at least one functionally disabled class. Therefore, the embodiment of the disclosure realizes the multi-inheritance of the class by loading the class supporting the protocol with the mark, avoids the code redundancy and facilitates the change of the later protocol function.
As shown in fig. 2, in some optional implementations, based on the embodiment shown in fig. 1, step S108 may specifically include:
s201, determining codes corresponding to at least one marked protocol based on the at least one marked protocol.
S202, generating a class supporting at least one marked protocol based on codes corresponding to the at least one marked protocol.
The protocol name and the corresponding number of the COUNTERs may be spliced to determine class names of various types, for example, the protocol name and the count number of the COUNTER (_counter_) may be spliced by using macro definition to generate class names (e.g., myprotocol_dynamicclass_1):
@protocol MyProtocol;
@interface MyProtocol_DynamicClass_1:NSObject<MyProtocol>
@end
s203, loading a class supporting at least one protocol with a label in at least one class with a function which cannot be realized.
For example, if class B requires the functionality of multiple protocols, only those protocols need to be marked as supported, and then the classes that carry the functionality of those protocols are loaded into class B.
According to the embodiment of the disclosure, the classes corresponding to the marked protocols can be directly loaded before the application program is operated, so that program operation breakdown caused by code redundancy is avoided.
As shown in fig. 3, in some alternative implementations, based on the embodiment shown in fig. 2, step S201 may specifically include:
s301, acquiring at least one function supported by the marked protocol based on the at least one marked protocol.
For example, when the class a marks that it supports the protocol H ', the function Y corresponding to the protocol needs to be implemented, and when the other modules use the class a, the function Y corresponding to the protocol H' is known to be included, so that the function Y can be used.
S302, determining at least one sub-function supported by at least one tagged protocol based on the at least one tagged protocol supported function.
S303, determining codes corresponding to the at least one marked protocol based on at least one sub-function supported by the at least one marked protocol.
In an alternative example, all sub-functions supported by a function supported by a marked protocol are listed, sub-codes corresponding to the sub-functions are acquired, and codes corresponding to at least one marked protocol are determined.
As shown in fig. 4, in some optional implementations, based on the embodiment shown in fig. 3, steps S302 and S303 may specifically include:
s401, determining the attribute of each sub-function based on at least one sub-function supported by at least one marked protocol.
Wherein, the attribute of each sub-function includes: the functions that must be implemented and the functions that may be implemented.
S402, determining a method which is necessary to be implemented or a method which is possible to be implemented and corresponds to each sub-function based on the attribute of each sub-function.
For example, in the procedure of the following example, add @ required before the instance (void) foo, indicating the method that must be implemented; the method optionally implemented by adding @ optional before instance (void) bar:
@protocol MyProtocol
@required
-(void)foo;
@optional
-(void)bar;
@end
in a specific example shown below, the myprotocol_dynamicclass_1 includes a method (void) foo that must be implemented corresponding to a function that must be implemented and a method (void) bar that can be implemented selectively corresponding to a function that can be implemented selectively:
the embodiment of the disclosure can realize the function of dynamically constructing one class to bear the declaration support of the protocol, thereby enabling the class corresponding to the protocol function to be simply and efficiently accessed into the parent class.
As shown in fig. 5, in some optional implementations, based on the embodiment shown in fig. 4, step S303 may specifically include:
s501, determining an instance method and/or a class method corresponding to each sub-function based on at least one sub-function supported by at least one marked protocol.
The class method is used for representing functions corresponding to the class, for example: information interaction functions corresponding to the information interaction classes; the instance method is used to represent functions corresponding to the instance, such as: text input function, voice input function, and picture input function corresponding to instant message.
S502, determining codes corresponding to at least one marked protocol based on the example method and/or the class method corresponding to each sub-function.
In the program shown below, using the characteristics of the Objective-C language itself and the loading timing of the dynamic linker system (dyld) of ios, the (load) instance method and/or class method are loaded in the class of the tagged protocol, so that when at least one class whose function cannot be implemented is loaded, the corresponding instance method and/or class method is obtained and saved:
according to the embodiment of the disclosure, through the mapping relation between the protocol and the protocol method determined based on the instance method and the class method, multiple inheritance of the class can be accurately and rapidly realized, and the running rate is improved.
Any of the class-based application implementation methods provided by the embodiments of the present disclosure may be performed by any suitable device having data processing capabilities, including, but not limited to: terminal equipment, servers, etc. Alternatively, any of the class-based application implementation methods provided by the embodiments of the present disclosure may be executed by a processor, such as the processor executing any of the class-based application implementation methods mentioned by the embodiments of the present disclosure by invoking corresponding instructions stored in a memory. And will not be described in detail below.
Any of the class-based application implementation methods provided by the embodiments of the present disclosure may be performed by any suitable device having data processing capabilities, including, but not limited to: terminal equipment, servers, etc. Alternatively, any of the class-based application implementation methods provided by the embodiments of the present disclosure may be executed by a processor, such as the processor executing any of the class-based application implementation methods mentioned by the embodiments of the present disclosure by invoking corresponding instructions stored in a memory. And will not be described in detail below.
Fig. 6 is a schematic structural diagram of a class-based application implementation apparatus according to an exemplary embodiment of the present disclosure. The device can be arranged in electronic equipment such as terminal equipment and a server, and can execute the class-based application implementation method of any embodiment of the disclosure. As shown in fig. 6, the class-based application implementation apparatus includes:
an acquisition module 61, configured to acquire a list of classes in an application program;
a determining module 62, configured to traverse the list of classes in the application program and determine at least one class that cannot be implemented by the function;
an obtaining module 63, configured to mark a protocol corresponding to at least one function that cannot be implemented in the class that cannot be implemented by the at least one function, and obtain the at least one marked protocol;
a loading module 64 for loading classes supporting the at least one tagged protocol in classes where the at least one function cannot be implemented based on the at least one tagged protocol.
The class-based application implementation device provided by the embodiment of the present disclosure acquires a list of classes in an application program; traversing a list of classes in the application program, and determining at least one class which cannot be realized by the function; marking a protocol corresponding to at least one function which cannot be realized in the class which cannot be realized in the at least one function, and obtaining the at least one protocol with the mark; based on the at least one tagged protocol, a class supporting the at least one tagged protocol is loaded in at least one functionally disabled class. Therefore, the embodiment of the disclosure realizes the multi-inheritance of the class by loading the class supporting the protocol with the mark, avoids the code redundancy and facilitates the change of the later protocol function.
In some of these embodiments, the list of classes includes: at least one function to be realized, protocols supported by each type, and functions corresponding to each protocol.
In some of these embodiments, the loading module 64 includes:
a determining unit, configured to determine a code corresponding to the at least one marked protocol based on the at least one marked protocol;
a generating unit, configured to generate a class supporting the at least one tagged protocol based on a code corresponding to the at least one tagged protocol;
and a loading unit, configured to load a class supporting the at least one protocol with a label in a class that cannot be implemented by the at least one function.
In some of these embodiments, the determining unit includes:
an acquisition subunit configured to acquire, based on the at least one tagged protocol, a function supported by the at least one tagged protocol;
a first determining subunit configured to determine, based on the functions supported by the at least one markup protocol, a plurality of sub-functions supported by the at least one markup protocol;
and a fourth determining subunit, configured to determine a code corresponding to the at least one tagged protocol based on a plurality of sub-functions supported by the at least one tagged protocol.
In some of these embodiments, between the first determination subunit and the fourth determination subunit, comprising:
a second determining subunit, configured to determine an attribute of each sub-function based on at least one sub-function supported by the at least one tagged protocol; wherein the attributes of each sub-function include: functions that must be implemented and functions that may be implemented;
and the third determining subunit is used for determining a method which is required to be realized or is possible to be realized and corresponds to each sub-function based on the attribute of each sub-function.
In some embodiments, the fourth determining subunit is specifically configured to:
determining an example method and/or a class method corresponding to each sub-function based on at least one sub-function supported by the at least one marked protocol;
and determining codes corresponding to the at least one marked protocol based on the example method and/or the class method corresponding to each sub-function.
In addition, the embodiment of the disclosure also provides an electronic device, which comprises: a processor; a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the class-based application implementation method according to any of the foregoing embodiments of the disclosure.
Next, an electronic device according to an embodiment of the present disclosure is described with reference to fig. 7. The electronic device may be either or both of the first device and the second device, or a stand-alone device independent thereof, which may communicate with the first device and the second device to receive the acquired input signals therefrom. Fig. 7 illustrates a block diagram of an electronic device according to an embodiment of the disclosure. As shown in fig. 7, the electronic device includes one or more processors 71 and memory 72.
The processor 71 may be a Central Processing Unit (CPU) or other form of processing unit having data processing and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
Memory 72 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, random Access Memory (RAM) and/or cache memory (cache), and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like. One or more computer program instructions may be stored on the computer readable storage medium that can be executed by the processor 71 to implement the class-based application implementation methods and/or other desired functions of the software programs of the various embodiments of the present disclosure described above. In one example, the electronic device may further include: an input device 73 and an output device 74, which are interconnected by a bus system and/or other forms of connection mechanisms (not shown).
In addition, the input device 73 may also include, for example, a keyboard, a mouse, and the like.
The output device 74 can output various information to the outside. The output device 74 may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, among others.
Of course, only some of the components of the electronic device relevant to the present disclosure are shown in fig. 7 for simplicity, components such as buses, input/output interfaces, and the like being omitted. In addition, the electronic device may include any other suitable components depending on the particular application.
In addition to the methods and apparatus described above, embodiments of the present disclosure may also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform steps in a class-based application implementation method of a software program of the various embodiments described herein.
The computer program product may write program code for performing the operations of embodiments of the present disclosure in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like 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 computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium, having stored thereon computer program instructions, which when executed by a processor, cause the processor to perform steps in a class-based application implementation method of a software program of the various embodiments described herein.
The computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is 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 (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The basic principles of the present disclosure have been described above in connection with specific embodiments, however, it should be noted that the advantages, benefits, effects, etc. mentioned in the present disclosure are merely examples and not limiting, and these advantages, benefits, effects, etc. are not to be considered as necessarily possessed by the various embodiments of the present disclosure. Furthermore, the specific details disclosed herein are for purposes of illustration and understanding only, and are not intended to be limiting, since the disclosure is not necessarily limited to practice with the specific details described.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, so that the same or similar parts between the embodiments are mutually referred to. For system embodiments, the description is relatively simple as it essentially corresponds to method embodiments, and reference should be made to the description of method embodiments for relevant points.
The block diagrams of the devices, apparatuses, devices, systems referred to in this disclosure are merely illustrative examples and are not intended to require or imply that the connections, arrangements, configurations must be made in the manner shown in the block diagrams. As will be appreciated by one of skill in the art, the devices, apparatuses, devices, systems may be connected, arranged, configured in any manner. Words such as "including," "comprising," "having," and the like are words of openness and mean "including but not limited to," and are used interchangeably therewith. The terms "or" and "as used herein refer to and are used interchangeably with the term" and/or "unless the context clearly indicates otherwise. The term "such as" as used herein refers to, and is used interchangeably with, the phrase "such as, but not limited to.
The methods and apparatus of the present disclosure may be implemented in a number of ways. For example, the methods and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, firmware. The above-described sequence of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the sequence specifically described above unless specifically stated otherwise. Furthermore, in some embodiments, the present disclosure may also be implemented as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
It is also noted that in the apparatus, devices and methods of the present disclosure, components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered equivalent to the present disclosure.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of the disclosure to the form disclosed herein. Although a number of example aspects and embodiments have been discussed above, a person of ordinary skill in the art will recognize certain variations, modifications, alterations, additions, and subcombinations thereof.

Claims (11)

1. A class-based application implementation method, comprising:
acquiring a list of classes in an application program;
traversing a list of classes in the application program, and determining at least one class which cannot be realized by the function;
marking a protocol corresponding to at least one function which cannot be realized in the class which cannot be realized in the at least one function, and obtaining the at least one protocol with the mark;
determining a code corresponding to the at least one tagged protocol based on the at least one tagged protocol;
generating a class supporting the at least one tagged protocol based on a code corresponding to the at least one tagged protocol;
and loading a class supporting the at least one tagged protocol in the class in which the at least one function cannot be implemented.
2. The method of claim 1, wherein the list of classes comprises: at least one function to be realized, protocols supported by each type, and functions corresponding to each protocol.
3. The method of claim 1, wherein the determining a code corresponding to the at least one tagged protocol based on the at least one tagged protocol comprises:
acquiring functionality supported by the at least one tagged protocol based on the at least one tagged protocol;
determining at least one sub-function supported by the at least one tagged protocol based on the at least one tagged protocol supported function;
determining a code corresponding to the at least one tagged protocol based on at least one sub-function supported by the at least one tagged protocol.
4. The method of claim 3, wherein the determining, based on the at least one tagged protocol supported function, between the at least one tagged protocol supported at least one sub-function and the at least one tagged protocol supported based at least one sub-function, determining the code corresponding to the at least one tagged protocol comprises:
determining attributes of the sub-functions based on at least one sub-function supported by the at least one tagged protocol; wherein the attributes of each sub-function include: functions that must be implemented and functions that may be implemented;
and determining a method which is necessary to be realized or can be realized corresponding to each sub-function based on the attribute of each sub-function.
5. The method according to claim 3 or 4, wherein said determining a code corresponding to said at least one tagged protocol based on at least one sub-function supported by said at least one tagged protocol comprises:
determining an example method and/or a class method corresponding to each sub-function based on at least one sub-function supported by the at least one marked protocol;
and determining codes corresponding to the at least one marked protocol based on the example method and/or the class method corresponding to each sub-function.
6. A class-based application implementation apparatus, comprising:
the acquisition module is used for acquiring a list of classes in the application program;
the determining module is used for traversing the list of the classes in the application program and determining at least one class which cannot be realized by the function;
an obtaining module, configured to mark a protocol corresponding to at least one function that cannot be implemented in the class that cannot be implemented by the at least one function, and obtain the at least one marked protocol;
a loading module for loading a class supporting the at least one tagged protocol in a class in which the at least one function is not enabled based on the at least one tagged protocol;
wherein, the loading module includes:
a determining unit, configured to determine a code corresponding to the at least one marked protocol based on the at least one marked protocol;
a generating unit, configured to generate a class supporting the at least one tagged protocol based on a code corresponding to the at least one tagged protocol;
and a loading unit, configured to load a class supporting the at least one protocol with a label in a class that cannot be implemented by the at least one function.
7. The apparatus according to claim 6, wherein the determining unit includes:
an acquisition subunit configured to acquire, based on the at least one tagged protocol, a function supported by the at least one tagged protocol;
a first determining subunit configured to determine, based on the functions supported by the at least one markup protocol, a plurality of sub-functions supported by the at least one markup protocol;
and a fourth determining subunit, configured to determine a code corresponding to the at least one tagged protocol based on a plurality of sub-functions supported by the at least one tagged protocol.
8. The apparatus of claim 7, wherein between the first determination subunit and the fourth determination subunit, comprises:
a second determining subunit, configured to determine an attribute of each sub-function based on at least one sub-function supported by the at least one tagged protocol; wherein the attributes of each sub-function include: functions that must be implemented and functions that may be implemented;
and the third determining subunit is used for determining a method which is required to be realized or is possible to be realized and corresponds to each sub-function based on the attribute of each sub-function.
9. The apparatus according to claim 7 or 8, wherein the fourth determination subunit is specifically configured to:
determining an example method and/or a class method corresponding to each sub-function based on at least one sub-function supported by the at least one marked protocol;
and determining codes corresponding to the at least one marked protocol based on the example method and/or the class method corresponding to each sub-function.
10. A computer readable storage medium, characterized in that the storage medium stores a computer program for executing the class-based application implementation method of any of the preceding claims 1-5.
11. An electronic device, the electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instructions from the memory and execute the instructions to implement the class-based application implementation method according to any of the preceding claims 1-5.
CN202010375199.1A 2020-05-06 2020-05-06 Class-based application implementation method and device, electronic equipment and storage medium Active CN111562909B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010375199.1A CN111562909B (en) 2020-05-06 2020-05-06 Class-based application implementation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010375199.1A CN111562909B (en) 2020-05-06 2020-05-06 Class-based application implementation method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111562909A CN111562909A (en) 2020-08-21
CN111562909B true CN111562909B (en) 2024-04-02

Family

ID=72070862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010375199.1A Active CN111562909B (en) 2020-05-06 2020-05-06 Class-based application implementation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111562909B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0329246D0 (en) * 2003-12-18 2004-01-21 Agilent Technologies Inc Method of translating computer program code, communications system and network management entity therefor
CN101206571A (en) * 2006-12-19 2008-06-25 国际商业机器公司 Method, system and program product for adapting to protocol changes
CN109561104A (en) * 2018-12-28 2019-04-02 深圳市创梦天地科技有限公司 A kind of communication protocol conversion method and device
CN110569282A (en) * 2019-09-04 2019-12-13 中国工商银行股份有限公司 Data processing method, data processing device, computing equipment and computer readable storage medium
CN110795147A (en) * 2018-08-01 2020-02-14 北京京东尚科信息技术有限公司 Interface protocol file management method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8601147B2 (en) * 2008-03-28 2013-12-03 International Business Machines Corporation Export of metadata streams to applications
US20120077546A1 (en) * 2010-09-24 2012-03-29 Nokia Corporation Method and apparatus for customizing application protocols

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0329246D0 (en) * 2003-12-18 2004-01-21 Agilent Technologies Inc Method of translating computer program code, communications system and network management entity therefor
CN101206571A (en) * 2006-12-19 2008-06-25 国际商业机器公司 Method, system and program product for adapting to protocol changes
CN110795147A (en) * 2018-08-01 2020-02-14 北京京东尚科信息技术有限公司 Interface protocol file management method and device
CN109561104A (en) * 2018-12-28 2019-04-02 深圳市创梦天地科技有限公司 A kind of communication protocol conversion method and device
CN110569282A (en) * 2019-09-04 2019-12-13 中国工商银行股份有限公司 Data processing method, data processing device, computing equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
剧忻 ; 苗放 ; .基于MINA开发高性能网络应用程序――以实现XMPP协议Openfire3.3.3为例.重庆工学院学报(自然科学版).2008,(10),全文. *

Also Published As

Publication number Publication date
CN111562909A (en) 2020-08-21

Similar Documents

Publication Publication Date Title
CN107832045B (en) Method and apparatus for cross programming language interface conversion
CN108156022B (en) Service calling method and device and electronic equipment
US20140207826A1 (en) Generating xml schema from json data
US20130159840A1 (en) Document template dynamic token population
CN110489087B (en) Method, device, medium and electronic equipment for generating fractal structure
CN109445841B (en) Interface document management method, device, server and storage medium
CN113126990B (en) Page development method, device, equipment and storage medium
CN110780874B (en) Method and device for generating information
CN113031946A (en) Method and device for rendering page component
CN113407882A (en) Component generation method and device, computer-readable storage medium and electronic equipment
US20080163168A1 (en) Javascript pre-processing framework
CN113761871A (en) Rich text rendering method and device, electronic equipment and storage medium
JP2009031960A (en) Technology for relaying communication between client device and server device
CN111562909B (en) Class-based application implementation method and device, electronic equipment and storage medium
CN110580156A (en) Page processing method and device and electronic equipment
CN113504909B (en) Industrial APP heterogeneous component data exchange method and related equipment
US20090037890A1 (en) Method and system for generating an application
CN110659062B (en) Front-end scaffold configuration method and device, readable storage medium and electronic equipment
CN111475156B (en) Page code generation method and device, electronic equipment and storage medium
US10275432B2 (en) Markup language namespace declaration resolution and preservation
CN111427630B (en) Cold start optimization method and device, electronic equipment and storage medium
CN114090135A (en) Method and device with error correction function and supporting cross-platform calling component
CN111782180A (en) Page generation method and device, electronic equipment and storage medium
CN112905970A (en) Authority verification method and device, computer readable storage medium and electronic equipment
CN112882698A (en) Development environment generation method and device, computer storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant