A Java MVC architecture-based encapsulation system, method and electronic device
The three-tier architecture and freeze flag mechanism of the Segment object solves the problems of function overloading and object property modification in the Java MVC architecture, and achieves unified parameter management and improved computing efficiency.
Patent Information
- Application Number
- CN202210081905.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-24
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-01-24
AI Technical Summary
The existing Java MVC architecture has problems such as frequent function overloading, inability to freeze and modify referenced object properties, and high programming complexity, which increases the difficulty of code maintenance and affects computing performance.
A three-layer architecture of Segment objects is adopted, including layer structure Layer, slice structure Slice and frame structure Frame. Parameters are frozen through freeze flags, and Segment objects are used to unify input and output parameters to avoid function overloading. Common logic is shared between service businesses to reduce repeated calculations.
Reduce function overloading, prevent object property modification, improve computing efficiency, simplify code maintenance, and avoid repeated calculations on the data persistence side.
Smart Images

Figure CN114546351B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of communication technology, and in particular relates to a packaging system, method and electronic device based on Java MVC architecture. Background Art
[0002] The Java language is widely used in backend application services, providing various services for the front end, including mobile phones, computers, browsers, etc., and many of them use the MVC model, namely view, model and controller. In the code structure, it is divided into the server side, business processing side and data persistence side. Generally speaking, a business logic data is transmitted from the server side to the business processing side for logical judgment, and then transmitted to the data persistence side for storage, and then the result is returned to the server side through the business processing side.
[0003] As user and business needs continue to expand, many versions of front-ends and corresponding back-end APIs have emerged. Since the back-end API needs to be compatible with different versions of the front-end, multiple functions are constantly overloaded, which brings at least the following problems:
[0004] 1. If the function in the business processing end uses parameters of basic types, there may be duplicate parameter numbers and types, which will require the function to be renamed, making code maintenance more difficult.
[0005] 2. If classes are passed as parameters, new requirements require modifying the class and adding more class attributes. However, in some business logic, some class attributes cannot be modified. Java does not support internal modification of referenced objects when passing classes as parameters. Therefore, if the program developer accidentally modifies the internal attribute values of the object, the entire application will fail.
[0006] 3. In addition, in a three-tier architecture, services often call each other, but some logic within the service may need to be repeatedly calculated, which in turn affects computing and processing performance, especially when performing operations on the data persistence side. Currently, the above problems are generally solved by overloading methods or relying on third-party caches. However, the former generally leads to code bloat, and the latter increases deployment difficulty or sacrifices system stability (causing problems such as cache penetration, cache breakdown, and cache avalanche). Summary of the Invention
[0007] In order to overcome the shortcomings of the existing technology, the purpose of the present invention is to provide a packaging system, method and electronic device based on the Java MVC architecture, which is mainly used to solve the problems in the existing technology such as the need for a large number of overloads, the inability to freeze and modify properties in referenced objects, and high programming complexity under special circumstances.
[0008] In order to solve the above problems, the technical solutions adopted by the present invention are as follows:
[0009] In a first aspect, the present invention provides an encapsulation system based on a Java MVC architecture, comprising a Segment object, wherein the Segment object comprises a plurality of layer structures, three key-value pair sets, a freeze flag, and two instantiation constructors, each of the layer structures comprising at least one slice structure, and each of the slice structures comprising at least one frame structure.
[0010] The layer structure Layer includes a currently used layer structure Layer, and the currently used layer structure Layer is a Layer object variable currently used by the Segment object;
[0011] Two of the three key-value pair sets are a persistent key-value pair set and a temporary storage key-value pair set, and the other key-value pair set has a key of the name of the Layer and a value of the instantiation object of the Layer;
[0012] The two instantiation constructors are respectively a constructor with name parameters and a constructor without parameters.
[0013] Furthermore, the currently used layer structure Layer corresponds to at least one slice structure Slice, a name variable, three key-value pair sets, a freeze flag, and a constructor, and the slice structure Slice is stored in the key-value pair set of the currently used layer structure Layer;
[0014] The slice structure Slice includes the currently used slice structure Slice, and the name variable is defined as the name of the currently used layer structure Layer;
[0015] Two of the three key-value pair sets are a persistent key-value pair set and a temporary storage key-value pair set, and the other key-value pair set has a key that is a name of a Slice and a value that is an instantiation object of the Slice;
[0016] The constructor is a parameterized instantiation constructor.
[0017] Furthermore, the currently used slice structure Slice corresponds to at least one frame structure Frame, a name variable, three key-value pair sets, a freeze flag, and a constructor, and the frame structure Frame is stored in the key-value pair set of the currently used slice structure Slice;
[0018] The frame structure Frame includes the currently used frame structure Frame, and the name variable is defined as the name of the currently used slice structure Slice;
[0019] Two of the three key-value pair sets are a persistent key-value pair set and a temporary storage key-value pair set, and the other key-value pair set has a key that is the name of the Frame and a value that is an instantiated object of the Frame;
[0020] The constructor is a parameterized instantiation constructor.
[0021] Furthermore, the currently used frame structure Frame is defined as a current frame name variable, and the currently used frame structure Frame internally contains 0 or more internal parameter objects, and also includes a parameter object list, a frame name, a freeze flag, and a constructor;
[0022] When the currently used frame structure Frame contains an internal parameter object, the internal parameter object is stored in the parameter object list within the currently used frame structure Frame;
[0023] The constructor is a parameterized instantiation constructor.
[0024] Furthermore, the internal parameter object includes a UUID, a parameter name attribute and a value.
[0025] In a second aspect, the present invention also provides an encapsulation method based on the Java MVC architecture, comprising the following steps:
[0026] The server receives the client's data request and determines the type of the incoming parameter;
[0027] After determining the basic type, the data is encapsulated into the Segment object, and the layer structure name of the Segment object is the usage version information;
[0028] The server transmits the Segment object to the business processing end, and the business processing end identifies the name of the layer structure Layer and performs corresponding logical actions according to the corresponding usage version information;
[0029] The business processing end transmits the Segment that has executed the logical action as an input parameter object to the data persistence end. The data persistence end returns the Segment as an output parameter object to the server end through the business processing end. The server end extracts the target object and returns it to the client.
[0030] Furthermore, the function obtains required parameters in the layer structure Layer, slice structure Slice and frame structure Frame through names in the layer structure Layer, slice structure Slice or frame structure Frame according to business needs.
[0031] Furthermore, after the corresponding parameters are distinguished in the layer structure Layer, the slice structure Slice and the frame structure Frame, a freeze flag is triggered and the corresponding parameters are frozen through the freeze method.
[0032] Furthermore, when there are mutual function calls between service businesses, a first service business is defined. After the first service business calls the processing function in the data persistence end, the processed data is saved to the persistent key-value pair set or the temporary storage key-value pair set of the Segment object, and then transmitted to at least one other service business;
[0033] The rest of the service businesses determine whether there is an execution result of the same processing function. If so, they directly read the Segment object.
[0034] In a third aspect, the present invention further provides an electronic device, comprising:
[0035] processor;
[0036] a memory for storing instructions executable by the processor;
[0037] The processor implements the above method by running the executable instructions.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] When the parameter type is the base type, the Segment object is used, the version information is used as the name of its layer structure, the parameters corresponding to the version are passed in, and the entire Segment object is used as a parameter to unify the input and output parameters. By judging and identifying the name of the layer structure, the parameters are obtained and the corresponding logic is executed. Different versions can share common logic, which greatly reduces unnecessary function overloading.
[0040] When the incoming parameter type is an object type, the corresponding parameters are distinguished from the layer structure, slice structure, and frame structure when necessary, and the freeze flag is triggered. The corresponding parameters are frozen through the freeze method to prohibit the modification of specific parameters, thereby achieving the purpose of modifying other target parameters within the reference object;
[0041] When functions are called between service businesses, the processed data is saved in the Segment object in advance. The other service businesses only need to determine whether there are execution results, and can directly read the Segment object, avoiding repeated calculations on the data persistence side and avoiding relying on third-party cache to improve efficiency.
[0042] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The present invention is further described with reference to the accompanying drawings. However, the embodiments in the accompanying drawings do not constitute any limitation to the present invention. A person skilled in the art can obtain other drawings based on the following drawings without creative effort.
[0044] Figure 1 It is a schematic diagram of a packaging system based on Java MVC architecture of the present invention.
[0045] Figure 2 It is a flow chart of a packaging method based on Java MVC architecture of the present invention. DETAILED DESCRIPTION
[0046] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0047] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0048] In the description of the present invention, when a specific device is described as being located between a first device and a second device, an intervening device may or may not be present between the specific device and the first device or the second device. When a specific device is described as being connected to another device, the specific device may be directly connected to the other device without an intervening device, or may be directly connected to the other device but with an intervening device.
[0049] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.
[0050] The applicant found that:
[0051] To meet increasing user demands and maintain compatibility with older front-end versions (users' mobile apps may not all have the latest versions, and the data returned by the backend may vary depending on the functionality of the different versions), the front-end typically transmits the version number to the back-end, which automatically selects the corresponding server. The server then calls the function in the corresponding version's business processing end, which performs the calculation and returns the result to the server, which then returns it to the front-end. However, existing technologies often require extensive reloading, cannot freeze or modify properties within referenced objects, and have high programming complexity in special circumstances.
[0052] In view of this, firstly, referring to Figure 1 In this embodiment, a packaging system based on the Java MVC architecture is disclosed, including a Segment object. The Segment object includes multiple layer structures, three key-value pair sets, a freeze flag, and two instantiation constructors. Each layer structure includes at least one slice structure, and each slice structure includes at least one frame structure. The layer structure, slice structure, and frame structure form a three-layer architecture. In this embodiment, one layer structure corresponds to two slice structures, and one slice structure corresponds to two frame structures. In addition, the Segment object, layer structure, slice structure, and frame structure are all implemented using code.
[0053] The multiple layer structures include a currently used layer structure. The currently used layer structure is a layer object variable currently used by the Segment object. A key-value pair set is defined, where the key is the name of the layer and the value is the instantiation object of the layer.
[0054] Two of the three key-value pair sets are a persistent key-value pair set (key is a string, value is an object) and a temporary storage key-value pair set (key is a string, value is an object), and the other key-value pair set is a layer name and a layer instantiation object.
[0055] The two instantiation constructors are a constructor with name parameters and a constructor without parameters.
[0056] When instantiating a Segment object with parameters, the parameters are used as the name of the first layer. In practice, the layer name is the name of the application layer in a Java three-tier architecture. When the Controller receives parameters from the client, it instantiates a Segment object and passes the name of the service method being called (for example, getUserName) as a parameter to the Segment object. Once the Segment object is instantiated, a layer named getUserName exists within the Segment object.
[0057] The above Segment object contains multiple layer structures. During the current use process, it points to one of the layer structures, that is, the layer structure currently in use.
[0058] The currently used layer structure Layer corresponds to at least one slice structure Slice, a name variable, three key-value pair sets, a freeze flag, and a constructor, and the slice structure Slice is stored in the key-value pair set of the currently used layer structure Layer;
[0059] The slice structure Slice includes the currently used slice structure Slice, and the name variable is defined as the name of the currently used layer structure Layer;
[0060] Two of the three key-value pair sets are a persistent key-value pair set (key is a string, value is an object) and a temporary storage key-value pair set (key is a string, value is an object), and the other key-value pair set is a Slice name and a Slice instantiation object.
[0061] The constructor is an instantiation constructor with parameters.
[0062] It's important to note that a Segment object consists of multiple layers, each with its own name. This name can be used to indicate a version or a service type, and there are no hard and fast rules. Each layer has a name, and creating a Segment object requires passing in a name, which is the name of the first layer.
[0063] The above currently used layer structure Layer includes multiple slice structures Slice, which includes a currently used slice structure Slice and a name variable named as the currently used layer structure Layer.
[0064] Furthermore, Layer can create multiple Slices as needed and switch to a specified Slice in the current Layer. For example, if the Layer is named getUserName, the user can create slices named getUserName1, getUserName2, etc., and can point the current slice of the Layer named getUserName to any one, such as getUserName2, as needed.
[0065] The currently used slice structure Slice corresponds to at least one frame structure Frame, a name variable, three key-value pair sets, a freeze flag and a constructor. The frame structure Frame is stored in the key-value pair set of the currently used slice structure Slice;
[0066] The frame structure Frame includes the currently used frame structure Frame, and the name variable is defined as the name of the currently used slice structure Slice;
[0067] Two of the three key-value pair sets are a persistent key-value pair set (key is a string, value is an object) and a temporary storage key-value pair set (key is a string, value is an object), and the other key-value pair set is a key of the Frame name and a value of the Frame instantiation object.
[0068] The constructor is an instantiation constructor with parameters.
[0069] The above currently used slice structure Slice includes multiple frame structures Frame, which includes a currently used frame structure Frame and a name variable named as the currently used slice structure Slice.
[0070] The currently used frame structure Frame is defined as the current frame name variable. The currently used frame structure Frame contains 0 or more internal parameter objects, as well as a parameter object list, a frame name, a freeze flag and a constructor;
[0071] When the current frame structure Frame contains internal parameter objects, the internal parameter objects are stored in the parameter object list of the current frame structure Frame. A variable of type Object is defined in the object list to store the final result. Each Frame has a variable of type Object to store the final result.
[0072] The constructor is an instantiation constructor with parameters.
[0073] It can be seen that the layer structure Layer, slice structure Slice, and frame structure Frame all have their own freeze marks. If the layer structure Layer is frozen, the slice structure Slice and frame structure Frame below it are all frozen. If the slice structure Slice is frozen, all the frame structures Frame below it are also frozen.
[0074] Additionally, internal parameter objects include a UUID (universally unique identifier), a parameter name, and a value (Java Object type). The Segment object provides the SegmentType enumeration class, which provides enumerations for layer structures, slice structures, and frame structures. The Segment object points to these internal layer structures, slice structures, and frame structures.
[0075] Example 1:
[0076] In this embodiment, a layer structure Layer is used as a business, such as user login, so the layer structure Layer is named userLogin. In the traditional three-tier architecture, the server entrance is the server-side Controller. In a server-side Controller, we generate a Segment object and name it the business name of the server-side controller. The next layer of the server-side controller is generally the business processing end Service, and the business processing end Service may call other business processing end Services or data persistence ends Dao, that is, the Segment object is named the business name of the controller; the different layer structures layer in the Segment object can define names according to business conditions. Of course, when generating the Segment object, you need to pass in a name, which is the name of the first layer structure Layer. You can also not pass in a name, and automatically generate a name by default, for example, change the name to a fixed value "$Segment_Default_Name$".
[0077] As a manifestation of this embodiment, different Services use the same type of parameters (Segment). Different Services only need to switch to their corresponding Layer, Slice or frame to obtain the parameters required for the business. Of course, if the parameters required by different Services or Dao are the same, they can be obtained in the same Layer, Slice or frame, reflecting the flexibility of using the Segment object.
[0078] Secondly, refer to Figure 2, this embodiment discloses a packaging method based on Java MVC architecture, including the following steps:
[0079] The server receives the client's data request and determines the type of the incoming parameter. The client's data request can be an HTTP request or other forms of request.
[0080] After determining the basic type, the data is encapsulated into the Segment object. The layer name of the Segment object is the usage version information.
[0081] The server transmits the Segment object to the business processing end. The business processing end identifies the name of the layer structure and performs the corresponding logical action according to the corresponding usage version information. Multiple usage version information points to the same logical action.
[0082] The business processing end transmits the Segment that has executed the logical action as the input parameter object to the data persistence end. The data persistence end returns the Segment as the output parameter object to the server through the business processing end. The server extracts the target object and returns it to the client.
[0083] It should be noted that in the prior art, if the parameters passed in are different, but the method name of the Service remains unchanged, the function of the Service needs to be overloaded. There are cases where the basic type and quantity are the same but the actual meaning is different. In this case, the method name must be modified. In this embodiment, the version information can be used as the name of the layer structure Layer through the Segment object, and the parameters corresponding to the version can be passed in. The entire Segment object can be used as a parameter to unify the input and output parameters, and the entire Segment object can be passed as a parameter to the business processing end. In the business processing end method, the name of the layer structure Layer is judged and identified, and the parameters are obtained to execute the corresponding logic. The common logic of different versions can be shared, which greatly reduces unnecessary function overloading.
[0084] When extracting the target object on the server side, the required target object can be cut out from the Segment object according to the specific needs and specifications of the server side. This target object can be the result of a certain frame or the entire Segment object, which reflects the characteristics of the Segment object. No matter which layer the Segment object is passed to, each business layer only needs to extract the required part according to its own needs and specifications. It can be any layer structure Layer, slice structure Slice and frame structure Frame. No matter how it is cut, the final result is the corresponding minimum unit frame structure Frame. The frame structure Frame cannot be cut. The frame structure Frame saves the final calculation result.
[0085] The function obtains the required parameters from the layer structure, slice structure, or frame structure through the names in the layer structure, slice structure, or frame structure according to business needs. The specific layer structure, slice structure, and frame structure in the Segment object to be used are determined by the business body. If the parameter acquisition fails, you can avoid errors by assigning setting parameters or automatically calling the setting document.
[0086] In some implementation cases, the incoming parameters are encapsulated into the Segment object, and the parameters corresponding to the function are obtained in the layer structure Layer, slice structure Slice and frame structure Frame through the name according to the business; in addition, when necessary, the corresponding parameters can be frozen through the freeze method before or after the Segment object is passed into the function according to business needs.
[0087] It should be noted that in the prior art, after determining the object type, the programmer may first modify the original object, or add, delete, or modify certain attributes. If the program developer is careless and makes inappropriate modifications at this time, it can easily cause problems with the logic of the previous version. Adding new parameter objects will also lead to code bloat. In this embodiment, the corresponding parameters are directly distinguished from the layer structure Layer, slice structure Slice structure, and frame structure Frame structure without adding any new objects. If the value returned to the client contains at least some of the input parameters, to ensure that the value of this part of the input parameter object is not modified, the corresponding parameters are frozen using the freeze method, prohibiting the modification of specific parameters, thereby achieving the purpose of modifying the remaining target parameters within the reference object.
[0088] In some embodiments, when there are mutual function calls between service businesses, a first service business is defined, and the first service business calls function A to calculate the intermediate variable α. After calling the processing function in the data persistence end, the variable α is added to the persistent key-value pair set or the temporary storage key-value pair set of the Segment object, and then transmitted to at least one other service business;
[0089] The remaining service businesses determine whether there is an execution result of calling function A. If so, they directly read the Segment object.
[0090] It should be noted that in the prior art, if service businesses call each other, it is possible that the processing function of the data persistence end called by the first service function is the same as the processing function of the data persistence end called by the second service function, which will cause the processing function of the data persistence end to be executed repeatedly. In this embodiment, after the first service business calls the processing function in the data persistence end, the processed data can be set to the persistent key-value pair set or the temporary storage key-value pair set of the Segment object as needed, and then passed to the functions of the remaining service businesses. The remaining service business methods only need to determine whether there is an execution result of the same processing function to determine whether to execute the processing function in the data persistence end. If execution is required, the Segment object is directly read, thereby avoiding repeated calculations on the data persistence end and avoiding relying on third-party cache to improve efficiency.
[0091] When the instance object of the Segment object is used as an input parameter, you only need to add parameters and values through its addParam method (if the corresponding layer structure Layer, slice structure Slice, and frame structure Frame are frozen, an error will be reported). In the method body, you can add the return result through the setResult method, and then return the instance object of the entire Segment object as the return parameter.
[0092] If multiple return values are required in the method body, you can create multiple frame structures Frame through the next method and use the setResult method to set the return results one by one. At this time, you can use the layer structure Layer to return multiple result frame results.
[0093] If the entire system uses Segment objects as input and output parameters, only the same object needs to be used in method passing. You only need to switch between different layer structures in different functions. Even in an MVC architecture, a single Segment object can connect three layers. Different MVC layers define different layer structures for Segment objects, and functions within the M can define different slice structures within the layer structure, making the entire business method processing more efficient.
[0094] When it is prohibited to modify the parameters of the Segment object within the function, you can freeze different layer structures Layer, slice structures Slice, and frame structures Frame. After freezing, the parameter value in the frozen Segment object cannot be modified in the function body. If the parameter is an object type, each time it is retrieved, the object at the time of the first setting will be obtained, thereby ensuring data security and program robustness, and preventing developers from modifying data without knowing it and causing program errors.
[0095] In a third aspect, this embodiment discloses an electronic device, including:
[0096] processor;
[0097] a memory for storing processor-executable instructions;
[0098] The processor executes the executable instructions to implement the encapsulation method based on the Java MVC architecture in the above embodiment.
[0099] In a fourth aspect, this embodiment discloses a computer-readable storage medium having computer instructions stored thereon. When the computer instructions are executed by a processor, the encapsulation method based on the Java MVC architecture in the above embodiment is implemented.
[0100] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.
[0101] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0102] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0103] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0104] In summary, compared with the prior art, the above embodiment provides a packaging system, method, and electronic device based on the Java MVC architecture. When the parameter type input is a basic type, the Segment object is used, the usage version information is used as the name of its layer structure layer, and the parameters corresponding to the usage version are input. The entire Segment object is used as a parameter to unify the input and output parameters. By judging and identifying the name of the layer structure layer, the parameters are obtained and the corresponding logic is executed. Different usage versions can share common logic, which greatly reduces unnecessary function overloading.
[0105] When the incoming parameter type is an object type, the corresponding parameters are distinguished from the layer structure Layer, slice structure Slice and frame structure Frame, the freeze flag is triggered, and the corresponding parameters are frozen through the freeze method to prohibit the modification of specific parameters, thereby achieving the purpose of modifying other target parameters within the reference object;
[0106] When functions are called between service businesses, the processed data is saved in the Segment object in advance. The other service businesses only need to determine whether there are execution results, and can directly read the Segment object, avoiding repeated calculations on the data persistence side and avoiding relying on third-party cache to improve efficiency.
[0107] The above embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and replacements made by technicians in this field on the basis of the present invention fall within the scope of protection required by the present invention.
Claims
1. A packaging system based on Java MVC architecture, characterized in that: The Segment object includes a plurality of layer structures, three key-value pair sets, a freeze flag, and two instantiation constructors. Each of the layer structures includes at least one slice structure, and each of the slice structures includes at least one frame structure. The layer structure Layer includes a currently used layer structure Layer, and the currently used layer structure Layer is a Layer object variable currently used by the Segment object; Two of the three key-value pair sets are a persistent key-value pair set and a temporary storage key-value pair set, and the other key-value pair set has a key of the name of the Layer and a value of the instantiation object of the Layer; The two instantiation constructors are respectively a constructor with name parameters and a constructor without parameters; The currently used layer structure Layer corresponds to at least one slice structure Slice, a name variable, three key-value pair sets, a freeze flag, and a constructor, and the slice structure Slice is stored in the key-value pair set of the currently used layer structure Layer; The slice structure Slice includes the currently used slice structure Slice, and the name variable corresponding to the currently used layer structure Layer is defined as the name of the currently used layer structure Layer; Two of the three key-value pair sets corresponding to the layer structure Layer currently in use are a persistent key-value pair set and a temporary storage key-value pair set, and the other key-value pair set has a key that is a Slice name and a value that is an instantiation object of the Slice; The constructor corresponding to the layer structure currently used is an instantiation constructor with parameters; The currently used slice structure Slice corresponds to at least one frame structure Frame, a name variable, three key-value pair sets, a freeze flag and a constructor, and the frame structure Frame is stored in the key-value pair set of the currently used slice structure Slice; The frame structure Frame includes the currently used frame structure Frame, and the name variable corresponding to the currently used slice structure Slice is defined as the name of the currently used slice structure Slice; Two of the three key-value pair sets corresponding to the slice structure Slice currently in use are a persistent key-value pair set and a temporary storage key-value pair set, and the other key-value pair set has a key that is the name of the Frame and a value that is an instantiation object of the Frame; The constructor corresponding to the slice structure Slice currently used is a parameterized instantiation constructor.
2. A packaging system based on Java MVC architecture according to claim 1, characterized in that: The currently used frame structure Frame is defined as a current frame name variable, and the currently used frame structure Frame contains 0 or more internal parameter objects, and also includes a parameter object list, a frame name, a freeze flag and a constructor; When the currently used frame structure Frame contains an internal parameter object, the internal parameter object is stored in the parameter object list within the currently used frame structure Frame; The constructor currently used in the frame structure Frame is a parameterized instantiation constructor.
3. A packaging system based on Java MVC architecture according to claim 2, characterized in that: The internal parameter object includes UUID, parameter name attributes and value.
4. A packaging method based on Java MVC architecture, applied to a packaging system based on Java MVC architecture as claimed in any one of claims 1 to 3, characterized in that: The following steps are involved: The server receives the client's data request and determines the type of the incoming parameter; After determining the basic type, the data is encapsulated into the Segment object, and the layer structure name of the Segment object is the usage version information; The server transmits the Segment object to the business processing end, and the business processing end identifies the name of the layer structure Layer and performs corresponding logical actions according to the corresponding usage version information; The business processing end transmits the Segment that has executed the logical action as an input parameter object to the data persistence end. The data persistence end returns the Segment as an output parameter object to the server end through the business processing end. The server end extracts the target object and returns it to the client.
5. The encapsulation method based on Java MVC architecture according to claim 4, characterized in that: The function obtains the required parameters in the layer structure Layer, slice structure Slice and frame structure Frame through the names in the layer structure Layer, slice structure Slice or frame structure Frame according to business needs.
6. The encapsulation method based on Java MVC architecture according to claim 5, characterized in that: After distinguishing the corresponding parameters in the layer structure Layer, slice structure Slice and frame structure Frame, the freeze flag is triggered and the corresponding parameters are frozen through the freeze method.
7. The encapsulation method based on Java MVC architecture according to claim 4, characterized in that: When there are mutual function calls between service businesses, a first service business is defined. After the first service business calls the processing function in the data persistence end, it saves the processed data to the persistent key-value pair set or the temporary storage key-value pair set of the Segment object, and then transmits it to at least one other service business; The rest of the service businesses determine whether there is an execution result of the same processing function. If so, they directly read the Segment object.
8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor implements the method according to any one of claims 4 to 7 by running the executable instructions.
Citation Information
Patent Citations
Interface calling method and device, computer equipment and storage medium
CN112988409A
Apparatus, system, and method for facilitating dynamic modification of existing software objects defined in a strongly-typed programming language
US20060130038A1