[go: up one dir, main page]

CN114510300A - Method and equipment for embedding target object in derived class - Google Patents

Method and equipment for embedding target object in derived class Download PDF

Info

Publication number
CN114510300A
CN114510300A CN202210041643.5A CN202210041643A CN114510300A CN 114510300 A CN114510300 A CN 114510300A CN 202210041643 A CN202210041643 A CN 202210041643A CN 114510300 A CN114510300 A CN 114510300A
Authority
CN
China
Prior art keywords
class
business
target object
derived class
derived
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.)
Pending
Application number
CN202210041643.5A
Other languages
Chinese (zh)
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.)
Shanghai Wanwu Xinsheng Environmental Technology Group Co
Original Assignee
Shanghai Wanwu Xinsheng Environmental Technology Group Co
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 Shanghai Wanwu Xinsheng Environmental Technology Group Co filed Critical Shanghai Wanwu Xinsheng Environmental Technology Group Co
Priority to CN202210041643.5A priority Critical patent/CN114510300A/en
Publication of CN114510300A publication Critical patent/CN114510300A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/4492Inheritance
    • 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

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

本申请的目的是提供一种在派生类中嵌入目标对象的方法及设备,本申请通过动态派生目标原生类对应的派生类;为所述派生类创建对应的新的业务逻辑;通过所述派生类获取业务数据;基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识,若存在,则将所述目标对象嵌入至所述派生类,通过创建派生类,并在派生类中加入新的业务逻辑,扩大了业务处理业务数据的能力,减少对原生类的修改和添加,保证了业务的正常运行,实现对目标对象嵌入操作,从而生成区别于原生类的派生类,使得新手在操作处理业务时,在不改变旧业务的正常处理前提下快速上手,了解业务,从而加强业务的效率。

Figure 202210041643

The purpose of this application is to provide a method and device for embedding a target object in a derived class. This application dynamically derives the derived class corresponding to the target native class; creates corresponding new business logic for the derived class; class to obtain business data; analyze and judge whether there is an identifier of the target object to be embedded in the business data based on the new business logic, if so, embed the target object into the derived class, and create a derived class by creating a derived class. , and add new business logic to the derived class, which expands the ability of the business to process business data, reduces the modification and addition of the native class, ensures the normal operation of the business, and realizes the embedded operation of the target object, thereby generating a different class from the native class. The derived class of , enables the novice to quickly get started and understand the business without changing the normal processing of the old business when operating the business, thereby enhancing the efficiency of the business.

Figure 202210041643

Description

一种在派生类中嵌入目标对象的方法及设备A method and device for embedding target object in derived class

技术领域technical field

本申请涉及计算机技术领域,尤其涉及一种在派生类中嵌入目标对象的方法及设备。The present application relates to the field of computer technology, and in particular, to a method and device for embedding a target object in a derived class.

背景技术Background technique

随着互联网的发展,人们的生活发生了翻天覆地的变化。在日常生活中,人们越来越依赖互联网形成的网络体系,同时,互联网涵盖的范围越来越大,功能也随之更加广泛。With the development of the Internet, people's lives have undergone tremendous changes. In daily life, people rely more and more on the network system formed by the Internet. At the same time, the scope of the Internet is getting wider and wider, and the functions are also wider.

在现有技术中,面对功能需求的增加,项目代码中业务代码越来越复杂,并且对应各种场景,业务代码中判断语句也逐渐增多,这使得业务代码复杂繁琐,并且开发人员修改或阅读业务代码时,难以入手,消费时间。尤其对于开发人员中的新人,并不能快速清晰的了解整个项目的结构。同时,开发人员在修改业务代码时,在对原生代码的改动中,会直接影响业务运行效果,这为项目带来不便。In the prior art, in the face of increasing functional requirements, the business code in the project code is becoming more and more complex, and corresponding to various scenarios, the judgment statements in the business code are also gradually increasing, which makes the business code complicated and cumbersome, and developers modify or When reading business code, it is difficult to start and consume time. Especially for new developers, it is not possible to quickly and clearly understand the structure of the whole project. At the same time, when developers modify the business code, the changes to the native code will directly affect the business operation effect, which brings inconvenience to the project.

发明内容SUMMARY OF THE INVENTION

本申请的一个目的是提供一种在派生类中嵌入目标对象的方法及设备,避免了将原生类的修改后对整个业务产生影响的问题,实现了将旧业务与新业务模块的分离,完成了旧业务中原生类的少改动甚至不改动,新业务中派生类中对目标对象嵌入的附加操作。One purpose of the present application is to provide a method and device for embedding a target object in a derived class, which avoids the problem of affecting the entire business after the modification of the native class, realizes the separation of the old business and the new business module, and completes the There are little or no changes to the original classes in the old business, and additional operations on the target object embedded in the derived classes in the new business.

