Multi-module service system, middleware class generation method and device and electronic equipment

By defining the service layer interface and using the annotation processor to automatically generate middleware classes, the time-consuming and labor-intensive problem of manually writing middleware code in a multi-module service system is solved, and the effect of simplifying the development process, improving development efficiency and ensuring coding consistency is achieved.

CN119690545APending Publication Date: 2025-03-25CHINA FAW CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411745448.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In a multi-module service system, manually writing the shared business logic code of middleware is time-consuming and labor-intensive, prone to errors and different code styles, which affects maintenance.

Method used

By defining the service layer interface, using the annotation processor to automatically generate middleware classes, satisfying the different middleware class generation schemes of the interface according to different configurations, simplifying the development process and ensuring coding consistency and correctness.

Benefits of technology

It realizes automatic generation of middleware classes, simplifies the development process, improves development efficiency, ensures coding consistency and correctness, shortens development time and reduces development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690545A_ABST
    Figure CN119690545A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-module service system, a middleware class generation method and device and electronic equipment, and relates to the field of multiple modules, and the system comprises a service layer and middleware; the service layer and the middleware construct a multi-module service system; wherein the modules are called layer by layer to realize a preset service function; the calling comprises calling the service layer by the middleware and calling the middleware by the middleware; wherein the business logic is generated based on the preset service function; dividing a service layer and middleware based on the business logic, and determining a calling relationship among middleware business, the middleware and the service layer; wherein the service layer serves a preset service function and is used for realizing specific business logic of the function; the middleware serves a preset service function and is used for providing common business logic; the system further comprises a service layer interface. Wherein the service layer interface is used for generating a middleware class. Through the scheme, the middleware class is quickly and automatically compiled and generated in batches, the development process is simplified, and the development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of multiple modules, and in particular to a multiple module service system, a middleware class generation method, a middleware class generation device, an electronic device, a storage medium and a development platform. Background Art

[0002] In the development of service systems, service functions are implemented by multiple modules through layer-by-layer calling to meet functional requirements at different levels. The multi-module service system adopts a service layer plus multiple middleware architecture.

[0003] When a service system has many services and requires multiple middlewares, manually writing the common business logic code for these middlewares consumes a lot of manpower and time and is prone to errors. Different developers have different coding habits, which also leads to different styles of middleware codes, which is not conducive to maintenance.

[0004] Therefore, a solution for automatic generation of middleware in a multi-module service system is needed to simplify the development process, improve development efficiency, and ensure the consistency and correctness of the coding. At the same time, different configurations can be used to meet the needs of middleware class generation solutions with different interfaces, shorten development time, reduce development costs, and improve code robustness. Summary of the invention

[0005] The purpose of the present invention is to provide a multi-module service system, a middleware class generation method, a middleware class generation device, an electronic device, a storage medium and a development platform, which at least solve the problem of generating middleware classes that meet different interfaces through different configurations, solve the problem of shortening development time, reducing development costs, and improving code robustness, and solve one of the technical problems of simplifying the development process, improving development efficiency, and ensuring the consistency and correctness of coding.

[0006] The present invention provides the following scheme: According to one aspect of the present invention, there is provided a multi-module service system, the multi-module service system comprising: a service layer, a middleware; The service layer and the middleware construct a multi-module service system; Among them, modules are called layer by layer to realize preset service functions; The calling includes middleware calling the service layer and middleware calling middleware; wherein, based on the preset service function, generating business logic; Divide the service layer and the middleware based on the business logic, and determine the middleware business, the calling relationship between the middleware and the service layer; The service layer serves the preset service functions and is used to implement the specific business logic of the functions; The middleware serves the preset service functions and is used to provide common business logic; Also includes,service layer interface; Wherein, the service layer interface is used to generate a middleware class.

[0007] According to two aspects of the present invention, a method for generating a middleware class is provided. Based on the multi-module service system, the method for generating a middleware class includes: Steps for dividing the service system architecture; steps for defining the service layer interface; steps for determining the interface to middleware class conversion rules; steps for mapping the conversion rules to code template classes; steps for configuring code template classes for interfaces; steps for customizing code template annotation processor classes; steps for calling annotation processor classes to generate middleware classes.

[0008] Furthermore, the step of dividing the service system architecture includes: Obtain the preset service function to be implemented; Corresponding to the preset service function to be implemented, obtaining business logic information; The business logic information includes dividing the service layer and the middleware; The business logic information also includes determining the middleware business based on the division of the service layer and the middleware, and determining the calling relationship between the middleware and the service layer.

[0009] Furthermore, the steps of defining the service layer interface include: The preset service function to be implemented includes multiple services; Dividing the multiple services according to preset dimensions; Among them, the services and the functions they provide are defined; Defining the service and the functions provided by the service includes defining the service as an interface and defining the functions provided by the service as interface methods; Defining the service as an interface includes defining an interface name corresponding to the interface; The function provided by the service is defined as an interface method, including defining a method name, a method return value, a method parameter type and a method parameter name.

[0010] Furthermore, the step of determining the interface to middleware class conversion rule includes: According to the middleware business and the calling relationship between the middleware and the service layer, obtaining conversion rule information from the interface to the middleware class; The conversion rule information includes the definition and specific implementation of the class name, class attributes, class constructor and class method; Wherein, the middleware class and the information of the middleware class are generated according to the interface and the information of the associated interface.

[0011] Furthermore, the step of mapping the conversion rule to a code template class includes: According to the conversion rule information from the interface to the middleware class, parameterize the interface and the information of the associated interface; Generate information of the middleware class according to the parameterized interface and the associated interface information, including information of the code template class for generating the middleware class; Wherein, based on the call, according to the information of the code template class, the definition class name, class attributes, class constructor and definition and implementation information of the class method of the corresponding middleware class are returned, and the conversion rule information from the interface to the middleware class is mapped.

[0012] Furthermore, the step of configuring the code template class for the interface includes: The architecture of the service system includes an architecture based on which one interface corresponds to multiple middlewares; The architecture of the service system includes an architecture based on a plurality of interfaces corresponding to one middleware; The architecture of the service system also includes: one middleware corresponds to one code template class, and multiple middlewares correspond to multiple code template classes; The architecture of the service system also includes that different interfaces include different middleware; Based on the custom annotations of the development platform under the architecture of the service system, add annotations to the interface, configure the middleware code template class required by the interface in the annotation, and generate an interface configuration code template class corresponding to the architecture of the service system; The code template class is configured according to the generated interface, corresponding to the mapping of the conversion rules from the interface to the middleware class.

