CN111008254A - Object creating method and device, computer equipment and storage medium - Google Patents

Object creating method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111008254A
CN111008254A CN201911221404.2A CN201911221404A CN111008254A CN 111008254 A CN111008254 A CN 111008254A CN 201911221404 A CN201911221404 A CN 201911221404A CN 111008254 A CN111008254 A CN 111008254A
Authority
CN
China
Prior art keywords
data
member variable
receiver
sender
target object
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911221404.2A
Other languages
Chinese (zh)
Other versions
CN111008254B (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 Ruian Technology Co Ltd
Original Assignee
Beijing Ruian 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 Ruian Technology Co Ltd filed Critical Beijing Ruian Technology Co Ltd
Priority to CN201911221404.2A priority Critical patent/CN111008254B/en
Publication of CN111008254A publication Critical patent/CN111008254A/en
Application granted granted Critical
Publication of CN111008254B publication Critical patent/CN111008254B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses an object creating method, an object creating device, computer equipment and a storage medium. The method comprises the following steps: the data receiver responds to a data mapping request of the data sender, and acquires a target object and text information matched with the data mapping request; wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables; the data receiver creates at least one receiver member variable according to each database field corresponding to the target object; and the data receiver uses the text information to assign values to the member variables of the receiver according to the mapping relation between the member variables of the sender and the member variables of the receiver to obtain a data mapping result. By using the technical scheme of the invention, the expandability of data transmission among different systems can be realized.

Description

Object creating method and device, computer equipment and storage medium
Technical Field
The present invention relates to data processing technologies, and in particular, to an object creating method and apparatus, a computer device, and a storage medium.
Background
When data is transmitted between different systems, a data receiving system needs to acquire data information from an interface provided by a data sending system, and then the data is mapped to an entity object of the system according to a certain rule.
In the prior art, as shown in fig. 1, a data sending system converts data in a Relational database into an entity Object through an Object Relational Mapping (ORM) framework, a Web Service converts the entity Object of the system into a text format, encapsulates the text into an HTTP (Hypertext Transfer Protocol) request, and sends the HTTP request to an interface provided by a data receiving system. After receiving the request, the interface of the data receiver system analyzes the text through Web Service, converts the text into an entity object of the system, and then performs data processing through an ORM framework or stores the entity object into a warehouse.
In the process of implementing the invention, the inventor finds that the prior art has the following defects: the mapping relation between the text and the entity object of the data receiver system and the data sender system needs to be kept highly consistent, and the attribute content and the development format of the entity need to be kept highly uniform, so that the expandability of the system is poor.
Disclosure of Invention
The embodiment of the invention provides an object creating method, an object creating device, computer equipment and a storage medium, so as to realize expandability of data transmission between different systems through interfaces.
In a first aspect, an embodiment of the present invention provides an object creating method, where the method includes:
the data receiver responds to a data mapping request of the data sender, and acquires a target object and text information matched with the data mapping request;
wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables;
the data receiver creates at least one receiver member variable according to each database field corresponding to the target object;
and the data receiver uses the text information to assign values to the member variables of the receiver according to the mapping relation between the member variables of the sender and the member variables of the receiver to obtain a data mapping result.
In a second aspect, an embodiment of the present invention further provides an object creating apparatus, where the apparatus includes:
the target object and text information acquisition module is used for enabling a data receiver to respond to a data mapping request of a data sender and acquiring a target object and text information matched with the data mapping request;
wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables;
a receiver member variable creation module, configured to enable the data receiver to create at least one receiver member variable according to each database field corresponding to the target object;
and the receiver member variable assignment module is used for enabling the data receiver to assign the variables of the receivers by using the text information according to the mapping relation between the sender member variables and the receiver member variables to obtain data mapping results.
In a third aspect, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the object creation method according to any one of the embodiments of the present invention when executing the program.
In a fourth aspect, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are used to perform the object creation method according to any one of the embodiments of the present invention.
According to the embodiment of the invention, the data receiver acquires the target object and the text information according to the data mapping request, the receiver member variable is established according to the database field corresponding to the target object, and the assignment is carried out on the receiver member variable according to the mapping relation between the receiver member variable and the sender member variable and the text information, so that the problem of poor system expandability caused by the fact that the mapping relation between the text information and the object between the data receiver and the data sender needs to be kept consistent in the prior art is solved, and the expandability in data transmission between different systems is realized.
Drawings
FIG. 1 is a flow chart of a prior art method for transferring data between different systems;
FIG. 2 is a flowchart of an object creating method according to a first embodiment of the present invention;
FIG. 3 is a flowchart of an object creating method according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of an object creating apparatus according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device in the fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an object creating method according to an embodiment of the present invention, where the embodiment is applicable to a case of transmitting data between systems, and the method may be executed by an object creating apparatus, where the apparatus may be implemented by software and/or hardware, and is generally integrated in a server.
As shown in fig. 1, the technical solution of the embodiment of the present invention specifically includes the following steps:
s110, the data receiver responds to the data mapping request of the data sender to obtain the target object and the text information matched with the data mapping request.
Wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables.
The data receiver may be a system for receiving the target data, and the data sender may be a system for sending the target data. In a specific example, if the system a wants to send the user information table to the system B, the target data is the user information, the system a is the data sender, and the system B is the data receiver. The data mapping request may be a request sent by the data sender to the data receiver to transmit the target data. The target object can be an entity class object and can be used as a carrier of data. In one particular example, the target object may be an entity Bean, which is a persistent object that may be stored on persistent storage media, commonly used to represent persistent data and provide a way to manipulate such data. A plurality of Key-Value can be included in the text information, and the text information can be obtained according to the data mapping request. The database field represents information for a topic in the target object. In one specific example, when the target object is a user information table, the database fields may be name, age, gender, and the like. The member variables may correspond to database fields and may be declared and assigned in classes.
In the embodiment of the invention, after a data receiving party receives a data mapping request sent by a data sending party, a target object and text information are obtained according to the data mapping request, the target object corresponds to at least one database field, and the text information comprises member variables of the data sending party corresponding to the database field of the target object and data values corresponding to the member variables of the sending party.
In an optional embodiment of the present invention, each of the sender member variables may include a first member variable annotation, and the first member variable annotation may be matched with a database field corresponding to the sender member variable.
The annotation may refer to binding the mapping relationship with the member variable of the entity object to determine the property of the member variable during the program running process. In the embodiment of the present invention, the first member variable annotation may be bound to a sender member variable to indicate a mapping relationship between the sender member variable and a database field.
In a specific example, when a data sender wants to send a user information table to a data receiver, sender member variables may include a name, an age, a sender, and the like, and a comment may be included on the sender member variable name, where the comment indicates that the name corresponds to a database field "name" of the user information table.
S120, the data receiver creates at least one receiver member variable according to each database field corresponding to the target object.
In the embodiment of the invention, after the data receiver acquires the target object according to the data mapping request, a plurality of receiver member variables are created according to the database field corresponding to the target object. The number of recipient member variables created may be the same as, or more than, the number of database fields corresponding to the target object. The method has the advantages that after the member variables of the receiving party are created and before the member variables of the receiving party are not annotated, the member variables of the receiving party have no entity significance, when the member variables of the sending party are increased, the member variables of the receiving party which are unnecessarily created and are not added with annotations can be directly annotated, the code development cost when the member variables of the sending party are increased is saved, and the data transmission efficiency among different systems is improved.
In an optional embodiment of the present invention, the creating, by the data receiver, at least one receiver member variable according to each database field corresponding to the target object may include: the data receiver creates a parent class of the target object to define public attributes; the data receiver creates a subclass of the target object to inherit the parent class and creates at least one receiver member variable in the subclass.
The parent class may also be referred to as a base class and is used to define a common attribute, and the common attribute may refer to a service logic and an attribute common to the service layer. The subclass may also be called a derived class, and the subclass may inherit and use the attributes and methods of the parent class, or may define its own attributes and methods, and the service attributes may be flexibly defined in the subclass according to the service requirements.
In the embodiment of the invention, a data receiver firstly creates a parent class, defines public attributes, then creates a child class, inherits the parent class by the child class, and creates a receiver member variable in the child class. The method of adopting subclass to inherit parent class has the advantages of reducing redundancy of codes and enhancing expandability of the codes.
S130, the data receiver uses the text information to assign values to the member variables of the receiver according to the mapping relation between the member variables of the sender and the member variables of the receiver to obtain a data mapping result.
In the embodiment of the invention, the data receiver can obtain the text information according to the data mapping request, the text information comprises the data value of the sender member variable, and the data value of the sender member variable is assigned to the receiver member variable corresponding to the sender member variable according to the mapping relation between the sender member variable and the receiver member variable. The method has the advantages that when data are transmitted among systems, the data can be accurately transmitted without ensuring that member variables among different systems are completely the same, and the expandability of the systems is improved.
According to the technical scheme of the embodiment, the target object and the text information are obtained by the data receiver according to the data mapping request, the member variable of the receiver is established according to the database field corresponding to the target object, and the value is assigned to the member variable of the receiver according to the mapping relation between the member variable of the receiver and the member variable of the sender and the text information, so that the problem that in the prior art, the mapping relation between the text information and the object between the data receiver and the data sender needs to be kept consistent, the expandability of a system is poor, and the expandability of data transmission between different systems is realized.
Example two
Fig. 2 is a flowchart of an object creating method according to a second embodiment of the present invention, where the second embodiment of the present invention further embodies a process of assigning a variable of each member of a receiving party on the basis of the first embodiment.
Correspondingly, as shown in fig. 2, the technical solution of the embodiment of the present invention specifically includes the following steps:
s210, the data receiver responds to the data mapping request of the data sender, and obtains the target object and the text information matched with the data mapping request.
Wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables.
And each sender member variable comprises a first member variable annotation, and the first member variable annotation is matched with a database field corresponding to the sender member variable.
S220, the data receiving party inquires the mapping relation between the target object and the database fields and obtains each database field corresponding to the target object.
And the data sender and the data receiver agree on the mapping relation between the target object and the database field in advance.
In the embodiment of the invention, the mapping relation between the target object and the database field can be agreed in advance by the data receiver and the data sender according to the service requirement. In a specific example, when the data sender wants to send a user information table to the data receiver, the data sender and the data receiver may agree in advance, and the user information table includes database fields such as name, age, and gender.
S230, the data receiver creates a parent class of the target object to define public attributes.
S240, the data receiver creates a subclass of the target object to inherit the parent class and creates at least one receiver member variable in the subclass.
And S250, adding a second member variable annotation for each member variable of the receiving party by the data receiving party according to the database field corresponding to each member variable of the receiving party.
Wherein the second member variable annotation may be bound to the recipient member variable to indicate a relationship between the recipient member variable and the database field.
In the embodiment of the invention, after the data receiver creates the receiver member variable, a second member variable annotation is added to the receiver member variable according to the database field of the target object, so that the corresponding relationship is generated between the receiver member variable and the database field.
And S260, the data receiver acquires the sender member variable of the data sender target object through a reflection technology.
The reflection technology refers to a technology for acquiring or modifying member variables of an entity object in the process of program operation.
In the embodiment of the invention, the variable of the member of the sender can be obtained through a reflection technology.
S270, obtaining currently processed target sender member variables and obtaining target first member variable annotations matched with the target sender member variables.
In the embodiment of the invention, after the sender member variable is obtained through the reflection technology, the target first member variable annotation bound with the target sender member variable can be obtained for the currently processed target sender member variable.
And S280, judging whether a target second member variable annotation which is the same as the database field matched with the target first member variable annotation exists. If so, S290 is performed, otherwise S2100 is performed.
In the embodiment of the invention, the database field corresponding to the target sender member variable can be obtained according to the target first member variable annotation, whether the target second member variable annotation exists is judged, and the database field obtained according to the target second member variable annotation is the same as the database field obtained according to the target first member variable annotation.
In a specific example, when the data sender sends the user information table to the data receiver, the currently processed member variable of the target sender is name, and according to the annotation of the target first member variable, it is known that the database field corresponding to the name is "name", and therefore the database field matched with the annotation of the target first member variable is "name". And judging whether a target second member variable annotation exists in the second member variable annotation of the data receiver, wherein the database field corresponding to the member variable of the target receiver, which is acquired according to the target second member variable annotation, is the name.
And S290, assigning the data value of the target sender member variable to a receiver member variable corresponding to the target second member variable annotation.
In the embodiment of the invention, if the target second member variable annotation exists, the data value corresponding to the target sender member variable is assigned to the receiver member variable corresponding to the target second member variable annotation.
S2100, judging whether a spare receiver member variable without added annotation exists in the currently created receiver member variables. If so, S2110 is performed, otherwise S2120 is performed.
Where an alternate receiver member variable may refer to a receiver member variable that has been created but to which an annotation has not been added.
In the embodiment of the present invention, when the number of the receiver member variables created by the data receiver is greater than the number of the database fields corresponding to the target object, a spare receiver member variable may exist.
And S2110, adding a second member variable annotation to the spare receiver member variable according to the target first member variable annotation, and assigning the data value of the target sender member variable to the spare receiver member variable.
In the embodiment of the invention, after the spare receiver member variable is obtained, a second member variable annotation is added to the spare receiver member variable. And the database field corresponding to the spare receiver member variable acquired according to the second member variable annotation is the same as the database field corresponding to the target sender member variable acquired according to the target first member variable annotation. And after the annotation is added, assigning the data value corresponding to the target sender member variable to the spare receiver member variable.
In a specific example, when a data sender sends a user information table to a data receiver, if a new database field "work" is added to the data sender, a sender member variable is job, and no receiver member variable exists in the data receiver, according to a second member variable annotation matched with the receiver member variable, the database field corresponding to the receiver member variable is also "work". Therefore, in the receiver member variables created by the data receiver, one receiver member variable J which is not annotated is obtained, annotation is added to the J, so that the database field corresponding to the J is also 'working', therefore, job in the data sender and the database field designated by the J in the data receiver can be used for representing the work, and the data value corresponding to the job is assigned to the J.
And S2120, ending.
According to the technical scheme of the embodiment of the invention, the target object and the text information are obtained through the data receiving party according to the data mapping request, the member variable of the receiving party is established according to the database field corresponding to the target object, the member variable of the sending party and the first member variable annotation matched with the member variable of the sending party are obtained, the second member variable annotation matched with the member variable annotation of the sending party and the same database field as the first member variable annotation are obtained, and the data value of the member variable of the sending party is assigned to the member variable of the receiving party corresponding to the second member variable annotation. The problem of among the prior art different intersystem transmission data, need to keep unified development form, thus the scalability is relatively poor to and add new database field or when modifying database field, to the change cost of system higher, data transmission efficiency is lower is solved. The expandability of the data transmission of the system is realized, the change cost of the system is reduced, and the data transmission efficiency is improved.
EXAMPLE III
Fig. 4 is a schematic structural diagram of an object creating apparatus according to a third embodiment of the present invention, where the apparatus includes: a target object and text information acquisition module 310, a recipient member variable creation module 320, and a recipient member variable assignment module 330. Wherein:
a target object and text information obtaining module 310, configured to enable a data receiving side to respond to a data mapping request of a data sending side, and obtain a target object and text information that match the data mapping request;
wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables;
a recipient member variable creation module 320, configured to enable the data recipient to create at least one recipient member variable according to each of the database fields corresponding to the target object;
and the receiver member variable assignment module 330 is configured to enable the data receiver to assign a value to each receiver member variable by using the text message according to a mapping relationship between the sender member variable and the receiver member variable, so as to obtain a data mapping result.
According to the technical scheme of the embodiment of the invention, the target object and the text information are obtained by the data receiver according to the data mapping request, the receiver member variable is established according to the database field corresponding to the target object, and the assignment is carried out on the receiver member variable according to the mapping relation between the receiver member variable and the sender member variable and the text information, so that the problem of poor system expandability caused by the fact that the mapping relation between the text information and the object between the data receiver and the data sender needs to be kept consistent in the prior art is solved, and the expandability of data transmission among different systems is realized.
On the basis of the above embodiment, each sender member variable includes a first member variable annotation, and the first member variable annotation matches with a database field corresponding to the sender member variable.
On the basis of the above embodiment, the apparatus further includes:
and the second member variable annotation adding module is used for enabling the data receiving party to add a second member variable annotation to each receiving party member variable according to the database field corresponding to each receiving party member variable.
On the basis of the foregoing embodiment, the receiver member variable assignment module 330 includes:
the system comprises a target sender member variable acquisition unit, a target sender member variable acquisition unit and a target first member variable annotation acquisition unit, wherein the target sender member variable acquisition unit is used for acquiring a currently processed target sender member variable and acquiring a target first member variable annotation matched with the target sender member variable;
the database field identity judgment unit is used for judging whether a target second member variable annotation which is identical to the database field matched with the target first member variable annotation exists or not;
and the receiver member variable assignment unit is used for assigning the data value of the target sender member variable to the receiver member variable corresponding to the target second member variable annotation if the target sender member variable annotation is true.
On the basis of the above embodiment, the apparatus further includes:
the spare receiver member variable judging module is used for continuously judging whether a spare receiver member variable which is not added with an annotation exists in the currently created receiver member variable if the spare receiver member variable judging module does not exist;
and the spare receiver member variable assignment module is used for assigning the data value of the target sender member variable to the spare receiver member variable after adding a second member variable annotation to the spare receiver member variable according to the target first member variable annotation if the spare receiver member variable assignment module is used for assigning the spare receiver member variable.
On the basis of the above embodiment, the apparatus further includes:
and the sender member variable acquisition module is used for enabling the data receiver to acquire the sender member variables of the data sender target object through a reflection technology.
On the basis of the above embodiment, the receiving-side member variable creating module 320 includes:
a parent class creation module, configured to enable the data receiving side to create a parent class of the target object, so as to define a common attribute;
and the subclass creating module is used for enabling the data receiver to create a subclass of the target object, inheriting the parent class and creating at least one receiver member variable in the subclass.
On the basis of the above embodiment, the apparatus further includes:
a database field acquisition module, configured to enable the data receiving party to query a mapping relationship between a target object and database fields, and acquire each database field corresponding to the target object;
and the data sender and the data receiver agree on the mapping relation between the target object and the database field in advance.
The object creation device provided by the embodiment of the invention can execute the object creation method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 5 is a schematic structural diagram of a computer apparatus according to a fourth embodiment of the present invention, as shown in fig. 5, the computer apparatus includes a processor 70, a memory 71, an input device 72, and an output device 73; the number of processors 70 in the computer device may be one or more, and one processor 70 is taken as an example in fig. 5; the processor 70, the memory 71, the input device 72 and the output device 73 in the computer apparatus may be connected by a bus or other means, and the connection by the bus is exemplified in fig. 5.
The memory 71 is used as a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as the modules corresponding to the object creating method in the embodiment of the present invention (for example, the target object and text information acquiring module 310, the recipient member variable creating module 320, and the recipient member variable assigning module 330 in the object creating apparatus). The processor 70 executes various functional applications and data processing of the computer device, i.e., implements the above-described object creation method, by executing software programs, instructions, and modules stored in the memory 71.
The memory 71 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 71 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 71 may further include memory located remotely from the processor 70, which may be connected to a computer device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 72 may be used to receive input numeric or character information and generate key signal inputs relating to user settings and function controls of the computer apparatus. The output device 73 may include a display device such as a display screen.
EXAMPLE five
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for creating an object, the method including:
the data receiver responds to a data mapping request of the data sender, and acquires a target object and text information matched with the data mapping request;
wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables;
the data receiver creates at least one receiver member variable according to each database field corresponding to the target object;
and the data receiver uses the text information to assign values to the member variables of the receiver according to the mapping relation between the member variables of the sender and the member variables of the receiver to obtain a data mapping result.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the object creation method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the object creating apparatus, each included unit and module are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An object creation method, comprising:
the data receiver responds to a data mapping request of the data sender, and acquires a target object and text information matched with the data mapping request;
wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables;
the data receiver creates at least one receiver member variable according to each database field corresponding to the target object;
and the data receiver uses the text information to assign values to the member variables of the receiver according to the mapping relation between the member variables of the sender and the member variables of the receiver to obtain a data mapping result.
2. The method of claim 1, wherein each of the sender member variables includes a first member variable annotation, and wherein the first member variable annotation matches a database field corresponding to a sender member variable;
after the data receiver creates at least one receiver member variable according to each database field corresponding to the target object, the method further includes:
and adding a second member variable annotation for each member variable of the receiving party by the data receiving party according to the database field corresponding to each member variable of the receiving party.
3. The method of claim 2, wherein the data sender assigns values to each of the receiver member variables using the text information according to a mapping relationship between the sender member variables and the receiver member variables to obtain data mapping results, comprising:
acquiring currently processed member variables of a target sender, and acquiring a target first member variable annotation matched with the member variables of the target sender;
judging whether a target second member variable annotation which is the same as the database field matched with the target first member variable annotation exists;
and if so, assigning the data value of the target sender member variable to a receiver member variable corresponding to the target second member variable annotation.
4. The method of claim 3, after determining whether there is a target second member variable annotation that is the same database field that matches the target first member variable annotation, further comprising:
if not, continuously judging whether a spare receiver member variable without added annotation exists in the currently created receiver member variables;
and if so, adding a second member variable annotation to the spare receiver member variable according to the target first member variable annotation, and assigning the data value of the target sender member variable to the spare receiver member variable.
5. The method of claim 1, after the data recipient creates at least one recipient member variable from each of the database fields corresponding to the target object, further comprising:
and the data receiver acquires the sender member variable of the data sender target object through a reflection technology.
6. The method of claim 1, wherein the data recipient creating at least one recipient member variable from each of the database fields corresponding to the target object comprises:
the data receiver creates a parent class of the target object to define public attributes;
the data receiver creates a subclass of the target object to inherit the parent class and creates at least one receiver member variable in the subclass.
7. The method of claim 1, further comprising, prior to the data recipient creating at least one recipient member variable from each of the database fields corresponding to the target object:
the data receiving party inquires the mapping relation between a target object and database fields and acquires each database field corresponding to the target object;
and the data sender and the data receiver agree on the mapping relation between the target object and the database field in advance.
8. An object creating apparatus, comprising:
the target object and text information acquisition module is used for enabling a data receiver to respond to a data mapping request of a data sender and acquiring a target object and text information matched with the data mapping request;
wherein the target object is associated with at least one database field, and the text information comprises: a sender member variable corresponding to each of the database fields, and a data value of each of the sender member variables;
a receiver member variable creation module, configured to enable the data receiver to create at least one receiver member variable according to each database field corresponding to the target object;
and the receiver member variable assignment module is used for enabling the data receiver to assign the variables of the receivers by using the text information according to the mapping relation between the sender member variables and the receiver member variables to obtain data mapping results.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the object creation method according to any of claims 1-7 when executing the program.
10. A storage medium containing computer-executable instructions for performing the object creation method of any one of claims 1-7 when executed by a computer processor.
CN201911221404.2A 2019-12-03 2019-12-03 Object creation method, device, computer equipment and storage medium Active CN111008254B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911221404.2A CN111008254B (en) 2019-12-03 2019-12-03 Object creation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911221404.2A CN111008254B (en) 2019-12-03 2019-12-03 Object creation method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111008254A true CN111008254A (en) 2020-04-14
CN111008254B CN111008254B (en) 2023-08-29

Family

ID=70113985

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911221404.2A Active CN111008254B (en) 2019-12-03 2019-12-03 Object creation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111008254B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111737166A (en) * 2020-05-15 2020-10-02 完美世界(北京)软件科技发展有限公司 Data object processing method, device and equipment
CN113535140A (en) * 2020-04-16 2021-10-22 武汉斗鱼网络科技有限公司 Parameter packaging method, device, equipment and storage medium
CN114237746A (en) * 2021-12-16 2022-03-25 北京天融信网络安全技术有限公司 C language-based configuration information management method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6490581B1 (en) * 2000-05-24 2002-12-03 At&T Corp. System and method for providing an object-oriented interface to a relational database
CN104317941A (en) * 2014-10-31 2015-01-28 新华瑞德(北京)网络科技有限公司 Resource injection method and device of applications
CN105739970A (en) * 2016-01-20 2016-07-06 北京京东尚科信息技术有限公司 Method and device for mapping data into custom class object
CN106843872A (en) * 2017-01-17 2017-06-13 千寻位置网络有限公司 Assignment conversion method
CN109670053A (en) * 2018-12-25 2019-04-23 北京锐安科技有限公司 Data object mapping method, device, equipment and computer readable storage medium
CN110209507A (en) * 2019-05-16 2019-09-06 厦门市美亚柏科信息股份有限公司 Data processing method, device, system and storage medium based on message queue
WO2019205288A1 (en) * 2018-04-24 2019-10-31 平安科技(深圳)有限公司 Connection establishment method, system, and device, and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6490581B1 (en) * 2000-05-24 2002-12-03 At&T Corp. System and method for providing an object-oriented interface to a relational database
CN104317941A (en) * 2014-10-31 2015-01-28 新华瑞德(北京)网络科技有限公司 Resource injection method and device of applications
CN105739970A (en) * 2016-01-20 2016-07-06 北京京东尚科信息技术有限公司 Method and device for mapping data into custom class object
CN106843872A (en) * 2017-01-17 2017-06-13 千寻位置网络有限公司 Assignment conversion method
WO2019205288A1 (en) * 2018-04-24 2019-10-31 平安科技(深圳)有限公司 Connection establishment method, system, and device, and computer readable storage medium
CN109670053A (en) * 2018-12-25 2019-04-23 北京锐安科技有限公司 Data object mapping method, device, equipment and computer readable storage medium
CN110209507A (en) * 2019-05-16 2019-09-06 厦门市美亚柏科信息股份有限公司 Data processing method, device, system and storage medium based on message queue

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
闫鑫 等: "结构体对象的赋值运算方法研究", no. 11 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113535140A (en) * 2020-04-16 2021-10-22 武汉斗鱼网络科技有限公司 Parameter packaging method, device, equipment and storage medium
CN111737166A (en) * 2020-05-15 2020-10-02 完美世界(北京)软件科技发展有限公司 Data object processing method, device and equipment
CN111737166B (en) * 2020-05-15 2023-04-07 完美世界(北京)软件科技发展有限公司 Data object processing method, device and equipment
CN114237746A (en) * 2021-12-16 2022-03-25 北京天融信网络安全技术有限公司 C language-based configuration information management method, device, equipment and storage medium
CN114237746B (en) * 2021-12-16 2023-11-14 北京天融信网络安全技术有限公司 Configuration information management method, device, equipment and storage medium based on C language

Also Published As

Publication number Publication date
CN111008254B (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN107508795B (en) Cross-container cluster access processing device and method
US10637817B2 (en) Managing messaging protocol communications
US10193839B2 (en) Managing security in messaging protocol communications
CN108282489B (en) vulnerability scanning method, server and system
CN107431651B (en) Life cycle management method and equipment for network service
CN107592367B (en) Resource sharing method and device for household appliances and computer readable storage medium
US9110884B2 (en) Message publishing and subscribing method and apparatus
US8825750B2 (en) Application server management system, application server management method, management apparatus, application server and computer program
CN111008254B (en) Object creation method, device, computer equipment and storage medium
WO2018184535A1 (en) Insurance service processing method and device, server, and storage medium
CN110352401B (en) Local device coordinator with on-demand code execution capability
TWI506553B (en) Method and system for automatic detecting and resolving apis
US11303583B2 (en) Resource trees by management controller
CN111124589A (en) Service discovery system, method, device and equipment
US11228537B2 (en) Resource processing method and system, storage medium and electronic device
WO2017133487A1 (en) Service scheduling method and device, and computer storage medium
JP5961471B2 (en) Output comparison method in multiple information systems
CN110798358B (en) Distributed service identification method and device, computer readable medium and electronic equipment
CN112087335A (en) Flow experiment method, device and storage medium
US9537931B2 (en) Dynamic object oriented remote instantiation
US10360172B1 (en) Decoupled peripheral devices
CN113596105B (en) Content acquisition method, edge node and computer readable storage medium
WO2022121492A1 (en) File transmission method and apparatus, computer device, and storage medium
CN110661895A (en) Network address mapping method and network address mapping equipment of server
CN111193805B (en) Resource discovery method and 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