Method, device, equipment and medium for converting entity class objects under coding architecture
Through automated class data comparison and attribute information matching, entity class object conversion between different architectural layers is realized, redundant code and inefficient development problems caused by manual conversion are solved, and development efficiency and code readability are improved.
Patent Information
- Application Number
- CN202210638967.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-07
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2042-06-07
AI Technical Summary
During the software development process, entity-class objects between different architectural layers need to be manually converted, resulting in low redundant code generation and development efficiency.
By obtaining and comparing class data in different architectural layers, obtaining reference collection data, instantiating class data to obtain original object data and target object data, and obtaining attribute information based on attribute type, attribute name and attribute method. Then, the original attribute information is filtered based on the reference set data, match the target attribute information, obtain the loading and assignment attribute methods, establish the assembly model, and assign the attribute value to the target object data.
Automatic conversion between objects of different entity classes is realized, reducing the time for developers to manually encode, improving conversion efficiency, and coding is conducive to traceability and modification of architectural content.
Smart Images

Figure CN114895912B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of research and development technology, and in particular to a method, device, equipment and medium for converting entity class objects under a coding architecture. Background Art
[0002] In the software development cycle, there are object-oriented analysis and design phases. In this design phase, developers are committed to building object models that simulate the problem domain, and then developing functions based on the established object models. In the development process, different architecture layers use different object models, and each object model has its own purpose. Considering the background security and functional requirements, when data is transmitted between different architecture layers, it is also necessary to convert the object model into the object model applicable to the current architecture layer.
[0003] The inventors realized that the above-mentioned R&D process cannot use universal entity class objects to replace all entity class objects, and therefore relies on developers to manually write code to realize the conversion of each object. This object conversion process not only wastes the developer's time, but also generates a lot of redundant code, thereby affecting development efficiency. Summary of the invention
[0004] The present invention provides a method, device, computer equipment and medium for converting entity class objects under a coding architecture to solve the technical problem that different entity class objects need to be manually converted by developers during the development process, resulting in redundant code generation and low development efficiency.
[0005] First, a method for converting entity class objects under a coding architecture is provided, including:
[0006] Obtain and compare class data in different architecture layers to obtain reference set data;
[0007] Instantiate the class data, obtain original object data and target object data, and obtain original attribute information of the original object data and target attribute information of the target object data according to attribute type, attribute name and attribute method;
[0008] According to the reference set data, the original attribute information is screened to obtain first attribute information;
[0009] acquiring second attribute information from the target attribute information according to the correlation with the first attribute information;
[0010] Obtaining a loading attribute method of the first attribute information and an assignment attribute method of the second attribute information, and establishing an assembly model according to the loading attribute method and the assignment attribute method; and
[0011] According to the assembly model, the attribute value of the first attribute information is assigned to the second attribute information.
[0012] In a second aspect, a conversion device for entity class objects under a coding architecture is provided, including:
[0013] A class data processing module, used to collect class data at different architecture layers, and compare the class data at different architecture layers to obtain reference set data;
[0014] An object instance module, used to instantiate the class data, obtain original object data and target object data, and obtain original attribute information of the original object data and target attribute information of the target object data according to attribute type, attribute name and attribute method;
[0015] A first screening module, configured to screen the original attribute information according to the reference set data to obtain first attribute information;
[0016] A second screening module, configured to obtain second attribute information from the target attribute information according to the correlation with the first attribute information;
[0017] an assembly module, used for obtaining a loading attribute method of the first attribute information and an assignment attribute method of the second attribute information, and establishing an assembly model according to the loading attribute method and the assignment attribute method; and
[0018] An assignment module is used to assign the attribute value of the first attribute information to the second attribute information according to the assembly model.
[0019] In a third aspect, a device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for converting entity class objects under the above-mentioned coding architecture are implemented.
[0020] In a fourth aspect, a medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for converting entity class objects under the above-mentioned coding architecture are implemented.
[0021] In the scheme implemented by the conversion method, device, computer equipment and storage medium of entity class objects under the above coding architecture, the class data corresponding to the entity class object is first obtained, and the class data is screened according to the difference in class attribute information of the class data in different architecture layers, so as to obtain reference set data. Then the class data is instantiated to obtain the original object data and target object data located in different architecture layers, and the original attribute information and target attribute information are obtained. By referring to the set data, the first attribute information is extracted from the original attribute information, and then the target attribute information is extracted and compared with the first attribute information for correlation to obtain the second attribute information. The second attribute information and the first attribute information are matched into pairs, and the loading attribute method of the first attribute information and the assignment attribute method of the second attribute information are obtained to construct an assembly model. According to the assembly model, the attribute value of the first attribute information is assigned to the second attribute information. Finally, the target object data is obtained. According to the scheme provided by the present invention, the conversion between different entity class objects can be realized, and only the developer needs to preset the class data of different architecture layers, which greatly saves the developer's time. Moreover, the unified coding during the conversion process can not only realize accurate attribute information conversion, but also facilitate the developer to trace and modify the architecture content. Furthermore, the solution provided by the present invention avoids direct comparison of two entity class objects and has high conversion efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0023] Figure 1 It is a schematic diagram of an application environment of a method for converting entity class objects under a coding architecture in one embodiment of the present invention;
[0024] Figure 2 It is a flow chart of a method for converting entity class objects under a coding framework in one embodiment of the present invention;
[0025] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S10;
[0026] Figure 4 yes Figure 3 A schematic flow chart of a specific implementation of step S13;
[0027] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S30;
[0028] Figure 6 yes Figure 5 A schematic flow chart of a specific implementation of step S32;
[0029] Figure 7 yes Figure 1 A schematic diagram of a specific implementation process of step S40
[0030] Figure 8 is a structural schematic diagram of an entity class object conversion device in one embodiment of the present invention;
[0031] Fig. 9 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0032] Fig.10 It is a schematic diagram of the structure of a computer-readable storage medium in one embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] The method for converting entity class objects under the coding architecture provided by the embodiment of the present invention can be applied in the following aspects: Figure 1 In the application environment, database 1 is used to store data. Backstage 2 is the page that authorized operators or special users see after logging in with permission. In backstage 2, the stored data in database 1 can be called, and the content of foreground 3 can be processed. Backstage 2 can also refer to the backend program. Foreground 3 is the page that users can see directly, which can refer to the front-end page, such as a web page. During the development process, developers define multiple data parameter combinations according to service objects and application requirements, thereby establishing different object models, which can also be called entity class objects. The entity class objects used in database 1, backstage 2, and foreground 3 have different uses.
[0035] See also Figure 1As shown, for example, in database 1, the objects used include database objects (Data Object, referred to as DO), which are direct mappings of database 1 records. Since database objects include sensitive data, database objects cannot be directly transmitted to the front desk 3, and the database objects must be converted into, for example, data transfer objects (DataTransferObject, referred to as DTO). When the database object is converted into a data transfer object, the database object will be processed twice, and the parameter combination in the database object will be changed so that the content of the database object is sufficient to be open to the front desk 3. The data transfer object can be used for data transfer between different applications, and can also be used for data display in the front desk 3. The entity class objects used in the back desk 2 include business objects (Business Object, referred to as BO), which are used to transfer data between internal methods of the application. Therefore, after the data is transferred from the database 1 to the back desk 2, the data transfer object can be converted into, for example, a business object for processing by the back desk 2. However, the business object is not suitable for direct display to the front desk 3, so when the data is transferred from the back desk 2 to the front desk 3, the business object can be converted into, for example, a data transfer object. The entity class objects used in the front desk 3 include data transfer objects, value objects (Value Object, referred to as VO), etc., wherein the data transfer object and the value object can be used for data display in the front desk 3. In the development process, data can be called from database 1 and transmitted to background 2, processed by background 2 and then transmitted to front end 3 for display. In the development process, data in front end 3 can also be processed by background 2 and then transmitted to database 1 for storage.
[0036] See also Figure 1 As shown, in the development stage, because there are different requirements for the parameter combination of data, the conversion of entity class objects will be frequently performed between different architectures. The conversion method of entity class objects under the coding architecture provided by the present invention can be used for data conversion between database 1, background 2 and front end 3, and is not limited to the above-mentioned entity class objects. The present invention is described in detail below through specific embodiments.
[0037] See also Figure 2 As shown, Figure 2 A schematic flow chart of a method for converting entity class objects under a coding framework in an embodiment of the present invention includes steps S10 to S60.
[0038] S10. Acquire and compare class data in different architecture layers to obtain reference set data.
[0039] See also Figure 2As shown, the conversion method of entity class objects under the coding architecture provided by the present invention can realize the conversion of class data between different architecture layers in the process of development and design. Among them, class data is a collection of a group of entity class objects with the same attributes and behaviors. In this embodiment, class data can be different classes (class) in the Java language environment. For example, class data can be a student class (class student), and the student class represents a collection of multiple students, and specifically refers to a class of people who have student status and perform learning behaviors. In the student class, there can be multiple different entity class objects, where the entity class objects are specific student objects, such as Xiao Ming, Li Hua, etc. In the development process, class data also includes a variety of class attribute information. Taking the student class as an example, the class attribute information of the student class can include the student's age, the student's subject grades, and the student's gender, etc. Through the acquisition and establishment of class data, many entity class objects used in the development process can be quickly sorted out, and the attribute information of different types of entity class objects and the attribute information of the same type of entity class objects can be quickly distinguished through the acquisition and establishment of class data.
[0040] It should be understood that, depending on the different development architecture designs, the class attribute information of class data at different architecture layers may be different. Therefore, reference set data is set to distinguish between class data that participate in the conversion and class data that do not participate in the conversion. Specifically, in this embodiment, reference set data refers to attribute data that participates in or does not participate in data transfer when data is transferred between different architecture layers. Among them, attribute data includes attribute type and attribute name. Reference set data can be manually filled in and modified by developers, or obtained through comparison and screening.
[0041] like Figure 3 As shown, Figure 3 yes Figure 1 A specific implementation flow diagram of step S10 is shown in FIG. 1 . In step S10 , the process of obtaining reference set data includes steps S11 to S13 . Steps S11 to S13 are shown as follows.
[0042] S11. Acquire class data, and acquire a first architecture layer for sending data and a second architecture layer for receiving data.
[0043] S12. When developing the first architecture layer and the second architecture layer, in the first architecture layer, the preset class data includes the first class attribute information, and in the second architecture layer, the preset class data includes the second class attribute information.
[0044] S13. When converting the entity class objects of the first architecture layer to the entity class objects of the second architecture layer, compare the first type of attribute information and the second type of attribute information, build a screening model, and mark the first type of attribute information according to the screening model to form reference set data.
[0045] See also Figure 3 As shown, for steps S11-S13, there are multiple architecture layers in the development process, and the architecture layer that serves as the implementation subject is first clarified. In this embodiment, the architecture layer that sends data is taken as the first architecture layer, and the architecture layer that receives data is taken as the second architecture layer, then the first architecture layer and the second architecture layer are the implementation subjects. After obtaining the implementation subject, the conversion subject is obtained. In this embodiment, the class data is first obtained. In the first architecture layer, the preset class data includes the first type of attribute information, and in the second architecture layer, the preset class data includes the second type of attribute information. Then the conversion subject is the first type of attribute information and the second type of attribute information, and the data transmission direction is from the first type of attribute information to the second type of attribute information. After obtaining the conversion subject, the conversion subject is compared to distinguish the attribute content involved in the conversion between the first type of attribute information and the second type of attribute information, and according to the attribute content in the conversion process, reference set data is formed to facilitate the conversion of entity class objects in subsequent steps.
[0046] It should be noted that, in this embodiment, reference set data can be obtained based on the attribute content that does not participate in the conversion. In other embodiments, reference set data can also be obtained based on the attribute content that participates in the conversion. Specifically, the number of sample items of attribute information that participates in the conversion and the number of sample items of attribute information that does not participate in the conversion can be compared, and the attribute information with fewer sample items can be selected as the attribute data of the reference set data, so as to reduce the amount of data involved in the comparison when the entity class object is converted.
[0047] See also Figure 4 As shown, Figure 4 yes Figure 3 A flow chart of a specific implementation of step S13 in step S13 is shown in FIG. 1 . In step S13, after obtaining the conversion subject, a screening model is constructed according to the first type of attribute information and the second type of attribute information. Step S13 specifically includes steps S131 to S136. Steps S131 to S136 are shown below.
[0048] S131. Preset screening objects and screening conditions, wherein the screening objects are the attribute types and attribute names of the first category attribute information and the second category attribute information.
[0049] S132. Extract the first type of attribute information one by one, and compare the extracted first type of attribute information with the second type of attribute information one by one, and execute step S133.
[0050] S133. Determine whether the extracted first-category attribute information meets the screening conditions, and execute step S134 or step S135.
[0051] S134. In step S132, if the extracted first-category attribute information meets the screening condition, the extracted first-category attribute information is marked, and the next first-category attribute information is extracted until the extraction of the first-category attribute information is completed.
[0052] S135. In step S132, if the extracted first-category attribute information does not meet the screening condition, the extracted first-category attribute information is skipped, and the next first-category attribute information is extracted until the extraction of the first-category attribute information is completed.
[0053] S316: Read the first category attribute information, collect marked or unmarked first category attribute information, and form reference set data.
[0054] See also Figure 4 As shown, for steps S131 to S136, in the development architecture, the first type of attribute information is distributed according to rows, and the first type of attribute information has multiple rows. The first type of attribute information can be extracted according to the number of rows, and the extracted first type of attribute information and the second type of attribute information are compared one by one, which can ensure that the first attribute information is fully extracted and improve the integrity and reliability of the reference set data. Specifically, the attribute information includes the attribute type and the attribute name. The screening model includes the screening object and the screening condition. When the first type of attribute information meets the screening condition, that is, when there is a second type of attribute information whose attribute type and attribute name are the same as the first type of information, the currently extracted first type of attribute information is marked for subsequent distinction. Specifically, the mark can be added to the attribute name. If the first type of attribute information does not meet the screening condition, the current first type of attribute information is not marked. And so on, until the first type of attribute is screened, the first type of attribute information is read again, the marked first type of attribute information is collected, or the unmarked first type of attribute information is collected to form the reference set data. Among them, in the Java language, the class attribute information in the class data can be obtained through the reflection instruction of Java.
[0055] It should be noted that the process of presetting the first-category attribute information and the second-category attribute information can be set by the developer during the development process, or an existing conversion instance can be extracted as the first-category attribute information and the second-category attribute information. Among them, the reference set data can be the attribute data corresponding to the first-category attribute information participating in the conversion, or the attribute data corresponding to the first-category attribute information not participating in the conversion. In this way, the attribute content included in both the first-category attribute information and the second-category attribute information is selected.
[0056] In the present embodiment, the attribute type includes the basic data type and the reference data type in the Java language, wherein the reference data type is obtained after the basic data type is packaged. Specifically, the attribute type includes an integer type, a floating point type, a character type (char), and a Boolean type (boolean). Among them, the integer type includes bit data (byte), a short integer type (short), an integer type (int), and a long integer type (long), and the floating point type includes a single precision type (float) and a double precision type (double). In the present embodiment, the reference data type includes Byte, Short, Integer, Long, Float, Double, Boolean, and Charcter.
[0057] See also Figure 1-Figure 4 As shown, taking the student class as an example, the class data obtained is the student class, and the first architecture layer is, for example, database 1, and the second architecture layer is, for example, backend 2. According to development requirements, developers can preset the student class in database 1 to include the first type of attribute information, and the first type of attribute information includes the student's age, the student's gender, and the student's subject score. Developers can preset the student class in backend 2 to include the second type of attribute information, and the second type of attribute information includes the student's age. Among them, the first type of attribute information and the second type of attribute information are compared, and the student's subject score is marked, that is, during the conversion process, the student's subject score and the student's gender cannot be converted to the second architecture layer. Then confirm whether the student's age is the same attribute type in the first type of attribute information and the second type of attribute information. If it is the same attribute type, such as integer type (int), the student's age can be converted to the second architecture layer. In this embodiment, the relevant data of the student's subject score and gender are integrated to form reference set data. In other embodiments, the relevant data of the student's age can also be integrated to form reference set data. And the reference set data includes attribute type and attribute name. Specifically, in Java, the attribute information of the reference set data can be stored using the ARGs parameter, and the storage format can be an array. For example, the reference set data includes ARGs[int student's subject score. int student's age] and so on.
[0058] See also Figure 1 and Figure 3As shown, the first architecture layer and the second architecture layer are designed by developers. In this embodiment, the first architecture layer and the second architecture layer can be one of database 1, background 2, and front end 3. In other embodiments, the first architecture layer and the second architecture layer can also be represented as a display layer, a business layer, a persistence layer, etc., which are not limited here. Among them, the class data is designed by the developer in the development architecture, which is not limited in the present invention. After obtaining the reference set data, according to the reference set data, the attribute data that does not participate in the conversion is excluded, which can not only reduce the amount of data involved in the conversion, but also improve the accuracy of the entity class object conversion.
[0059] See also Figure 2 As shown, the conversion method of the entity class object includes step S20, and step S20 is as follows.
[0060] Step S20: instantiate the class data, obtain the original object data and the target object data, and obtain the original attribute information of the original object data and the target attribute information of the target object data according to the attribute type, attribute name and attribute method.
[0061] See also Figure 2 As shown, class data is a collection of entity class objects. When developing programming, the conversion of entity class objects between different architecture layers is performed. Therefore, in the first architecture layer, the class data is instantiated to obtain the original object data, and in the second architecture layer, the class data is instantiated to obtain the target object data. And the original attribute information of the original object data is obtained through the reflection instruction of Java. Among them, the original attribute information includes attribute type, attribute name and attribute method. Similarly, the attribute type, attribute name and attribute method of the target object data can be obtained through the reflection instruction of Java, so as to obtain the target attribute information. Among them, the original object data and the target object data belong to different architecture layers, and the original object data and the target object data can be any one of the entity class objects such as database objects, data transmission objects, business objects and value objects. Among them, the attribute type includes Java's basic data types and reference data types, and the attribute method includes a loading attribute method and an assignment attribute method. Among them, the loading attribute method can be a get method in Java, and the assignment attribute method can be a set method in Java.
[0062] See also Figure 1 and Figure 4As shown, taking the student class as an example, the first architecture layer is database 1. According to the first type of attribute information, the student class is instantiated, and the entity class object obtained is Li Hua, and the original attribute information of the entity class object Li Hua includes Li Hua's age 15, Li Hua's math score 85, Li Hua's gender male, Li Hua's ID card password is 123, etc. For example, the second architecture layer is background 2. According to the second type of attribute information, the entity class object obtained by instantiating the student class is Xiao Ming, and the target attribute information of the entity class object Xiao Ming includes Xiao Ming's age 13, Xiao Ming's gender female, etc.
[0063] See also Figure 3 and Figure 4 As shown, it is worth noting that instantiation refers to the process of creating entity class objects according to class data during the programming process. The original object data is the entity class object created according to the class data in the first architecture layer. The target object data is the entity class object created according to the class data in the second architecture layer. Among them, the entity class objects of the original object data and the target object data are determined according to the development design and are not limited here. The entity class object names of the original object data and the target object data can be the same or different. For example, the entity class object name of the original object data is Li Hua, and the entity class object name of the target object data can be Li Hua, or Xiao Ming or Xiao Hong, etc.
[0064] See also Figure 2 As shown, the process of entity class object conversion includes step S30, and step S30 is as follows.
[0065] S30. Filter original attribute information according to reference set data to obtain first attribute information.
[0066] See also Figure 2 As shown in the figure, the process of converting the original object data into the target object data realizes the transfer of attribute data. Therefore, after obtaining the original object data, the original attribute information can be obtained through Java reflection instructions. Then, according to the reference collection data, the attribute data in the original attribute information that participates in the entity class object conversion process is filtered out. For details, please refer to Figure 5 As shown, Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S30 is shown in FIG. 1 , where step S30 specifically includes step S31 and step S32, and step S31 and step S32 are shown as follows.
[0067] S31. Preset mapping conditions.
[0068] S32: Read the original attribute information, and exclude the attribute information that does not participate in the conversion in the original attribute information according to the mapping condition, so as to obtain the first attribute information.
[0069] See also Figure 5 As shown, for step S31 and step S32, a mapping relationship is established between the original attribute information and the reference set data, so that the attribute content in the original attribute information is filtered through the reference set data to obtain the first attribute information. The first attribute information is the attribute content that can be converted to the second architecture layer. For the first attribute information, the mapping condition is that the attribute content with the same attribute type and the same attribute name exists in the reference set data. For details, please refer to Figure 6 As shown, Figure 6 yes Figure 5 A flowchart of a specific implementation of step S32 is shown below, where step S32 specifically includes steps S321-S326.
[0070] Step S321, reading original attribute information one by one.
[0071] Step S322, determine whether the original attribute information meets the mapping conditions, and execute step S323 or step S324.
[0072] Step S323: When the original attribute information meets the mapping condition, the original attribute information is retained and step S325 is executed.
[0073] Step S324: When the original attribute information does not meet the mapping condition, the original attribute information is removed and step S325 is executed.
[0074] Step S325, determine whether the current original attribute information is the last line, if the current original attribute information is the last line, execute step S326, if the current original attribute information is not the last line, execute step S321.
[0075] Step S326, collect the retained original attribute information set and obtain the first attribute information.
[0076] See also Figure 6As shown, for steps S321-S326, the original attribute information is read one by one. Specifically, in Java, the original attribute information can be read from the first line according to the number of lines through reflection instructions, and the original attribute information is compared with the array in the reference set data. When the mapping condition is met, the original attribute information that meets the mapping condition is retained. Specifically, the original attribute information can be numbered according to the number of lines, for example, the first line corresponds to number 1, the second line corresponds to number 2, and so on, and the nth line corresponds to number n. When the original attribute information numbered 1 participates in the comparison, the original attribute information numbered 1 and the array in the reference set data are compared in turn to facilitate the tracing of the encoded content. Among them, the array stored in the reference set data represents the attribute data involved in the conversion. If the original attribute information numbered 1 meets the mapping condition, the original attribute information numbered 1 is retained. And so on, until the comparison of the original attribute information numbered n and the reference set data is completed. The retained original attribute information is used as the first attribute information for entity class object conversion.
[0077] See also Figure 6 As shown, in this embodiment, the mapping condition is set to correspond to the original attribute information and the array in the reference set data, wherein the correspondence is reflected in the same attribute type and the same attribute name. Therefore, when the array stored in the reference set data is attribute data participating in the conversion, satisfying the mapping condition can be regarded as the current original attribute information can be converted to the second architecture layer, so the current original attribute information is retained, otherwise the current original attribute information is removed. In other embodiments, when the array stored in the reference set data is attribute data not participating in the conversion, satisfying the mapping condition can be regarded as the current original attribute information cannot be converted to the second architecture layer, so the original attribute information that meets the mapping condition can be removed. Among them, the mapping condition is a condition preset by the developer.
[0078] See also Figure 1-Figure 6As shown below, for the sake of illustration, the following takes the student class as an example. In a database 1 for instance, the student class is instantiated, and the obtained original object data is Student One. In a background 2 for instance, the student class is instantiated, and the obtained target object data is Student Two. The original attribute information of Student One is extracted through Java's reflection instructions, and there are, for example, 5 pieces of attribute content in the original attribute information of Student One. The attribute content is respectively int-age-16, int-math-95, boolean-gender-female, int-English-100, int-grade-4. When the reference set data represents the attribute data participating in the conversion, and the reference set data is, for example, ARGs[int-age, int-math, boolean-gender]. Among them, int and boolean are attribute types, age, math, gender, English, and grade are attribute names, and the data after the attribute names are attribute values. Specifically, according to the attribute type and attribute name, each piece of attribute content of the original attribute information can be numbered according to the number of lines (in Java, the attribute content is arranged in lines, and the lines are not shown here). Through Java's reflection instructions, the attribute content with the number 1 is obtained, for example, int-age-16. Compare int-age-16 with the array in the reference set data, and find the array int-age that meets the mapping condition, so int-age-16 is retained. And so on, until int-grade-4. After the comparison is completed, the retained original attribute information is used as the first attribute information, and the first attribute information includes int-age-16, int-math-95, boolean-gender-female.
[0079] Please refer to Figure 2-Figure 6 As shown, it can be seen from the above solution that during the conversion of the original object data, the original object data and the reference set data can be directly compared, without comparing two specific entity class objects, reducing the sample size of the comparison. And between the same two architecture layers, when converting entity class objects of the same category, the same set of reference set data can be shared, which can reduce the redundancy of programming code and improve the conversion efficiency of entity class objects. During the development process, the code for converting entity class objects is unified and concise, which is conducive to developers tracing and modifying the development architecture.
[0080] Please refer to Figure 2 As shown, the process of converting entity class objects also includes step S40, and step S40 is as follows.
[0081] S40. Obtain the second attribute information from the target attribute information according to the relevance to the first attribute information, and match the second attribute information and the first attribute information in pairs.
[0082] See also Figure 2 As shown, in step S40, the second attribute information is the attribute information involved in the conversion in the second architecture layer. When the attribute type and the attribute name are the same, the target attribute information is related to the first attribute information, and the target attribute information is used as the second attribute information and matched with the related attribute information to facilitate the conversion process.
[0083] See also Figure 7 As shown, Figure 7 yes Figure 1 A schematic flow chart of a specific implementation of step S40 is shown below, where step S40 includes steps S41 to S44.
[0084] Step S41, extract target attribute information piece by piece.
[0085] Step S42, determine whether there is first attribute information related to the target attribute information. If there is first attribute information related to the target attribute information, execute step S43; if there is no first attribute information related to the target attribute information, execute step S44.
[0086] Step S43: If there is first attribute information related to the target attribute information, the target attribute information is used as the second attribute information, and the second attribute information and the corresponding first attribute information are matched into pairs.
[0087] Step S44, determine whether the current target attribute information is the last one. If the current target attribute information is the last one, execute step S50; if the current target attribute information is not the last one, execute step S41.
[0088] See also Figure 7 As shown, for step S41-step S44, in Java, each attribute content in the target attribute is arranged in rows, and the target attribute information can be extracted one by one through Java's reflection instruction, and the target attribute information and the first attribute information can be compared until all the target attribute information are extracted and compared. Among them, if the attribute information of the current target attribute information is the same as that of the first attribute information, the current target attribute information is retained and used as the second attribute information. Specifically, the attribute type and attribute name can be extracted from the target attribute information through Java's reflection instruction, and the same attribute information is reflected in the same attribute type and the same attribute name. The extracted second attribute information and the corresponding first attribute information are matched in pairs to establish an assembly model. Among them, each time a second attribute information is extracted, an assembly model is established, and the assignment from the first attribute information to the second attribute information is completed according to the assembly model to reduce the redundancy of the computer program.
[0089] See also Figure 2As shown, the conversion method of entity class objects under the coding architecture includes step S50, and step S50 is as follows.
[0090] S50. According to the matched pairs of first attribute information and second attribute information, obtain the loading attribute method of the first attribute information and the assignment attribute method of the second attribute information, and establish an assembly model.
[0091] See also Figure 2 As shown, when the entity class object of the first architecture layer is transferred to the second architecture layer, the attribute value of the first attribute information is assigned to the second attribute information. Therefore, the method for loading the attribute of the first attribute information is obtained, and specifically, the method for loading the attribute can be the get method in Java. The method for assigning the attribute of the second attribute is obtained, and specifically, the method for assigning the attribute can be the set method in Java, thereby forming an assembly model. Among them, the assembly model refers to the program statement in Java programming.
[0092] See also Figure 7 As shown, the first attribute information includes, for example, 3 lines of attribute content, which are int-age-16, int-math-95, and boolean-gender-female. The target attribute information includes, for example, 4 lines of attribute content, which are int-age-36, int-math-55, boolean-gender-male, and int-Chinese-60, wherein the attribute content of the target attribute information is extracted in sequence. For the first attribute content int-age-36, if there is a related attribute content int-age-16 in the first attribute information, int-age-16 is retained as the second attribute information. Then int-age-16 and int-age-36 are matched into pairs, and the loading attribute method of the first attribute information int-age-16 is obtained, and then the assignment attribute method of the second attribute information int-age-36 is obtained, thereby obtaining an assembly model.
[0093] See also Figure 2 As shown, the conversion method of entity class objects under the coding architecture includes step S60, and step S60 is as follows.
[0094] S60: assigning the attribute value of the first attribute information to the second attribute information according to the assembly model.
[0095] See also Figure 2As shown, the first attribute information and the second attribute information are matched in pairs, and each pair of the first attribute information and the second attribute information corresponds to an assembly model. In the assembly model, the attribute value of the first attribute information is obtained by the loading attribute method, and then the attribute value is assigned to the second attribute information by the assignment attribute method. Thus, the conversion from the first attribute information to the second attribute information is completed. Among them, the attribute content in the target attribute information that is not replaced by the assignment remains unchanged. To facilitate the explanation of how to complete the conversion, the following continues to take Student 1 and Student 2 as an example, and the explanation is as follows.
[0096] See also Figure 2 and Figure 7 As shown, the first attribute information includes, for example, 3 lines of attribute content, which are int-age-16, int-math-95, and boolean-gender-female. The second attribute information includes, for example, 3 lines of content, which are int-age-36, int-math-55, and boolean-gender-male. The first attribute information and the second attribute information are paired and formed into an assembly model. In the assembly model, the attribute value 16 is obtained from int-age-16 through the get method of the first attribute information in Java, and the attribute value 16 is assigned to int-age-36 through the set method of the second attribute information in Java, thereby converting the attribute content of the original attribute information to the target attribute information. Then, int-math-55 is compared with the first attribute information, and the assembly model is formed again to obtain the attribute value 95 of int-math-95 and assign it to int-math-55. By analogy, the second attribute information obtained after assignment is int-age-16, int-math-95, and boolean-gender-female. The target attribute information finally obtained is int-age-16, int-math-95, boolean-gender-female, and int-Chinese-60.
[0097] It should be noted that when there is no attribute content in the class data, the first attribute information and / or the second attribute information is an empty set, or the native jdk call is abnormal, an exception prompt corresponding to the situation is set, and the corresponding exception information can be printed out. Among them, the exception prompt appears, but no exception information is thrown. You only need to pay attention to whether the second attribute information is an empty set to clarify whether the conversion process is normal, and there is no need to capture and handle exceptions.
[0098] See also Figure 2 and Figure 3As shown, if there is no attribute information in the class data, the first type of attribute information and the second type of attribute information do not exist, so the reference set data is an empty set. In step S20, the class data cannot instantiate the original object data and the target object data, so after the conversion process of the entity class object occurs, the second attribute information is an empty set. In Java, the corresponding setting exception prompt can be "Cannot find the exception thrown by this method" or "No SuchMethod Exception".
[0099] See also Figure 2-Figure 7 As shown, in step S30, the first attribute information may also be an empty set, because there is no attribute content that provides a method for loading attributes, so the assembly model cannot be obtained in step S50, and the assignment process will not occur. If the assignment process does not occur, there will be no conversion from the original object data to the target object data. In step S40, the second attribute information is a subset of the target attribute information, and the second attribute information may be an empty set. When the second attribute information is an empty set, because there is no attribute content that provides a method for assigning attributes, the assembly model cannot be obtained in step S50, and the assignment process will not occur. The obtained second attribute information will also be an empty set. In Java, the corresponding exception prompt is set, and the exception prompt may be "Exception thrown by not having permission to operate this method" or "Illegal Access Exception".
[0100] See also Figure 2 As shown, in Java, when the native jdk call is abnormal, the reflection instruction cannot be used to normally obtain the attribute information, so an error may occur when extracting the first type of attribute information, the second type of attribute information or the first attribute information in step S10, an error may occur when extracting the original attribute information and the target attribute information in step S20, and an error may occur when extracting the target attribute information in step 40. When this happens, the exception prompt can be set to "Use jdk reflection to throw an exception" or "Invocation Target Exception".
[0101] See also Figure 1-Figure 7As shown, in the above scheme, firstly, the class data corresponding to the entity class object is obtained, and according to the different architecture layers, a screening model is constructed to obtain reference set data. Then, the class data is instantiated to obtain the original object data and the target object data located in different architecture layers, and the original attribute information and the target attribute information are obtained. By referring to the set data, the first attribute information is extracted from the original attribute information, and then the target attribute information is extracted and compared with the first attribute information for correlation to obtain the second attribute information. The second attribute information and the first attribute information are matched into pairs, and the loading attribute method of the first attribute information and the assignment attribute method of the second attribute information are obtained to construct an assembly model. According to the assembly model, the attribute value of the first attribute information is assigned to the second attribute information. Finally, the target object data is obtained. According to the scheme provided by the present invention, the conversion between different entity class objects can be realized, and only the developer needs to preset the class data of different architecture layers, which greatly saves the developer's time. Moreover, the unified coding during the conversion process can not only realize accurate attribute information conversion, but also facilitate the developer to trace and modify the architecture content. In addition, the scheme provided by the present invention avoids the direct comparison of two entity class objects, and the conversion efficiency is high.
[0102] See also Figure 1-Figure 7 As shown, through the above scheme, in Java, classes can be automatically identified, and class conversion and attribute assignment can be performed efficiently. No additional processing is required by developers, which improves the development efficiency of developers, reduces the development cycle, saves development costs, greatly reduces the generation of redundant codes, improves the readability and reusability of the code, and optimizes the display effect and style of the code. At the same time, the device corresponding to the entity class object conversion method of the present invention is very practical and requires almost no additional learning cost. The device uses the underlying bytecode file as the entry point, obtains the attributes and methods of the entity class object through reflection, and realizes efficient conversion. Moreover, it only needs to use the pom file to introduce it, and the conversion method of the entity class object under the coding architecture of the present invention can be conveniently used.
[0103] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0104] See also Figure 8 As shown, in one embodiment, an entity class object conversion device 100 is provided, and the entity class object conversion device 100 corresponds to the conversion method of the entity class object under the coding architecture in the above embodiment. The entity class object conversion device 100 includes a class data processing module 101, an object instance module 102, a first screening module 103, a second screening module 104, an assembly module 105 and an assignment module 106. Each functional module is described in detail as follows.
[0105] The class data processing module 101 is used to collect class data at different architecture layers, and compare the class data at different architecture layers to obtain reference set data.
[0106] The object instance module 102 is used to instantiate the class data, obtain original object data and target object data, and obtain original attribute information of the original object data and target attribute information of the target object data according to attribute type, attribute name and attribute method.
[0107] The first screening module 103 is used to screen the original attribute information according to the reference set data to obtain first attribute information.
[0108] The second screening module 104 is configured to obtain second attribute information from the target attribute information according to the correlation with the first attribute information.
[0109] The assembly module 105 is used to obtain the loading attribute method of the first attribute information and the assignment attribute method of the second attribute information, and establish an assembly model according to the loading attribute method and the assignment attribute method.
[0110] The assignment module 106 is used to assign the attribute value of the first attribute information to the second attribute information according to the assembly model.
[0111] In one embodiment, the class data processing module 101 is specifically used for:
[0112] Get class data, and get a first architecture layer that sends data and a second architecture layer that receives data.
[0113] In the first architecture layer, the preset class data includes first class attribute information, and in the second architecture layer, the preset class data includes second class attribute information.
[0114] The first type of attribute information and the second type of attribute information are compared, a screening model is constructed, and the first type of attribute information is marked according to the screening model to form reference set data.
[0115] The class data processing module 101 is also specifically used for:
[0116] The screening objects and screening conditions are preset, wherein the screening objects are the attribute type and attribute name of the first category attribute information, and the attribute type and attribute name of the second category attribute information.
[0117] The first type of attribute information is extracted piece by piece, and the extracted first type of attribute information and the second type of attribute information are compared piece by piece.
[0118] Determine whether the extracted first-category attribute information meets the screening conditions.
[0119] If the extracted first-category attribute information meets the screening condition, the extracted first-category attribute information is marked, and the next first-category attribute information is extracted until the first-category attribute information is completely extracted.
[0120] If the extracted first-category attribute information does not meet the screening condition, the extracted first-category attribute information is skipped, and the next first-category attribute information is extracted until the first-category attribute information is completely extracted.
[0121] The first-category attribute information is read, and the marked or unmarked first-category attribute information is collected to form reference set data.
[0122] In one embodiment, the first screening module 103 is specifically configured to:
[0123] Preset mapping conditions.
[0124] The original attribute information is read, and attribute information not involved in the conversion in the original attribute information is excluded according to the mapping condition, so as to obtain the first attribute information.
[0125] The first screening module 103 is further specifically used for:
[0126] Read the original attribute information one by one.
[0127] Determine whether the original attribute information meets the mapping conditions.
[0128] When the original attribute information meets the mapping conditions, the original attribute information is retained.
[0129] When the original attribute information does not meet the mapping conditions, the original attribute information is removed.
[0130] Determine whether the current original attribute information is the last one. If the current original attribute information is the last one, collect the retained original attribute information set and obtain the first attribute information. If the current original attribute information is not the last one, read the next original attribute information until all the original attribute information is read.
[0131] In one embodiment, the second screening module 104 is specifically configured to:
[0132] Extract target attribute information one by one.
[0133] Determine whether there is first attribute information related to the target attribute information.
[0134] If there is first attribute information related to the target attribute information, the target attribute information is used as the second attribute information, and the second attribute information and the corresponding first attribute information are matched into pairs.
[0135] Determine whether the current target attribute information is the last one. If it is the last one, complete the extraction of the second attribute information. If it is not the last one, read the next target attribute information until the target attribute information is traversed.
[0136] The present invention provides an entity class object conversion device, which first obtains class attribute information of class data in different architecture layers and obtains reference set data. Then, the class data is instantiated to obtain original object data and target object data, and first attribute information is obtained based on the comparison between the reference set data and the original object data. Then, second attribute information is obtained based on the comparison between the first attribute information and the target attribute information, thereby confirming the attribute content directly involved in the conversion assignment. Then, the loading attribute method of the first attribute information and the assignment attribute method of the second attribute information are obtained to form a unified assembly model, and the assignment from the first attribute information to the second attribute information is completed through the assembly model.
[0137] See also Figure 8-Figure 10 As shown, the specific limitations of the entity class object conversion device 100 can refer to the limitations of the conversion method of the entity class object under the coding architecture in the above text, and will not be repeated here. The various modules in the above-mentioned entity class object conversion device 100 can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor 201 in the computer device 200 in the form of hardware, or can be stored in the memory 202 in the computer device 200 in the form of software, so that the processor 201 can call and execute the operations corresponding to the above-mentioned modules.
[0138] See also Fig. 9 and Fig.10As shown, in one embodiment, a computer device 200 is provided, the computer device 200 includes a processor 201 and a memory 202, the memory 202 stores a computer program 2021, and the processor 201 runs the computer program 2021 to implement the above-mentioned entity class object conversion method. The processor 201 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), or other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The memory 202 may include a random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The memory 202 may also be an internal memory of the random access memory (RAM) type, and the processor 201 and the memory 202 may be integrated into one or more independent circuits or hardware, such as an application specific integrated circuit (ASIC). It should be noted that the computer program 2021 in the above-mentioned memory 202 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium 300 when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device 200 (which may be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention.
[0139] See also Figure 2 and Fig. 9 As shown, in one embodiment, a computer device 200 is provided, including a processor 201, a memory 202, and a computer program 2021 stored in the memory 202 and executable on the processor 201. When the processor 201 executes the computer program 2021, the following steps are implemented:
[0140] During the development process, obtain and compare class data in different architectural layers to obtain reference collection data.
[0141] Instantiate class data, obtain original object data and target object data, and obtain original attribute information of the original object data and target attribute information of the target object data according to attribute type, attribute name and attribute method.
[0142] According to the reference set data, the original attribute information is filtered to obtain the first attribute information.
[0143] The second attribute information is acquired from the target attribute information based on the correlation with the first attribute information.
[0144] Obtaining a loading attribute method of the first attribute information and an assignment attribute method of the second attribute information, and establishing an assembly model according to the loading attribute method and the assignment attribute method.
[0145] According to the assembly model, the attribute value of the first attribute information is assigned to the second attribute information.
[0146] See also Figure 2 , Fig. 9 and Fig.10 As shown, in one embodiment, a computer-readable storage medium 300 is provided, and a computer instruction 301 is stored in the computer-readable storage medium 300. When the computer instruction 301 is executed by the processor 201, the following steps are implemented:
[0147] During the development process, obtain and compare class data in different architectural layers to obtain reference collection data.
[0148] Instantiate class data, obtain original object data and target object data, and obtain original attribute information of the original object data and target attribute information of the target object data according to attribute type, attribute name and attribute method.
[0149] According to the reference set data, the original attribute information is filtered to obtain the first attribute information.
[0150] The second attribute information is acquired from the target attribute information based on the correlation with the first attribute information.
[0151] Obtaining a loading attribute method of the first attribute information and an assignment attribute method of the second attribute information, and establishing an assembly model according to the loading attribute method and the assignment attribute method.
[0152] According to the assembly model, the attribute value of the first attribute information is assigned to the second attribute information.
[0153] See also Figure 1 , Figure 2 , Fig. 9 and Fig.10As shown, it should be noted that the above functions or steps that can be implemented by the computer-readable storage medium 300 or the computer device 200 can be found in the corresponding descriptions of the database 1, the front end 3 and the back end 2 in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0154] See also Figure 1 , Fig. 9 and Fig.10 As shown, a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program 2021, and the computer program 2021 can be stored in a memory 202 and / or a non-volatile / volatile computer-readable storage medium 300. When the computer program 2021 is executed, it may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory 202, database 1 or other media used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0155] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0156] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for converting entity class objects under a coding architecture, characterized in that: include: Acquire a first architecture layer for sending data and a second architecture layer for receiving data, acquire class data of the first architecture layer and class data of the second architecture layer, and compare the class data of the first architecture layer and the class data of the second architecture layer to obtain reference set data; Instantiate the class data of the first architecture layer to obtain original object data, instantiate the class data of the second architecture layer to obtain target object data, and acquire original attribute information of the original object data and target attribute information of the target object data according to attribute type, attribute name and attribute method; According to the reference set data, the original attribute information is screened to obtain first attribute information; acquiring second attribute information from the target attribute information according to the correlation with the first attribute information; Obtaining a loading attribute method of the first attribute information and an assignment attribute method of the second attribute information, and establishing an assembly model according to the loading attribute method and the assignment attribute method; as well as According to the assembly model, assigning the attribute value of the first attribute information to the second attribute information; The step of assigning the attribute value of the first attribute information to the second attribute information includes: Acquire the second attribute information piece by piece from the target attribute information; Matching the first attribute information and the second attribute information having the same attribute type and the same attribute name into pairs; and Before acquiring the next piece of the second attribute information, completing the assignment of the second attribute information according to the assembly model; The step of assigning the attribute value of the first attribute information to the second attribute information according to the assembly model comprises: Acquiring the attribute value of the first attribute information by the loading attribute method; and The attribute value of the first attribute information is assigned to the second attribute information through the attribute assignment method.
2. The method for converting entity class objects under the coding architecture according to claim 1, characterized in that: The step of comparing the class data of the first architecture layer with the class data of the second architecture layer to obtain reference set data comprises: When developing the first architecture layer and the second architecture layer, the class data of the first architecture layer is preset to include the first type of attribute information, and the class data of the second architecture layer is preset to include the second type of attribute information; and When converting the entity class objects of the first architecture layer to the entity class objects of the second architecture layer, the first class attribute information is filtered according to whether the first class attribute information and the second class attribute information are the same to obtain the reference set data.
3. The method for converting entity class objects under the coding architecture according to claim 2, characterized in that: The step of filtering the first type of attribute information according to whether the first type of attribute information and the second type of attribute information are the same to obtain the reference set data comprises: A screening condition is preset, and the screening condition is that the attribute type and attribute name of the first category attribute information are the same as those of the second category attribute information; Extracting the first type of attribute information one by one, and comparing the first type of attribute information with the second type of attribute information one by one, to determine whether the first type of attribute information meets the screening condition; If the first type of attribute information meets the screening condition, marking the first type of attribute information, and if the first type of attribute information does not meet the screening condition, skipping the first type of attribute information; and The first-category attribute information is read, and the marked or unmarked first-category attribute information is collected to form reference set data.
4. The method for converting entity class objects under the coding architecture according to claim 1, characterized in that: The step of filtering the original attribute information according to the reference set data to obtain the first attribute information comprises: Preset mapping conditions to establish a mapping relationship between the original object data and the reference set data; and The original attribute information is read, and according to the mapping condition, the attribute information not involved in the conversion in the original attribute information is screened and removed to obtain the first attribute information.
5. The method for converting entity class objects under the coding architecture according to claim 1, characterized in that: The step of acquiring the second attribute information from the target attribute information according to the correlation with the first attribute information comprises: Extracting the target attribute information one by one; Judging whether the first attribute information related to the target attribute information exists according to whether the attribute name and the attribute type are the same; If the first attribute information related to the target attribute information exists, use the target attribute information as the second attribute information; and If the first attribute information related to the target attribute information does not exist, the current target attribute information is skipped.
6. A conversion device for entity class objects under a coding architecture, characterized in that: include: a class data processing module, which obtains a first architecture layer for sending data and a second architecture layer for receiving data, obtains class data of the first architecture layer and class data of the second architecture layer, and compares the class data of the first architecture layer and the class data of the second architecture layer to obtain reference set data; An object instance module, used to instantiate the class data of the first architecture layer to obtain original object data, instantiate the class data of the second architecture layer to obtain target object data, and obtain original attribute information of the original object data and target attribute information of the target object data according to attribute type, attribute name and attribute method; A first screening module, configured to screen the original attribute information according to the reference set data to obtain first attribute information; A second screening module, configured to obtain second attribute information from the target attribute information according to the correlation with the first attribute information; An assembly module, used for obtaining a loading attribute method of the first attribute information and an assignment attribute method of the second attribute information, and establishing an assembly model according to the loading attribute method and the assignment attribute method; as well as an assignment module, used for assigning the attribute value of the first attribute information to the second attribute information according to the assembly model; Wherein, in the step of assigning the attribute value of the first attribute information to the second attribute information, the assignment module is used to obtain the second attribute information one by one from the target attribute information, and match the first attribute information and the second attribute information with the same attribute type and the same attribute name into pairs, and before obtaining the next second attribute information, complete the assignment of the second attribute information according to the assembly model; Among them, in the step of assigning the attribute value of the first attribute information to the second attribute information according to the assembly model, the assignment module is used to obtain the attribute value of the first attribute information through the loading attribute method, and assign the attribute value of the first attribute information to the second attribute information through the assignment attribute method.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method for converting entity class objects under the coding architecture according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of a method for converting entity class objects under a coding architecture as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Entity class code generation method and device, computer equipment and storage medium
CN111026777A
Entity class generation method and device thereof and storage medium
CN113176877A