[0013] Furthermore, the steps of customizing the code template annotation processor class include: According to the generated interface configuration code template class, the conversion rule from the interface to the middleware class is mapped, and the parameters of the parameterized interface and the information of the associated interface are passed as input data to the code template class; The code template class is configured according to the generated interface, and the annotation processor class of the development platform is developed based on the architecture of the service system. The configuration of the code template class is completed by custom annotations, including returning the class name, class attributes, class constructor and class method definition and specific implementation of the corresponding middleware class.

[0014] Furthermore, the step of calling the annotation processor class to generate the middleware class includes: Configure the code template class according to the generated interface, develop the annotation processor class of the platform based on the architecture of the service system, complete the configuration of the code template class with custom annotations, and call the annotation processor class; According to the calling annotation processor class, the custom annotation processor class, the interface class, the code template class, and the custom annotation class are passed for compilation; After the compilation is completed, the middleware class is generated.

[0015] According to three aspects of the present invention, there is provided a middleware class generation device, the middleware class generation device comprising: The modules divided by the service system architecture are used to determine the middleware business and the calling relationship between the middleware and service layer; The module for defining the service layer interface is used to define the services and the functions they provide; A module for determining the conversion rules from interface to middleware class, used to generate middleware class according to the interface and the information of associated interfaces; A module for mapping the conversion rules to a code template class, used for mapping the conversion rule information from the interface to the middleware class; A module for interface configuration code template class, used to generate interface configuration code template class corresponding to the architecture of the service system; A module for customizing the code template annotation processor class, which is used to develop the annotation processor class of the platform based on the architecture of the service system, and to complete the configuration of the code template class with custom annotations; The module for calling the annotation processor class to generate the middleware class is used to pass the custom annotation processor class, interface class, code template class, and custom annotation class according to the calling annotation processor class, compile, and generate the middleware class according to the completion of the compilation.

[0016] According to four aspects of the present invention, there is provided an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; A computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the middleware class generation method.

[0017] According to five aspects of the present invention, there is provided a computer-readable storage medium, comprising: a computer program executable by an electronic device is stored therein, and when the computer program runs on the electronic device, the electronic device executes the steps of the middleware class generation method.

[0018] According to six aspects of the present invention, a development platform is provided, including: An electronic device, used to implement the steps of the middleware class generation method; A processor, the processor runs a program, and when the program runs, the steps of the middleware class generation method are executed from the data output by the electronic device; The storage medium is used to store a program, and when the program is running, the steps of the middleware class generation method are executed for the data output from the electronic device.

[0019] Through the above scheme, the following beneficial technical effects are obtained: This application simplifies the development process, improves development efficiency and ensures the consistency and correctness of coding by defining services as interfaces, providing matching reference data, and quickly and automatically compiling in batches to generate middleware classes.

[0020] This application uses the annotation processor class of the development platform (such as JAVA) and custom annotations (or annotations) to complete the configuration of the code template class, calls the annotation processor class to automatically generate the middleware class, and uses different configurations to meet the middleware class generation schemes of different interfaces, shortening the development time, reducing development costs, and improving code robustness.

[0021] This application ensures that the automatically generated code is accurate, reliable and versatile by mapping the conversion rules from the interface to the middleware class in the configuration code template class. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a structural diagram of a multi-module service system provided by one or more embodiments of the present invention.

[0023] Figure 2 It is a flowchart of a method for generating a middleware class provided by one or more embodiments of the present invention.

[0024] Figure 3 It is a structural diagram of a middleware class generating device provided by one or more embodiments of the present invention.

[0025] Figure 4 A schematic diagram of a multi-module service program system architecture according to a specific embodiment of the present invention.

[0026] Figure 5 A structural block diagram of an electronic device according to a method for generating a middleware class provided by one or more embodiments of the present invention. DETAILED DESCRIPTION

[0027] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only 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.

[0028] Figure 1 It is a structural diagram of a multi-module service system provided by one or more embodiments of the present invention.

[0029] like Figure 1 The multi-module service system shown includes: a service layer, a middleware; The service layer and middleware build a multi-module service system; Among them, modules are called layer by layer to realize preset service functions; The calls include middleware calling the service layer and middleware calling middleware; Among them, based on the preset service functions, the business logic is generated; Divide the service layer and middleware based on business logic, and determine the middleware business, the calling relationship between the middleware and the service layer; Among them, the service layer serves the preset service functions and is used to implement the specific business logic of the functions; Middleware, serving preset service functions, is used to provide common business logic; Also includes,service layer interface; Among them, the service layer interface is used to generate middleware classes.

[0030] Specifically, the service functions of the multi-module service system are implemented by calling multiple modules layer by layer, including the architecture of a service layer plus multiple middlewares. The service layer is used to implement the specific business logic of the function, and the middleware is used to provide common business logic for the service.

[0031] In a multi-module service system, service functions are jointly completed by the service layer and multiple middlewares. There is a hierarchical calling relationship between the functions in the service layer and the middleware, that is, there is at least one middleware calling the service layer function, and there will be an indefinite number of middlewares calling each other in a hierarchical manner.

[0032] To meet the calling relationship and business logic, there is an interface relationship between the service layer and the middleware. The service layer can be used as a reference to form a service layer interface, and the middleware class is generated corresponding to the service layer interface. The generation of the middleware class has no direct relationship with the middleware's call to the service layer. The generation of the middleware class is done before the program runs, which is equivalent to the work in the code writing stage.

[0033] The service layer interface is an abstraction of preset services and is used to generate middleware classes.

[0034] Figure 2 It is a flowchart of a method for generating a middleware class provided by one or more embodiments of the present invention.

[0035] like Figure 2 The middleware class generation method shown is based on a multi-module service system, and the middleware class generation method includes: S1, step of dividing the service system architecture; S2, step of defining the service layer interface; S3, step of determining the interface to middleware class conversion rules; S4, step of mapping the conversion rules to the code template class; S5, step of configuring the code template class for the interface; S6, step of customizing the code template annotation processor class; S7, step of calling the annotation processor class to generate the middleware class.