根据本申请的一个方面,提供了一种在派生类中嵌入目标对象的方法,其中,所述方法包括:According to one aspect of the present application, a method for embedding a target object in a derived class is provided, wherein the method includes:

动态派生目标原生类对应的派生类;Dynamically derive the derived class corresponding to the target native class;

为所述派生类创建对应的新的业务逻辑;Create corresponding new business logic for the derived class;

通过所述派生类获取业务数据;Obtain business data through the derived class;

基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识,Based on the new business logic analysis and judging whether there is an identifier of the target object to be embedded in the business data,

若存在,则将所述目标对象嵌入至所述派生类。If present, embed the target object in the derived class.

进一步地,上述方法中,所述方法还包括:Further, in the above method, the method also includes:

保存所述目标原生类的原有业务逻辑。The original business logic of the target native class is saved.

进一步地,上述方法中,所述派生类对应的新的业务逻辑包括所述目标原生类的原有业务逻辑;Further, in the above method, the new business logic corresponding to the derived class includes the original business logic of the target native class;

其中,所述基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识之后,还包括:Wherein, after analyzing and judging whether there is an identifier of the target object to be embedded in the business data based on the new business logic, the method further includes:

若不存在,则通过所述新的业务逻辑中的所述原有业务逻辑,对所述业务数据进行业务处理。If it does not exist, business processing is performed on the business data through the original business logic in the new business logic.

进一步地,上述方法中,所述若存在,则将所述目标对象嵌入至所述派生类,包括:Further, in the above method, if there is, embedding the target object into the derived class, including:

若存在,则从所述业务数据中确定出待嵌入的目标对象的嵌入位置,并按照所述嵌入位置将所述目标对象嵌入至所述派生类。If it exists, the embedded position of the target object to be embedded is determined from the business data, and the target object is embedded in the derived class according to the embedded position.

进一步地,上述方法中,所述基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识,包括:Further, in the above method, analyzing and judging whether there is an identifier of the target object to be embedded in the business data based on the new business logic includes:

基于所述新的业务逻辑,对所述业务数据中的每行和/或每列进行分析,以判断所述业务数据中是否存在待嵌入的目标对象的标识。Based on the new business logic, each row and/or each column in the business data is analyzed to determine whether there is an identifier of the target object to be embedded in the business data.

进一步地,上述方法中,所述方法还包括,Further, in the above method, the method also includes,

将所述目标原生类的业务指针指向已嵌入所述目标对象后的派生类;Point the business pointer of the target native class to the derived class that has been embedded in the target object;

运行所述业务指针所指向的所述已嵌入所述目标对象后的派生类。The derived class pointed to by the business pointer and embedded in the target object is executed.

根据本申请的另一方面,还提供了一种非易失性存储介质,其上存储有计算机可读指令,所述计算机可读指令可被处理器执行时,使所述处理器实现如上述一种在派生类中嵌入目标对象的方法。According to another aspect of the present application, there is also provided a non-volatile storage medium having computer-readable instructions stored thereon, and when the computer-readable instructions can be executed by a processor, the processor can implement the above-mentioned A way to embed a target object in a derived class.

根据本申请的另一方面,还提供了一种在派生类中嵌入目标对象的设备,其中,该设备包括:According to another aspect of the present application, a device for embedding a target object in a derived class is also provided, wherein the device includes:

一个或多个处理器;one or more processors;

计算机可读介质,用于存储一个或多个计算机可读指令,a computer-readable medium for storing one or more computer-readable instructions,

当所述一个或多个计算机可读指令被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述一种在派生类中嵌入目标对象的方法。The one or more computer-readable instructions, when executed by the one or more processors, cause the one or more processors to implement a method of embedding a target object in a derived class as described above.

与现有技术相比,本申请通过动态派生目标原生类对应的派生类;为所述派生类创建对应的新的业务逻辑;通过所述派生类获取业务数据;基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识,若存在,则将所述目标对象嵌入至所述派生类,通过创建派生类,并在派生类中加入新的业务逻辑,扩大了业务处理业务数据的能力范围,减少对原生类的修改和添加,从而保证了业务的正常运行,实现对目标对象嵌入操作,从而生成区别于原生类的派生类,使得新手在处理业务时,不改变旧业务的正常处理前提下快速上手,了解业务,从而加强业务整体运行的效率。Compared with the prior art, the present application dynamically derives the derived class corresponding to the target native class; creates corresponding new business logic for the derived class; obtains business data through the derived class; analyzes based on the new business logic And determine whether there is an identifier of the target object to be embedded in the business data, if there is, then embed the target object into the derived class, by creating a derived class, and adding new business logic in the derived class to expand It reduces the ability of the business to process business data, reduces the modification and addition of the native class, thus ensures the normal operation of the business, realizes the embedded operation of the target object, and generates a derived class that is different from the native class, so that the novice can handle the business. Quickly get started and understand the business without changing the normal processing of the old business, thereby enhancing the efficiency of the overall operation of the business.