[0036] Specifically, in addition to manually programming the calls between the middleware and service layers, with the help of the service layer interface definition, you can also automatically edit and generate middleware classes to implement calls to each module.

[0037] In this embodiment, taking the JAVA platform as an example, with the help of a series of tool classes provided by java APT, the generation of automated middleware classes is formed. First, the calling relationship between the middleware and the service layer is determined. Under the JAVA platform, the interface of the service layer includes the interface name and the interface method definition; the method definition includes the method name, method return value, method parameter type, method parameter name, etc. For the middleware class, according to the actual business of the middleware, the conversion rules from the interface to the middleware class are found, including the class name, class attributes, class constructor, class method definition and implementation, and finally the middleware class is automatically generated through the interface. After finding the conversion rules from the interface to the middleware class, the code template class that uses the interface as an input parameter and generates different middleware classes according to different interface parameters is implemented. The code template class is used to provide a series of functions for obtaining information from the interface and returning the class name, attributes, constructor, and method implementation for building the middleware class for subsequent code template class processor class calls. Taking the JAVA platform as an example, with the help of a series of tool classes provided by java APT, such as Element, VariableElement, etc., the mapping of conversion rules to code template classes is completed.

[0038] In one embodiment, the interfaces in a system may have different middleware architectures. For example, for the student service interface, a three-layer architecture of service layer, encryption middleware and log middleware is adopted; for another course service interface, a four-layer architecture of service layer, data storage middleware and network access middleware and another log middleware is adopted. In order to meet such requirements, a code template configuration method for the interface is adopted. Once the middleware code template is written, it can be reused through configuration. Taking the JAVA platform as an example, the code template class for the interface can be configured through Java's custom annotations.

[0039] In the process of "mapping conversion rules to code template classes", the interface is passed as a parameter to the code template class, and the configuration of the code template class is completed using java custom annotations in "configuring code template classes for interfaces". Taking the JAVA platform as an example, the annotation processor AbstractProcessor tool class provided by java APT technology is used to process custom annotations, which is used to obtain the code template class information configured in the custom annotations, and at the same time, the interface with the custom annotations is parameterized, passed and processed into the code template class.

[0040] After completing the definition of the code template processor class, call the annotation processor class to generate the middleware class. Taking the JAVA platform as an example, by calling the javac command to start the compilation, passing the custom annotation processor class, interface class, code template class, and custom annotation class to the javac compiler, and waiting for the compilation to end, the middleware class can be generated.

[0041] In this embodiment, the steps of dividing the service system architecture include: Obtain the preset service function to be implemented; Corresponding to the preset service functions to be implemented, obtain business logic information; Business logic information includes the division of service layer and middleware; The business logic information also includes determining the middleware business based on the division of the service layer and the middleware, and determining the calling relationship between the middleware and the service layer.

[0042] Specifically, the service functions to be implemented are divided into a service layer and one or more middleware according to business logic, the business of each middleware is determined, and the calling relationship between the middleware and the service layer is determined.

[0043] After confirming the calling relationship between each middleware business and the middleware and service layers, program editing is carried out.

[0044] In this embodiment, the steps of service layer interface definition include: The preset service functions to be implemented include multiple services; Divide multiple services according to preset dimensions; Among them, the services and the functions they provide are defined; Defining the service and the functions provided by the service includes defining the service as an interface and defining the functions provided by the service as interface methods; Define the service as an interface, including the corresponding interface definition interface name; The functions provided by the service are defined as interface methods, including the method name, method return value, method parameter type and method parameter name.

[0045] Specifically, in one embodiment, the preset service function includes multiple services, and the corresponding service provides a method in a defined interface. The function definition provided by the service is a method in an interface, including defining a method name, a method return value, a method parameter type, and a method parameter name.

[0046] By defining the method name, method return value, method parameter type and method parameter name, a matching middleware class is required to complete the calling relationship.

[0047] Interface methods are equivalent to a collection of methods that define methods in an interface. The method name, method return value, method parameter type, and method parameter name are equivalent to a relatively fixed data information format.

[0048] In one embodiment, the service and the functions provided by the service are defined as interfaces and method definitions in Java. In the JAVA platform, the interface includes the interface name and interface method definition; the method definition includes the method name, method return value, method parameter type, and method parameter name.

[0049] In this embodiment, the step of determining the interface to middleware class conversion rule includes: According to the middleware business and the calling relationship between the middleware and the service layer, obtain the conversion rule information from the interface to the middleware class; The conversion rule information includes the definition and specific implementation of the class name, class attributes, class constructor, and class method from the interface and interface method to the middleware class; Wherein, the middleware class and the information of the middleware class are generated according to the interface and the information of the associated interface.

[0050] Specifically, the class in this embodiment corresponds to the class in Java. For the middleware class, it is necessary to find the conversion rules from the interface to the middleware class according to the actual business of the middleware, including the class name, class attributes, class constructor, class method definition and implementation, so that the middleware class can be automatically generated through the interface.

[0051] In this embodiment, the step of mapping the conversion rule to a code template class includes: According to the conversion rule information from the interface to the middleware class, parameterize the interface and the information of the associated interface; Generate information of the middleware class according to the parameterized interface and the associated interface information, including information of the code template class for generating the middleware class; Among them, based on the call, according to the information of the code template class, the class name, class attributes, class constructor and definition and implementation information of the class method of the corresponding middleware class are returned, and the conversion rule information from the interface to the middleware class is mapped.

[0052] Specifically, in this embodiment, after finding the conversion rules from interface to middleware class, it is necessary to implement a code template class that uses the interface as an input parameter and generates different middleware classes according to different interface parameters. The code template class is used to provide a series of functions for obtaining information from the interface and returning the class name, properties, constructor, and method implementation for building the middleware class for subsequent code template class processor class calls.

[0053] The conversion rule information includes the definition and specific implementation of the class name, class attributes, class constructor, and class method from the interface and interface method to the middleware class.

[0054] For example, under the JAVA platform, with the help of a series of tool classes provided by java APT, such as Element, VariableElement, etc., the mapping of conversion rules to code template classes is completed.