附图说明Description of drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

图1示出根据本申请的一种在派生类中嵌入目标对象的方法的流程示意图。FIG. 1 shows a schematic flowchart of a method for embedding a target object in a derived class according to the present application.

附图中相同或相似的附图标记代表相同或相似的部件。The same or similar reference numbers in the drawings represent the same or similar parts.

具体实施方式Detailed ways

下面结合附图对本申请作进一步详细描述。The present application will be described in further detail below with reference to the accompanying drawings.

在本申请一个典型的配置中,终端、服务网络的设备和可信方均包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.

内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-persistent memory in computer readable media, random access memory (RAM) and/or non-volatile memory in the form of, for example, read only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.

计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology. Information may be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, excludes non-transitory computer-readable media, such as modulated data signals and carrier waves.

如图1所示,本申请一个方面的一种在派生类中嵌入目标对象的方法的流程示意图,其中,所述方法包括步骤S11、步骤S12、步骤S13及步骤S14,具体包括如下步骤:As shown in FIG. 1, an aspect of the present application is a schematic flowchart of a method for embedding a target object in a derived class, wherein the method includes step S11, step S12, step S13 and step S14, and specifically includes the following steps:

步骤S11,动态派生目标原生类对应的派生类,在此,所述派生类利用继承机制,继承原生类中所有对象信息。Step S11 , dynamically derive a derived class corresponding to the target native class, where the derived class inherits all object information in the native class by using an inheritance mechanism.

例如,在业务中存在原生类a,其中,原生类a中存在位置1中的对象1,位置2中的对象2,将原生类a作为目标原生类,动态派生目标原生类(即原生类a)对应的派生类A,派生类A利用继承机制,继承原生类a中对象信息,得到包括位置1中的对象1以及位置2中的对象2派生类A,实现了对原生类的复刻,使得在后续对派生类进行嵌入操作中不影响原生类的信息,保护原生类,从而使得业务更加稳定。For example, there is a native class a in the business, in which there is an object 1 in position 1 and an object 2 in position 2 in the native class a. The native class a is used as the target native class, and the target native class is dynamically derived (that is, the native class a ) The corresponding derived class A, the derived class A uses the inheritance mechanism to inherit the object information in the native class a, and obtains the derived class A including the object 1 in position 1 and the object 2 in position 2, which realizes the reproduction of the original class, This makes the information of the native class not affected in the subsequent embedding operation of the derived class, protects the native class, and makes the business more stable.

步骤S12,为所述派生类创建对应的新的业务逻辑,需要说明的是,业务逻辑是指业务函数,业务方法等分析处理业务数据的逻辑代码。Step S12 , creating a corresponding new business logic for the derived class. It should be noted that the business logic refers to logic codes for analyzing and processing business data, such as business functions and business methods.

步骤S13,通过所述派生类获取业务数据,需要说明的是,业务数据是指业务中响应于用户操作而产生的数据信号,包括但不限于数据流,目标对象标识等数据信息。Step S13: Obtain business data through the derived class. It should be noted that the business data refers to data signals generated in the business in response to user operations, including but not limited to data streams, target object identifiers and other data information.

步骤S14,基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识,若存在,则将所述目标对象嵌入至所述派生类。Step S14, based on the new business logic analysis and judging whether there is an identifier of the target object to be embedded in the business data, and if so, the target object is embedded in the derived class.

通过上述步骤S11至步骤S14,实现了在派生类中嵌入目标对象的操作,完成原生类的保护,达到派生类和原生类模块分离,减少了对原生类的修改和添加,有效避免了因原生类的改变带来的问题,以便在实际应用场景中的新开发者能够更好参与到业务中,并快速了解业务。Through the above steps S11 to S14, the operation of embedding the target object in the derived class is realized, the protection of the native class is completed, the separation of the derived class and the native class module is achieved, the modification and addition of the native class is reduced, and the original class is effectively avoided. The problems brought about by the change of classes, so that new developers in practical application scenarios can better participate in the business and quickly understand the business.

在本申请一优选实施例,在业务中存在原生类a,其中,原生类a中存在对象1和对象2,将原生类a作为目标原生类,动态派生原生类a对应的派生类A,派生类A利用继承机制,继承原生类a中的对象信息,得到包括对象1和对象2的派生类A,在派生类A中创建新的业务逻辑N,通过派生类A获取业务数据后,所述派生类A利用创建的所述新的业务逻辑N对业务数据进行分析和判断,分析出业务数据中存在对象3的标识,即目标对象是对象3,则将该标识对应的,对象3嵌入至派生类A中,得到包括对象1、对象2和对象3的派生类A’,其中,派生类A’为在派生类A中插入了对象3后的派生类,实现将目标对象嵌入至派生类的操作。In a preferred embodiment of the present application, there is a native class a in the business, in which there are objects 1 and 2 in the native class a, the native class a is used as the target native class, the derived class A corresponding to the native class a is dynamically derived, and the derived class A is derived. Class A uses the inheritance mechanism to inherit the object information in the native class a, obtains the derived class A including object 1 and object 2, creates a new business logic N in the derived class A, and obtains business data through the derived class A, the described Derivative class A utilizes the described new business logic N created to analyze and judge the business data, and analyzes that the identification of object 3 exists in the business data, that is, the target object is object 3, then the identification is corresponding, and object 3 is embedded in the In the derived class A, a derived class A' including object 1, object 2 and object 3 is obtained, wherein the derived class A' is a derived class after inserting object 3 into the derived class A, and the target object is embedded in the derived class. operation.