[0055] In this embodiment, the steps of configuring a code template class for an interface include: The architecture of the service system includes an architecture based on multiple middleware corresponding to one interface; The architecture of the service system includes an architecture based on multiple interfaces corresponding to one middleware; The architecture of the service system also includes that one middleware corresponds to one code template class, and multiple middlewares correspond to multiple code template classes; The architecture of the service system also includes different middlewares including different interfaces; Based on the custom annotations of the development platform under the service system architecture, the interface configuration code template class is generated corresponding to the service system architecture; Configure the code template class according to the generated interface, corresponding to the mapping of conversion rules from the interface to the middleware class.

[0056] Specifically, in one embodiment, the interfaces in a service system may have different middleware architectures. For example, for the student service interface, a three-layer architecture of service layer, encryption middleware and log middleware is adopted; for another course service interface, a four-layer architecture of service layer, data storage middleware and network access middleware and another log middleware is adopted. In order to match such requirements, a code template is configured for the interface. Once the middleware code template is written, it can be reused through configuration.

[0057] For example, under the JAVA platform, you can use Java custom annotations to configure the code template class for the interface.

[0058] The architecture of the service system has various forms, such as an architecture based on one interface corresponding to multiple middlewares; the architecture of the service system also includes one middleware corresponding to one code template class, and multiple middlewares corresponding to multiple code template classes; the architecture of the service system also includes different interfaces including different middlewares.

[0059] Based on the custom annotations of the development platform under the architecture of the service system, annotations are added to the interface, and the middleware code template class required by the interface is configured in the annotation. Corresponding to the architecture of the service system, an interface configuration code template class is generated. Here, annotation information is actually added to the interface. Annotation can be understood as adding some information to the interface to record which middleware code templates need to be added to a certain interface. A custom annotation is generated with formatted information, which is equivalent to identifying the file information in a fixed format added to the interface.

[0060] The code template class is configured according to the generated interface, corresponding to the mapping of the conversion rules from the interface to the middleware class.

[0061] Adding a code template class to an interface corresponds to: determining the type and number of middleware classes that need to be generated for an interface.

[0062] The above "configure" is a verb, which means to add. It mainly inherits the above-mentioned generated code template class and uses the generated code template class.

[0063] In this embodiment, the steps of customizing the code template annotation processor class include: Configure the code template class according to the generated interface, map the conversion rules from the interface to the middleware class, and pass the parameters of the parameterized interface and the information of the associated interface as input data to the code template class; Configure the code template class according to the generated interface, develop the annotation processor class of the platform based on the service system architecture, and complete the configuration of the code template class with custom annotations, including returning the class name, class attributes, class constructor, and class method definition and specific implementation of the corresponding middleware class.

[0064] Specifically, in "Map conversion rules to code template class", pass the interface as a parameter to the code template class, and use Java custom annotations in "Configure code template class for interface" to complete the code template class configuration.

[0065] For example, under the JAVA platform, the annotation processor AbstractProcessor tool class provided by the java APT technology processes custom annotations, obtains the code template class information configured in the custom annotations, and parameterizes the interface with the custom annotations, and passes and processes the code template class.

[0066] In this embodiment, the steps of calling the annotation processor class to generate the middleware class include: Configure the code template class according to the generated interface, develop the annotation processor class of the platform based on the architecture of the service system, complete the configuration of the code template class with custom annotations, and call the annotation processor class; According to the calling annotation processor class, the custom annotation processor class, interface class, code template class, and custom annotation class are passed for compilation; After the compilation is completed, the middleware class is generated.

[0067] Specifically, after the code template processor class definition is completed, the annotation processor class needs to be called to generate the middleware class. For example, under the JAVA platform, when calling the javac command to start the compilation, the custom annotation processor class, interface class, code template class, and custom annotation class are passed to the javac compiler, and the middleware class can be generated after the compilation is completed.

[0068] Figure 3 It is a structural diagram of a middleware class generating device provided by one or more embodiments of the present invention.

[0069] like Figure 3 The middleware class generation device shown includes: a module for dividing the service system architecture, a module for defining the service layer interface, a module for determining the interface to middleware class conversion rules, a module for mapping the conversion rules to code template classes, a module for configuring code template classes for interfaces, a module for customizing code template annotation processor classes, and a module for calling annotation processor classes to generate middleware classes; The modules divided by the service system architecture are used to determine the middleware business and the calling relationship between the middleware and service layer; The module for defining the service layer interface is used to define the services and the functions they provide; A module for determining the conversion rules from interface to middleware class, used to generate middleware class according to the interface and the information of associated interfaces; A module that maps conversion rules to code template classes, used to map conversion rule information from interfaces to middleware classes; The module of interface configuration code template class is used to generate interface configuration code template class corresponding to the architecture of service system; The module of custom code template annotation processor class is used to develop annotation processor class of platform based on service system architecture, and customize annotation to complete the configuration of code template class; The module that calls the annotation processor class to generate the middleware class is used to pass the custom annotation processor class, interface class, code template class, and custom annotation class according to the calling annotation processor class, compile, and generate the middleware class according to the completion of the compilation.

[0070] In this embodiment, the module of the interface configuration code template class is used to generate the interface configuration code template class corresponding to the architecture of the service system, which means adding some content to the original interface, which can also be understood as generating a new class.

[0071] It is worth noting that although the system only discloses the modules for dividing the service system architecture, the modules for defining the service layer interfaces, the modules for determining the conversion rules from interfaces to middleware classes, the modules for mapping the conversion rules to code template classes, the modules for configuring code template classes for interfaces, the modules for customizing code template annotation processor classes, and the modules for calling annotation processor classes to generate middleware classes, it does not mean that the device is limited to the above-mentioned basic functional modules. On the contrary, what the present invention wants to express is that, on the basis of the above-mentioned basic functional modules, those skilled in the art can arbitrarily add one or more functional modules in combination with the prior art to form an infinite number of embodiments or technical solutions. That is to say, the system is open rather than closed. Just because the present embodiment only discloses individual basic functional modules, it cannot be considered that the scope of protection of the claims of the present invention is limited to the above-mentioned basic functional modules.

[0072] Through the above scheme, the following beneficial technical effects are obtained: This application simplifies the development process, improves development efficiency and ensures the consistency and correctness of coding by defining services as interfaces, providing matching reference data, and quickly and automatically compiling in batches to generate middleware classes.

[0073] This application uses the annotation processor class of the development platform (such as JAVA) and custom annotations (or annotations) to complete the configuration of the code template class, calls the annotation processor class to automatically generate the middleware class, and uses different configurations to meet the middleware class generation schemes of different interfaces, shortening the development time, reducing development costs, and improving code robustness.