接着本申请上述实施例,本申请一个方面提供的一种在派生类中嵌入目标对象的方法还包括:保存所述目标原生类的原有业务逻辑。Following the above embodiment of the present application, an aspect of the present application provides a method for embedding a target object in a derived class, further comprising: saving the original business logic of the target native class.

例如,在业务中存在原生类a和原生类a的原有业务逻辑M,将原生类a作为目标原生类,动态派生原生类a对应的派生类A,派生类A利用继承机制,继承原生类a中对象信息,同时,保存原生类a的原有业务逻辑M,不仅保留了原生类中的对象,还将原有业务逻辑也进行保存,使得对原生类的保护更加完整,业务的运行也更加稳定,减少嵌入目标对象带来的压力。For example, there are native class a and original business logic M of native class a in the business, take native class a as the target native class, dynamically derive derived class A corresponding to native class a, and derived class A uses the inheritance mechanism to inherit the native class The object information in a, and at the same time, the original business logic M of the native class a is saved, which not only retains the objects in the native class, but also saves the original business logic, which makes the protection of the native class more complete and the operation of the business. More stable and less stressful to embed the target object.

接着本申请上述实施例,所述派生类对应的新的业务逻辑包括所述目标原生类的原有业务逻辑;Following the above-mentioned embodiment of the present application, the new business logic corresponding to the derived class includes the original business logic of the target native class;

其中,所述步骤S14中的基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识之后,还包括:Wherein, after analyzing and judging whether there is an identifier of the target object to be embedded in the business data based on the new business logic analysis in the step S14, the method further includes:

若不存在,则通过所述新的业务逻辑中的所述原有业务逻辑,对所述业务数据进行业务处理。If it does not exist, business processing is performed on the business data through the original business logic in the new business logic.

例如,在业务中存在原生类a和原生类a的原有业务逻辑M,其中,原生类a中包括对象1和对象2,将原生类a作为目标原生对象,动态派生得到派生类A,根据继承机制,得到的派生类A中包括对象1和对象2,创建新的业务逻辑N,其中,所述新的业务逻辑N中包括原有业务逻辑M,通过派生类A获取业务数据,根据新的业务逻辑N对业务数据进行分析和判断,若判断得到的结果为业务数据中不携带任何目标对象的标识,则通过原有业务逻辑M来对所述业务数据进行业务处理,实现了在业务数据不存在待嵌入的对象的标识时,采用原有业务逻辑对获取的所述业务数据进行对应的业务处理,使得本申请不仅对业务数据中目标对象的标识进行分析,还可以对不携带目标对象标识的其余数据进行分析处理,实现业务数据分析更加完整,避免业务处理产生漏洞,业务运行也更加顺利。For example, there are original business logic M of native class a and native class a in the business, where native class a includes object 1 and object 2, and native class a is used as the target native object, and derived class A is dynamically derived according to Inheritance mechanism, the derived class A includes object 1 and object 2, and a new business logic N is created, wherein the new business logic N includes the original business logic M, and business data is obtained through the derived class A, according to the new business logic N. The business logic N analyzes and judges the business data. If the result of the judgment is that the business data does not carry the identifier of any target object, the original business logic M is used to perform business processing on the business data, so that the business When the data does not have the identification of the object to be embedded, the original business logic is used to perform corresponding business processing on the acquired business data, so that the present application not only analyzes the identification of the target object in the business data, but also can perform the corresponding business processing on the business data that does not carry the target object. The remaining data of the object identification is analyzed and processed to achieve more complete business data analysis, avoid business processing loopholes, and business operations are more smooth.

接着本申请上述实施例,所述步骤S14中的若存在,则将所述目标对象嵌入至所述派生类,具体包括:Following the above-mentioned embodiment of the present application, if there exists in the step S14, the target object is embedded in the derived class, which specifically includes:

若存在,则从所述业务数据中确定出待嵌入的目标对象的嵌入位置,并按照所述嵌入位置将所述目标对象嵌入至所述派生类,利用嵌入位置,使得准确无误的将目标对象嵌入至派生类,提高了嵌入的准确率,加强业务运行效果。If it exists, determine the embedded position of the target object to be embedded from the business data, and embed the target object into the derived class according to the embedded position, and use the embedded position to accurately insert the target object. Embedding into derived classes improves the accuracy of embedding and enhances the effect of business operations.