[0074] This application ensures that the automatically generated code is accurate, reliable and versatile by mapping the conversion rules from the interface to the middleware class in the configuration code template class.

[0075] Figure 4 A schematic diagram of a multi-module service program system architecture according to a specific embodiment of the present invention.

[0076] In a specific embodiment, a multi-module service program system is based on the JAVA development platform as the technical background. The middleware and service layer are embodied as a module of the java program under the JAVA development platform, and the middleware and service layer constitute a complete java program; the service class and the middleware class are embodied as java classes, and the functions are embodied as methods in java.

[0077] In this system, the service layer implements differentiated business logic of functions, and the business logic varies with different functions. For example, the registration function needs to complete registration matters, and the login function needs to complete login matters. The specific tasks of registration and login are different.

[0078] The common business logic of the middleware to implement the functions. For the same middleware, all functions have the same business logic, and different middlewares have different business logics. For example, for a service system with registration and login functions, the registration function needs to encrypt the input parameters first, then store the input parameters in the log, and finally complete the registration matters; the login function business needs to encrypt the input parameters first, then store the parameters in the log, and finally complete the login matters. Define "registration matters" and "login matters" as the service layer of the system, define "encrypting input parameters" as the encryption layer middleware, and define "storing parameters in the log" as the log middleware. For all functions in the encryption middleware, the business logic that needs to be completed can be defined as "encrypting parameters and then calling the log middleware"; for all functions in the log middleware, the business logic that needs to be completed can be defined as "storing parameters in the log and then calling the service layer method". This means that for the same middleware, all functions need to execute the same business logic, but different middlewares have different business logics.

[0079] The interface described in this embodiment corresponds to a Java interface in the prior art. An interface is a collection of function definitions, which are represented by method definitions in Java. In this embodiment, a service is an interface, and a function definition is a method definition in the interface.

[0080] The class described in this embodiment corresponds to a Java class in the prior art. A class is a collection of a series of function definitions and implementations. The definition and implementation of a function is reflected in Java as the definition and implementation of a method.

[0081] In this embodiment, Figure 4 In the multi-module service program system architecture shown, middleware 1 to middleware n represent multiple middlewares, classes 1.1 (middleware class) to class 1.N represent multiple classes included in middleware 1, and function 1.N.1 corresponds to a function of class 1.1, and the same applies to the others.

[0082] From the middleware to the service layer, one or more layers of calling relationships can form the components of the system architecture. Among them, the calling direction is not unique and depends on the editing of the logical function.

[0083] All functions in the same middleware can have the same business logic, the difference lies in the different functions and parameters of the next layer called.

[0084] In this embodiment, the middleware class automatic generation of the multi-module service program system architecture is realized, which mainly includes the following steps: 1. Service system architecture division: The functions to be implemented will be divided into a service layer and one or more middleware according to business logic, and the business of each middleware and the calling relationship between the middleware and service layer will be determined.

[0085] 2. Service layer interface definition: The service system can provide multiple functions to the outside world. The functions provided by the service system are divided into multiple services according to certain dimensions. The services and the functions provided by the services are defined as interfaces and method definitions in Java. In existing Java technology, the interface includes the interface name and interface method definition; the method definition includes the method name, method return value, method parameter type, and method parameter name.

[0086] 3. Determine the conversion rules from interface to middleware class: The class here corresponds to the class in Java. For the middleware class, it is necessary to find the conversion rules from interface to middleware class according to the actual business of the middleware, including class name, class attributes, class constructor, class method definition and implementation, and finally realize the automatic generation of middleware class through interface.

[0087] 4. Mapping the conversion rules to code template classes: After finding the conversion rules from the interface to the middleware class, it is necessary to implement the code template classes that use the interface as an input parameter and generate different middleware classes according to different interface parameters. The code template class is used to provide a series of functions for obtaining information from the interface and returning the class name, attributes, constructors, and methods used to build the middleware class for subsequent code template class processor class calls. In the prior art, a series of tool classes provided by java APT, such as Element, VariableElement, etc., can be used to complete the mapping of conversion rules to code template classes.

[0088] 5. Configure code template classes for interfaces: In some scenarios, interfaces in a service system may have different middleware architectures. For example, for student service interfaces, a three-layer architecture of service layer, encryption middleware, and log middleware is adopted; and for other course service interfaces, a four-layer architecture of service layer, data storage middleware, network access middleware, and another log middleware is adopted. In order to meet such requirements, the method of configuring code templates for interfaces is adopted. Once the middleware code template is written, it can be reused through configuration. In the prior art, custom annotations in Java can be used to complete the configuration of code template classes for interfaces.

[0089] 6. Custom code template annotation processor class: In "Map conversion rules to code template class", the interface needs to be passed as a parameter to the code template class, and the code template class configuration is completed using java custom annotations in "Configure code template class for interface". In the prior art, the annotation processor AbstractProcessor tool class provided by java APT technology processes custom annotations, which is used to obtain the code template class information configured in the custom annotation, and parameterizes the interface with the custom annotation, and passes and processes the code template class.

[0090] 7. Call the annotation processor class to generate the middleware class: After completing the definition of the code template processor class, you need to call the annotation processor class for the generation of the middleware class. In the prior art, by calling the javac command to start the compilation, passing the custom annotation processor class, interface class, code template class, and custom annotation class to the javac compiler, and waiting for the compilation to end, the middleware class can be generated.

[0091] In another specific embodiment, a development requirement is obtained: to develop an educational system, which provides a student service. The service provides registration and login functions. All functions include the following services: 1. When a function is called, the function name, input parameter name and parameter value are printed in the log; 2. Encrypt input parameters using a specific algorithm; 3. Execute the specific business logic of the function and return the result.

[0092] Corresponding to the method in the above specific embodiment, the implementation steps in this embodiment include: Step 1: Service system architecture division. The system is divided into service layer, encryption middleware, and log middleware from bottom to top according to business logic. The business logic in the log middleware is to print logs and call the encryption middleware; the business logic of the encryption middleware is to encrypt parameters and call the service layer; the service layer is the specific implementation of the business.