例如,在本申请又一优选实施例中,若业务中存在原生类a,其中,原生类a中优选存在对象1以及对象2,其中对象1位于位置1,对象2位于位置2,将原生类a作为目标原生类,动态派生原生类a对应的派生类A,根据继承机制,得到包括对象1以及对象2的派生类A,并且派生类A中同样对象1位于位置1,对象2位于位置2,在派生类A中创建新的业务逻辑N,通过派生类A获取业务数据后,派生类A利用创建的所述新的业务逻辑N对业务数据进行分析和判断,得到业务数据中存在对象3,即目标对象是对象3,此时确定对象3的嵌入位置为3,即,目标对象3位于对象1,对象2之后,根据对象3的嵌入位置,将对象3嵌入至位置3,最终得到对象1,对象2,对象3的派生类A’,其中,派生类A’为在派生类A中插入了对象3后的派生类,在派生类A’中对象1位于位置1,对象2位于位置2,对象3位于位置3,完成目标对象的嵌入。For example, in another preferred embodiment of the present application, if there is a native class a in the business, the native class a preferably includes object 1 and object 2, wherein object 1 is located at position 1 and object 2 is located at position 2, and the native class is located in position 2. a as the target native class, dynamically derives the derived class A corresponding to the native class a. According to the inheritance mechanism, the derived class A including object 1 and object 2 is obtained, and the same object 1 in the derived class A is located at position 1, and object 2 is located at position 2 , create a new business logic N in the derived class A, after obtaining the business data through the derived class A, the derived class A uses the created new business logic N to analyze and judge the business data, and obtain the object 3 in the business data. , that is, the target object is object 3. At this time, the embedded position of object 3 is determined to be 3, that is, the target object 3 is located in object 1 and after object 2. According to the embedded position of object 3, object 3 is embedded in position 3, and finally the object is obtained. 1. Object 2, the derived class A' of object 3, where the derived class A' is the derived class after inserting the object 3 into the derived class A. In the derived class A', the object 1 is located at the position 1, and the object 2 is located at the position 2. Object 3 is located at position 3, completing the embedding of the target object.

接着本申请上述实施例,所述步骤S14中的基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识,具体包括:Following the above-mentioned embodiment of the present application, in the step S14, analyzing and judging whether there is an identifier of the target object to be embedded in the business data based on the new business logic specifically includes:

基于所述新的业务逻辑,对所述业务数据中的每行和/或每列进行分析,以判断所述业务数据中是否存在待嵌入的目标对象的标识。Based on the new business logic, each row and/or each column in the business data is analyzed to determine whether there is an identifier of the target object to be embedded in the business data.

在本申请一优选实施例中,在业务中存在原生类a,其中,原生类a中优选存在对象1和对象2,将原生类a作为目标原生类,动态派生原生类a对应的派生类A,派生类A利用继承机制,继承原生类a中对象信息,得到包括对象1和对象2的派生类A,在派生类A中创建新的业务逻辑N,通过派生类A获取业务数据后,基于创建的所述新的业务逻辑N优选对业务数据中每行和/或每列数据进行分析和判断,分析出业务数据中存在对象3的标识,即目标对象是对象3,则将该标识对应的对象3嵌入至所述派生类A中,异得到包括对象1、对象2和对象3的派生类A’,其中,派生类A’为在派生类A中插入了对象3后的派生类,通过对业务数据的每行/或每列的形式,实现了有规律地对业务数据进行全面分析,使得分析判断出的结果更加准确。In a preferred embodiment of the present application, there is a native class a in the business, wherein, there are preferably objects 1 and 2 in the native class a, the native class a is used as the target native class, and the derived class A corresponding to the native class a is dynamically derived , the derived class A uses the inheritance mechanism to inherit the object information in the native class a, obtains the derived class A including object 1 and object 2, creates a new business logic N in the derived class A, and obtains business data through the derived class A, based on The created new business logic N preferably analyzes and judges each row and/or column of data in the business data, and analyzes that there is an identifier of object 3 in the business data, that is, the target object is object 3, then the identifier corresponds to The object 3 is embedded in the derived class A, and the derived class A' including the object 1, the object 2 and the object 3 is obtained, wherein the derived class A' is the derived class after inserting the object 3 into the derived class A, Through the form of each row/column of the business data, a regular and comprehensive analysis of the business data is realized, so that the result of the analysis and judgment is more accurate.

接着本申请上述实施例,本申请一个方面提供的一种在派生类中嵌入目标对象的方法还包括:Following the above-mentioned embodiment of the present application, a method for embedding a target object in a derived class provided by an aspect of the present application further includes:

将所述目标原生类的业务指针指向已嵌入所述目标对象后的派生类;Point the business pointer of the target native class to the derived class that has been embedded in the target object;

运行所述业务指针所指向的所述已嵌入所述目标对象后的派生类。The derived class pointed to by the business pointer and embedded in the target object is executed.

例如,在本申请一优选实施例中,在业务中存在原生类a,其中,原生类a中优选存在对象1和对象2,同时原生类a中存在指向原生类a的业务指针Q,将原生类a作为目标原生类,动态派生原生类a对应的派生类A,派生类A利用继承机制,继承原生类a中的对象信息,得到包括对象1和对象2的派生类A,在派生类A中创建新的业务逻辑N,通过派生类A获取业务数据后,派生类A利用创建的所述新的业务逻辑N对业务数据进行分析和判断,分析出所述业务数据中存在对象3的标识,即目标对象是对象3,则将该标识对应的对象3嵌入派生类A中,得到包括对象1、对象2和对象3的派生类A’,其中,派生类A’为在派生类A中插入了对象3后的派生类,则将业务指针Q指向已经嵌入目标对象(即对象3)的派生类A’,运行所述业务指针Q指向的派生类A’,完成业务运行处理,通过业务指针所指向的派生类的修改,产生与派生类A’对应的业务,实现了将派生类在新业务中处理,并且不影响旧业务的运行,达到了新业务和旧业务模块的分离。For example, in a preferred embodiment of the present application, there is a native class a in the business, wherein, preferably, object 1 and object 2 exist in the native class a, and at the same time, there is a business pointer Q pointing to the native class a in the native class a. Class a is used as the target native class, and the derived class A corresponding to the native class a is dynamically derived. The derived class A uses the inheritance mechanism to inherit the object information in the native class a, and obtains the derived class A including object 1 and object 2. In the derived class A Create a new business logic N in , after obtaining business data through the derived class A, the derived class A uses the created new business logic N to analyze and judge the business data, and analyzes that there is an identifier of the object 3 in the business data. , that is, the target object is object 3, then the object 3 corresponding to the identifier is embedded in the derived class A, and the derived class A' including the object 1, the object 2 and the object 3 is obtained, wherein the derived class A' is in the derived class A. After inserting the derived class of object 3, point the business pointer Q to the derived class A' that has been embedded in the target object (ie object 3), run the derived class A' pointed to by the business pointer Q, complete the business operation process, and pass the business The modification of the derived class pointed to by the pointer generates the business corresponding to the derived class A', realizes the processing of the derived class in the new business, does not affect the operation of the old business, and achieves the separation of the new business and the old business module.

根据本申请的另一方面,还提供了一种非易失性存储介质,其上存储有计算机可读指令,所述计算机可读指令可被处理器执行时,使所述处理器实现如上述一种在派生类中嵌入目标对象的方法。According to another aspect of the present application, there is also provided a non-volatile storage medium having computer-readable instructions stored thereon, and when the computer-readable instructions can be executed by a processor, the processor can implement the above-mentioned A way to embed a target object in a derived class.

根据本申请的另一方面,还提供了一种在派生类中嵌入目标对象的设备,其中,该设备包括:According to another aspect of the present application, a device for embedding a target object in a derived class is also provided, wherein the device includes:

一个或多个处理器;one or more processors;

计算机可读介质,用于存储一个或多个计算机可读指令,a computer-readable medium for storing one or more computer-readable instructions,

当所述一个或多个计算机可读指令被所述一个或多个处理器执行,使得所述一个或多个处理器实现如上述设备的一种在派生类中嵌入目标对象的方法。The one or more computer-readable instructions, when executed by the one or more processors, cause the one or more processors to implement a method of embedding a target object in a derived class of the apparatus as described above.

在此,所述在派生类中嵌入目标对象的设备中的各实施例的详细内容,具体可参见上述设备的一种在派生类中嵌入目标对象的方法的实施例的对应部分,在此,不再赘述。Here, for the details of the various embodiments of the device for embedding a target object in a derived class, reference may be made to the corresponding part of the embodiment of a method for embedding a target object in a derived class of the above-mentioned device. Here, No longer.

综上所述,本申请通过动态派生目标原生类对应的派生类;为所述派生类创建对应的新的业务逻辑;通过所述派生类获取业务数据;基于所述新的业务逻辑分析并判断所述业务数据中是否存在待嵌入的目标对象的标识,若存在,则将所述目标对象嵌入至所述派生类,通过创建派生类,并在派生类中加入新的业务逻辑,扩大了业务处理业务数据的能力,减少对原生类的修改和添加,保证了业务的正常运行,实现对目标对象嵌入操作,从而生成区别于原生类的派生类,使得新手在操作处理业务时,在不改变旧业务的正常处理前提下快速上手,了解业务,从而加强业务的效率。To sum up, this application dynamically derives the derived class corresponding to the target native class; creates corresponding new business logic for the derived class; obtains business data through the derived class; analyzes and judges based on the new business logic Whether there is an identifier of the target object to be embedded in the business data, if so, the target object is embedded in the derived class, and the business is expanded by creating a derived class and adding new business logic to the derived class. The ability to process business data, reduce the modification and addition of native classes, ensure the normal operation of the business, and realize the embedded operation of the target object, thereby generating a derived class that is different from the native class, so that novices can operate the business without changing the Under the premise of normal processing of old business, you can quickly get started and understand the business, thereby enhancing the efficiency of the business.