[0093] Step 2: Service layer interface definition. Define the student service and the functions it provides as a java interface. The student service interface definition is as follows: public interface StudentService { void register(String id, String name); boolean login(String id); } An interface named StudentService is defined here; interface means that this is an interface; the content contained in {} is the interface body; void register(String id, String name) defines a method named register, where String id is the first parameter of the method, String is the parameter type, id is the parameter name, Stringname is the second parameter of the method, String is the parameter type, name is the parameter name, and void means that the method call has no return value; boolean login(String id) defines a method named login; String id is the first parameter of the method, String is the parameter type, id is the parameter name, and boolean means that the method call returns a boolean type value.

[0094] Step 3: Determine the interface to middleware class conversion rules. In the prior art, a class is a collection of a series of functional implementations. The class definition includes the class name, several attributes, several constructors, and several method definitions and implementations. The method includes the method name, method parameter type, method parameter name, and method return value.

[0095] For the encryption middleware business logic defined in step 1, convert the business into the student service encryption middleware class. The middleware class definition that needs to be implemented after automation is as follows: public class StudentServiceEncoder { public StudentService service; public StudentServiceEncoder() { service = new StudentService(); } public void register(String id, String name) { Encoder.encode(id, name); service.register(id, name); } public boolean login(String id) { Encoder.encode(id); return service.login(id); }} Here, a class named StudentServiceEncoder is defined; class indicates that this is a class; the content in the following {} is the class body; StudentService service defines a property of type StudentService and named service. The type StudentService is the StudentService interface defined in step 2; StudentServiceEncoder() and the content in the following {} define a constructor. The constructor must be the class name and cannot have a return value. The constructor is used to perform some initialization assignments on the class; service = newStudentService() is defined as the assignment of the service attribute. The = sign is the assignment operation. NewStudentService() generates an instance of the StudentService interface type; void register(String id, String name) and the content in {} define a method. void defines that the method has no return value. register is the method name, String id is the first parameter of the method, String is the parameter type, id is the parameter name, String name is the second parameter of the method, String is the parameter type, name is the parameter name, and the content in the following {} is the method body of the method. Encoder.encode(id, name) defines a static method call. In the prior art, a static call means calling a method directly through a class name, Encoder is the class name, encode is the name of the calling method, and id and name are the parameters of the calling method; service.register(id, name) defines an instance method call. An instance call means that a method must be called through an instance of a class. service is the instance name, i.e., the attribute defined above, register is the method name, and id and name are the parameters for calling this method; boolean login(String id) and the content in {} define a method. boolean means that the method returns a boolean type of data, login is the method name, String id is a parameter of the method, String indicates the parameter type, id is the parameter name, Encoder.encode(id) has the same meaning as above, returnservice.login(id) identifies that this is a method call and returns the call result, where return is the return result, service.login(id) is an instance call, service is the instance name, login is the method name, and id is the method parameter.

[0096] For the log middleware business logic defined in step 1, convert the business into the student service log middleware class. The middleware class definition that needs to be implemented after automation is as follows: public class StudentServiceLogger { public StudentServiceEncoder encoder; public StudentServiceLogger () { encoder = new StudentServiceEncoder (); } public void register(String id, String name) { Logger.log(id, name); encoder.register(id, name); } public boolean login(String id) { Logger.log(id); return encoder.login(id); } } Here, a class named StudentServiceLogger is defined; class indicates that this is a class; StudentServiceEncoder encoder defines a property named encoder of type StudentServiceEncoder. The StudentServiceEncoder type is the encryption middleware class; StudentServiceLogger() and the content in {} define a constructor. The constructor must be the class name and cannot have a return value. The constructor is used to perform some initialization assignments on the class; encoder = newStudentServiceEncoder() is defined as encoder property assignment. The = sign is the assignment operation. New StudentServiceEncoder() generates an instance of the StudentServiceEncoder class; void register(String id, String name) and the content in {} define a method. Void defines that the method has no return value. Register is the method name, Stringid is the first parameter of the method, String is the parameter type, id is the parameter name, String name is the second parameter of the method, String is the parameter type, name is the parameter name, and the content in {} is the method body of the method. Logger.log(id, name) defines a static method call. In the prior art, a static call means calling a method directly through a class name. Logger is the class name, log is the name of the calling method, and id and name are the parameters of the calling method. encoder.register(id, name) defines an instance method call. An instance call means that a method must be called through an instance of a class. encoder is the instance name, i.e., the attribute defined above. register is the method name. id and name are the parameters for calling this method. booleanlogin(String id) and the content in {} define a method. boolean indicates that the method returns a boolean type of data. login is the method name. String id is a parameter of the method. String indicates the parameter type. id is the parameter name. Logger.log(id) has the same meaning as above. return encoder.login(id) identifies that this is a method call and returns the call result. return is the return result. encoder.login(id) is an instance call. encoder is the instance name, login is the method name, and id is the method parameter.

[0097] To automatically generate middleware classes for different interfaces with the same service architecture, it is necessary to determine the common conversion relationships between the different interfaces as input and the various parts in the middleware class.

[0098] For encryption middleware, taking the StudentServiceEncoder class as an example, we can summarize the conversion rules from different interfaces to encryption middleware classes: for the encryption middleware class name, use the interface class name to concatenate Encoder; for the attributes in the encryption middleware, the type is the interface type, and the attribute name is service; for the encryption middleware constructor, the service attribute needs to be instantiated; for the methods in the encryption middleware, the method name, method return value, number of method parameters, method parameter type, method parameter name and the method in the interface are consistent; for the method body, the first line is Encoder.encode plus the parameter name; the second line calls the corresponding method in the interface, and if there is a return value, add return.

[0099] For the log middleware, taking the StudentServiceLogger class as an example, we can summarize the conversion rules from different interfaces to the log middleware class: for the log middleware class name, use the interface name to concatenate Logger; for the attributes in the log middleware, the type is the encryption middleware type, and the attribute name is encoder; for the log middleware constructor, complete the instantiation of the encoder attribute; for the methods in the log middleware, the method name, method return value, number of method parameters, method parameter type, method parameter name and the method in the interface are consistent; for the method body, the first line is Logger.log plus the parameter name; the second line calls the corresponding method in the encryption middleware, and if there is a return value, add return.

[0100] For the above conversion relationship between encryption middleware and log middleware, the above conversion can be implemented for all interfaces that meet the three-layer architecture in step one.

[0101] Step 4: Map the conversion rules to code template classes. In the prior art, the functions provided by the Java APT (Annotation Processing Tool) can be used to implement the mapping from rules to code template classes. Use TypeElement to obtain interface information, including interface name, interface type and other information; use ExecutableElement to obtain method information in the interface, including method name, method return value, method parameter type, method parameter name and other information. Take the obtained interface and method information as parameters, combine with the conversion rules in step 3, and use specific Java syntax to generate a code template class for obtaining the middleware class name, attribute type, attribute name, constructor, constructor body, method name, method return value, method parameter type, method parameter name, and method body. For the encryption middleware, the code template class EncoderTemplate that meets the interface to encryption middleware class conversion rules is output with TypeElement and ExecutableElement containing interface information as input; for the logging middleware, the code template class LoggerTemplate that meets the interface to logging middleware class conversion rules is output with TypeElement and ExecutableElement containing interface information as input.

[0102] Step 5: Configure the code template class for the interface. In the prior art, you can use the custom annotation function provided by Java to add annotations to the interface to complete the code template configuration. In the prior art, the annotation includes the annotation body, meta-annotation, and annotation attributes. Among these three main components: the annotation body specifies the name of the annotation, the meta-annotation marks the usage information of the annotation, and the annotation attribute indicates the attribute of the annotation. In the specific practice process, the custom annotation first defines the annotation-related attributes of the annotation; such as: @Retention(RententionPolicy.CLASS) @Target(ElementType.TYPE) public @interface Config{ String[] templates(); } Here, an annotation named Config is defined; String[]templates() is the attribute of the annotation, templates is the attribute name, and String[] indicates that this attribute is a string array type; @Retention indicates when to use the annotation, and the content in the brackets indicates that this annotation only exists during Java compilation; @Target indicates where the annotation is used, and the content in the brackets indicates that it is used for interfaces or classes. After the annotation is defined, the annotation is used. The use of the annotation includes adding the annotated interface and assigning values ​​to the annotation attributes. Add the Config annotation to the StudentService interface in step 2: @Config(templates = {"Encoder", "Logger"}) public interface StudentService { void register(String id, String name); boolean login(String id); } @Config indicates adding an annotation named Config to the StudentService interface. The content in brackets indicates the assignment of the templates attribute in the Config annotation. The value is a string array consisting of Encoder and Logger. Encoder is used to find the EncoderTemplate class defined in step 4 in the annotation processor class defined in step 6. Logger is used to find the LoggerTemplate class defined in step 4 in the annotation processor class defined in step 6.

[0103] Step 6: Customize the code template annotation processor class. In the prior art, the AbstractProcessor tool class provided by java APT can be used to customize a class that inherits from AbstractProcessor to process custom annotations and interfaces that use custom annotations. The AbstractProcessor tool class provides methods for obtaining custom annotation attribute values; the AbstractProcessor tool also provides methods for obtaining interfaces that use custom annotations, converting interfaces to TypeElement, and converting methods in interfaces to ExecutableElement. In this implementation, the templates attribute values ​​Encoder and Logger in the custom annotation Config are obtained by customizing the AbstractProcessor tool, and the corresponding template classes EncoderTemplate and LoggerTemplate are found through these two attribute values; the StudentService interface that uses the custom annotation Config is obtained, and the StudentService interface is converted to the TypeElement in step four, and each method in the StudentService is converted to a corresponding ExecutableElement, which is passed as a parameter to the code template class EncoderTemplate and the code template class LoggerTemplate.

[0104] Step 7: Call the annotation processor class to generate the middleware class. In the existing java APT technology, by calling the javac compiler and passing the file address corresponding to the custom AbstractProcessor class, the file address corresponding to the interface, the file address corresponding to the code template class, and the file address corresponding to the custom annotation to the javac compiler, the code template processor can be called and the relevant middleware class files can be generated.

[0105] Figure 5 A structural block diagram of an electronic device according to a method for generating a middleware class provided by one or more embodiments of the present invention.

[0106] like Figure 5 As shown, the present application provides an electronic device, including: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; A computer program is stored in the memory. When the computer program is executed by the processor, the processor executes the steps of a middleware class generation method.

[0107] The present application also provides a computer-readable storage medium storing a computer program executable by an electronic device. When the computer program runs on the electronic device, the electronic device executes the steps of a middleware class generation method.

[0108] This application also provides a development platform, including: Electronic device, steps for middleware class generation method; A processor, the processor runs a program, and when the program runs, the steps of the middleware class generation method are executed from the data output by the electronic device; The storage medium is used to store a program, and when the program is running, the program executes the steps of the middleware class generation method for the data output from the electronic device.

[0109] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0110] The electronic device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory. The operating system can be any one or more computer operating systems that implement electronic device control through a process, such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a Windows operating system. In addition, in an embodiment of the present invention, the electronic device can be a handheld device such as a smart phone or a tablet computer, or can be an electronic device such as a desktop computer or a portable computer, which is not particularly limited in the embodiment of the present invention.

[0111] The execution subject of the electronic device control in the embodiment of the present invention may be an electronic device, or a functional module in the electronic device that can call and execute a program. The electronic device may obtain the firmware corresponding to the storage medium. The firmware corresponding to the storage medium is provided by the supplier. The firmware corresponding to different storage media may be the same or different, which is not limited here. After the electronic device obtains the firmware corresponding to the storage medium, the firmware corresponding to the storage medium may be written into the storage medium, specifically, the firmware corresponding to the storage medium may be burned into the storage medium. The process of burning the firmware into the storage medium may be implemented using existing technology, which will not be described in detail in the embodiment of the present invention.

[0112] The electronic device may also obtain a reset command corresponding to the storage medium. The reset command corresponding to the storage medium is provided by the supplier. The reset commands corresponding to different storage media may be the same or different, and are not limited here.

[0113] At this time, the storage medium of the electronic device is a storage medium in which the corresponding firmware is written, and the electronic device can respond to the reset command corresponding to the storage medium in the storage medium in which the corresponding firmware is written, so that the electronic device resets the storage medium in which the corresponding firmware is written according to the reset command corresponding to the storage medium. The process of resetting the storage medium according to the reset command can be implemented by the existing technology and will not be described in detail in the embodiments of the present invention.

[0114] For the convenience of description, the above devices are described in terms of functions and are divided into various units and modules. Of course, when implementing the present application, the functions of each unit and module can be implemented in the same or multiple software and / or hardware.