需要注意的是,本申请可在软件和/或软件与硬件的组合体中被实施,例如,可采用专用集成电路(ASIC)、通用目的计算机或任何其他类似硬件设备来实现。在一个实施例中,本申请的软件程序可以通过处理器执行以实现上文所述步骤或功能。同样地,本申请的软件程序(包括相关的数据结构)可以被存储到计算机可读记录介质中,例如,RAM存储器,磁或光驱动器或软磁盘及类似设备。另外,本申请的一些步骤或功能可采用硬件来实现,例如,作为与处理器配合从而执行各个步骤或功能的电路。It should be noted that the present application may be implemented in software and/or a combination of software and hardware, eg, an application specific integrated circuit (ASIC), a general purpose computer, or any other similar hardware device. In one embodiment, the software program of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs of the present application (including associated data structures) may be stored on a computer-readable recording medium, such as RAM memory, magnetic or optical drives or floppy disks, and the like. In addition, some steps or functions of the present application may be implemented in hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.

另外,本申请的一部分可被应用为计算机程序产品,例如计算机程序指令,当其被计算机执行时,通过该计算机的操作,可以调用或提供根据本申请的方法和/或技术方案。而调用本申请的方法的程序指令,可能被存储在固定的或可移动的记录介质中,和/或通过广播或其他信号承载媒体中的数据流而被传输,和/或被存储在根据所述程序指令运行的计算机设备的工作存储器中。在此,根据本申请的一个实施例包括一个装置,该装置包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发该装置运行基于前述根据本申请的多个实施例的方法和/或技术方案。In addition, a part of the present application can be applied as a computer program product, such as computer program instructions, which when executed by a computer, through the operation of the computer, can invoke or provide methods and/or technical solutions according to the present application. The program instructions for invoking the methods of the present application may be stored in fixed or removable recording media, and/or transmitted via data streams in broadcast or other signal-bearing media, and/or stored in accordance with the in the working memory of the computer device on which the program instructions are executed. Here, an embodiment according to the present application includes an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein, when the computer program instructions are executed by the processor, a trigger is The apparatus operates based on the aforementioned methods and/or technical solutions according to various embodiments of the present application.

对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。装置权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。It will be apparent to those skilled in the art that the present application is not limited to the details of the above-described exemplary embodiments, but that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Accordingly, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the application is to be defined by the appended claims rather than the foregoing description, which is therefore intended to fall within the scope of the claims. All changes within the meaning and scope of the equivalents of , are included in this application. Any reference signs in the claims shall not be construed as limiting the involved claim. Furthermore, it is clear that the word "comprising" does not exclude other units or steps and the singular does not exclude the plural. Several units or means recited in the device claims can also be realized by one unit or means by means of software or hardware. The terms first, second, etc. are used to denote names and do not denote any particular order.

Claims (8)

1. A method of embedding a target object in a derived class, wherein the method comprises:
dynamically deriving a derived class corresponding to the target native class;
creating a corresponding new business logic for the derived class;
acquiring service data through the derived classes;
analyzing and judging whether the identification of the target object to be embedded exists in the service data or not based on the new service logic,
and if so, embedding the target object into the derived class.
2. The method of claim 1, wherein the method further comprises:
and saving the original business logic of the target native class.
3. The method of claim 1 or 2, wherein the new business logic corresponding to the derived class comprises the original business logic of the target native class;
after analyzing and judging whether the service data has the identifier of the target object to be embedded based on the new service logic, the method further includes:
and if the service data does not exist, performing service processing on the service data through the original service logic in the new service logic.
4. The method of claim 1, wherein said embedding the target object, if any, into the derived class comprises:
if the target object exists, determining the embedding position of the target object to be embedded from the business data, and embedding the target object into the derived class according to the embedding position.
5. The method of claim 1, wherein the analyzing and determining whether an identification of a target object to be embedded exists in the business data based on the new business logic comprises:
and analyzing each line and/or column in the business data based on the new business logic to judge whether the identification of the target object to be embedded exists in the business data.
6. The method of claim 1, wherein the method further comprises,
directing the business pointer of the target native class to the derived class embedded with the target object;
and operating the derived class pointed by the service pointer after the target object is embedded.
7. A non-transitory storage medium having stored thereon computer readable instructions which, when executed by a processor, cause the processor to implement the method of any one of claims 1 to 6.
8. An apparatus for embedding a target object in a derived class, wherein the apparatus comprises:
one or more processors;
a computer-readable medium for storing one or more computer-readable instructions,
when executed by the one or more processors, cause the one or more processors to implement the method of claims 1-6.
CN202210041643.5A 2022-01-14 2022-01-14 Method and equipment for embedding target object in derived class Pending CN114510300A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210041643.5A CN114510300A (en) 2022-01-14 2022-01-14 Method and equipment for embedding target object in derived class

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210041643.5A CN114510300A (en) 2022-01-14 2022-01-14 Method and equipment for embedding target object in derived class