[0115] Those skilled in the art will appreciate that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined.

[0116] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0117] It can be known from the description of the above implementation modes that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute the methods described in the various implementation modes of the present application or certain parts of the implementation modes.

[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A multi-module service system, characterized in that: The multi-module service system includes: a service layer and middleware; The service layer and the middleware construct a multi-module service system; Among them, modules are called layer by layer to realize preset service functions; The calling includes middleware calling the service layer and middleware calling middleware; wherein, based on the preset service function, generating business logic; Divide the service layer and the middleware based on the business logic, and determine the middleware business, the calling relationship between the middleware and the service layer; The service layer serves the preset service functions and is used to implement the specific business logic of the functions; The middleware serves the preset service functions and is used to provide common business logic; Also includes,service layer interface; Wherein, the service layer interface is used to generate a middleware class.

2. A method for generating a middleware class, characterized in that: Based on the multi-module service system of claim 1, the middleware class generation method comprises: Steps for dividing the service system architecture; steps for defining the service layer interface; steps for determining the interface to middleware class conversion rules; steps for mapping the conversion rules to code template classes; steps for configuring code template classes for interfaces; steps for customizing code template annotation processor classes; steps for calling annotation processor classes to generate middleware classes.

3. The middleware class generation method according to claim 2, characterized in that: The steps of dividing the service system architecture include: Obtain the preset service functions to be implemented; Corresponding to the preset service function to be implemented, obtaining business logic information; The business logic information includes dividing the service layer and the middleware; The business logic information also includes determining the middleware business based on the division of the service layer and the middleware, and determining the calling relationship between the middleware and the service layer.

4. The method for generating a middleware class according to claim 3, characterized in that: The steps of defining the service layer interface include: The preset service function to be implemented includes multiple services; Dividing the multiple services according to preset dimensions; Among them, the services and the functions they provide are defined; Defining the service and the functions provided by the service includes defining the service as an interface and defining the functions provided by the service as interface methods; Defining the service as an interface includes defining an interface name corresponding to the interface; The function provided by the service is defined as an interface method, including defining a method name, a method return value, a method parameter type and a method parameter name.

5. The middleware class generation method according to claim 4, characterized in that: The step of determining the interface to middleware class conversion rule comprises: According to the middleware business and the calling relationship between the middleware and the service layer, obtaining conversion rule information from the interface to the middleware class; The conversion rule information includes the definition and specific implementation of the class name, class attributes, class constructor and class method; Wherein, the middleware class and the information of the middleware class are generated according to the interface and the information of the associated interface.

6. The method for generating a middleware class according to claim 5, characterized in that: The step of mapping the conversion rules into code template classes comprises: According to the conversion rule information from the interface to the middleware class, parameterize the interface and the information of the associated interface; Generate information of the middleware class according to the parameterized interface and the associated interface information, including information of the code template class for generating the middleware class; Wherein, based on the call, according to the information of the code template class, the class name, class attributes, class constructor and definition and implementation information of the class method of the corresponding middleware class are returned, and the conversion rule information from the interface to the middleware class is mapped.

7. The method for generating a middleware class according to claim 6, characterized in that: The steps of configuring the code template class for the interface include: The architecture of the service system includes an architecture based on which one interface corresponds to multiple middlewares; The architecture of the service system includes: one middleware corresponds to one code template class, and multiple middlewares correspond to multiple code template classes; The architecture of the service system includes that different interfaces may contain different middleware; Based on the custom annotations of the development platform under the architecture of the service system, add annotations to the interface, configure the middleware code template class required by the interface in the annotation, and generate an interface configuration code template class corresponding to the architecture of the service system; The code template class is configured according to the generated interface, corresponding to the mapping of the conversion rules from the interface to the middleware class.

8. The middleware class generation method according to claim 7, characterized in that: The steps of customizing the code template annotation processor class include: According to the generated interface configuration code template class, the conversion rule from the interface to the middleware class is mapped, and the parameters of the parameterized interface and the information of the associated interface are passed as input data to the code template class; The code template class is configured according to the generated interface, and the annotation processor class of the development platform is developed based on the architecture of the service system. The configuration of the code template class is completed by custom annotations, including returning the class name, class attributes, class constructor and class method definition and specific implementation of the corresponding middleware class.

9. The method for generating a middleware class according to claim 8, characterized in that: The steps of calling the annotation processor class to generate the middleware class include: Configure the code template class according to the generated interface, develop the annotation processor class of the platform based on the architecture of the service system, complete the configuration of the code template class with custom annotations, and call the annotation processor class; According to the calling annotation processor class, the custom annotation processor class, the interface class, the code template class, and the custom annotation class are passed for compilation; After the compilation is completed, the middleware class is generated.

10. A middleware class generating device, characterized in that: The middleware class generating device comprises: The modules divided by the service system architecture are used to determine the middleware business and the calling relationship between the middleware and service layer; The module for defining the service layer interface is used to define the services and the functions they provide; A module for determining the conversion rules from interface to middleware class, used to generate middleware class according to the information of interface and associated interface; A module for mapping the conversion rules to a code template class, used for mapping the conversion rule information from the interface to the middleware class; A module for interface configuration code template class, used to generate interface configuration code template class corresponding to the architecture of the service system; A module for customizing the code template annotation processor class, which is used to develop the annotation processor class of the platform based on the architecture of the service system, and to complete the configuration of the code template class with custom annotations; The module for calling the annotation processor class to generate the middleware class is used to pass the custom annotation processor class, interface class, code template class, and custom annotation class according to the calling annotation processor class, compile, and generate the middleware class according to the completion of the compilation.

11. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; A computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the middleware class generation method according to any one of claims 2 to 9.

12. A computer-readable storage medium, characterized in that: include: It stores a computer program executable by an electronic device. When the computer program runs on the electronic device, the electronic device executes the steps of the middleware class generation method described in any one of claims 2 to 9.

13. A development platform, characterized in that: include: An electronic device, used to implement the steps of the middleware class generation method according to any one of claims 2 to 9; A processor, wherein the processor runs a program, and when the program runs, the data output from the electronic device executes the steps of the middleware class generation method according to any one of claims 2 to 9; A storage medium for storing a program, wherein when the program is running, the program executes the steps of the middleware class generation method according to any one of claims 2 to 9 for data output from an electronic device.