Publications (1)

Publication Number Publication Date
CN114510300A true CN114510300A (en) 2022-05-17

Family

ID=81550689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210041643.5A Pending CN114510300A (en) 2022-01-14 2022-01-14 Method and equipment for embedding target object in derived class

Country Status (1)

Country Link
CN (1) CN114510300A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116400988A (en) * 2023-06-08 2023-07-07 中航信移动科技有限公司 Target parameter returning method, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080005065A1 (en) * 2006-02-27 2008-01-03 Microsoft Corporation Base business object key
CN103324470A (en) * 2012-03-21 2013-09-25 阿里巴巴集团控股有限公司 Web system generation method and device
CN104838324A (en) * 2012-10-08 2015-08-12 费希尔-罗斯蒙特系统公司 Dynamically reusable classes
CN105630489A (en) * 2015-12-21 2016-06-01 畅捷通信息技术股份有限公司 Data processing method and data processing device
CN111722888A (en) * 2020-06-19 2020-09-29 浪潮电子信息产业股份有限公司 An operation execution method, apparatus, device and readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080005065A1 (en) * 2006-02-27 2008-01-03 Microsoft Corporation Base business object key
CN103324470A (en) * 2012-03-21 2013-09-25 阿里巴巴集团控股有限公司 Web system generation method and device
CN104838324A (en) * 2012-10-08 2015-08-12 费希尔-罗斯蒙特系统公司 Dynamically reusable classes
CN105630489A (en) * 2015-12-21 2016-06-01 畅捷通信息技术股份有限公司 Data processing method and data processing device
CN111722888A (en) * 2020-06-19 2020-09-29 浪潮电子信息产业股份有限公司 An operation execution method, apparatus, device and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116400988A (en) * 2023-06-08 2023-07-07 中航信移动科技有限公司 Target parameter returning method, storage medium and electronic equipment
CN116400988B (en) * 2023-06-08 2023-08-11 中航信移动科技有限公司 Target parameter returning method, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN107122296B (en) Method and apparatus for data assertion for test interface
WO2022095520A1 (en) Document editing method and device, server, terminal, and storage medium
US8141052B2 (en) Instrumenting software for enhanced diagnosability
CN104360920B (en) A kind of automatic interface testing method and device
US20200293519A1 (en) Solution for implementing computing service based on structured query language statement
CN107092535B (en) Method and apparatus for data storage of test interface
CN110309099B (en) Interface management method, device, equipment and computer-readable storage medium
CN111221869B (en) Method and device for tracking database transaction time and analyzing database lock
US20090192761A1 (en) Performance-testing a system with functional-test software and a transformation-accelerator
CN103226510B (en) Resolve the method and apparatus of vmcore file
CN114610951A (en) Data processing method, apparatus, electronic device and readable storage medium
CN113157477A (en) Memory leak attribution method and device, electronic equipment and storage medium
CN111899087A (en) Data providing method and device, electronic equipment and computer readable storage medium
CN108959055A (en) Readwrite performance test method, device and the equipment of xfs file system
CN114510300A (en) Method and equipment for embedding target object in derived class
CN116107781A (en) Log tracking method, device, electronic equipment and computer program product
CN112685072B (en) Method, device, equipment and storage medium for generating communication address knowledge base
CN113760696B (en) A program problem locating method, device, electronic device and storage medium
CN114968795A (en) Test method, test device, electronic equipment and computer storage medium
CN114895851A (en) Data processing method, device, storage medium and electronic device
CN107766216A (en) It is a kind of to be used to obtain the method and apparatus using execution information
CN115051824A (en) Vertical override detection method, system, equipment and storage medium
CN114330278A (en) Method and equipment for judging consistency of returned data
CN110825809A (en) Storage method and device for drug response information
US8321844B2 (en) Providing registration of a communication

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: Room 1101-1103, No. 433, Songhu Road, Yangpu District, Shanghai

Applicant after: Shanghai Wanwu Xinsheng Information Technology Group Co.,Ltd.

Address before: Room 1101-1103, No. 433, Songhu Road, Yangpu District, Shanghai

Applicant before: Shanghai wanwansheng Environmental Protection Technology Group Co.,Ltd.

Country or region before: China