Method, device, equipment and system for generating Java code and medium

By adding the call relationship prompt words between modules in the Java code generation process, and combining the artificial intelligence model to generate interdependent Java code, the problem of the modules being unable to be called by each other after they are generated independently in the existing technology is solved, and the code quality and development efficiency are improved.

CN120179224APending Publication Date: 2025-06-20CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411775454.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

In the prior art, the Java code generated by the large model is independent and cannot be called directly from each other, resulting in low development quality and efficiency.

Method used

By sending the user a call relationship prompt word between modules, the user is guided to input demand and call relationship description information, and combining the artificial intelligence model to generate interdependent Java code.

Benefits of technology

The generated Java code is achieved more accurate and smooth, avoiding the process of manual secondary development by programmers, and improving code quality and development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179224A_ABST
    Figure CN120179224A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a method, device, equipment and system for generating Java codes and a medium. The method comprises the following steps: determining a target function module to be edited by a user, wherein the target function module is selected by the user from a preset function module set; sending a cue word corresponding to the target function module to a user, wherein the cue word comprises a demand cue word and an inter-module calling relation cue word; receiving description information returned by the user according to the cue word, wherein the description information comprises demand description and calling relation description between modules; obtaining a Java code from the artificial intelligence large model according to the demand description, and generating a calling code according to the calling relation description between the modules; and generating a Java code corresponding to the target function module according to the Java code and the calling code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of software development, and particularly to a method, device, equipment, system and medium for generating Java code. Background Art

[0002] With the continuous progress of artificial intelligence technology, more and more developers begin to use large-scale neural network models (abbreviation: large models) based on deep learning and artificial intelligence technology to generate Java code, so as to improve programming efficiency and code quality.

[0003] Currently, the large model can only generate independent Java code for each module. During the software development process, programmers need to manually perform secondary development on the Java code generated by the large model. The quality of the secondary developed Java code is greatly affected by the programming level of the programmers, and moreover, the efficiency of secondary development by programmers is relatively low. Summary of the Invention

[0004] Embodiments of the present application propose a method, device, equipment, system and medium for generating Java code to solve the problem of relatively low quality and efficiency in Java code development.

[0005] In a first aspect, an embodiment of the present application provides a method for generating Java code, the method comprising:

[0006] Determine a target function module to be edited by the user, where the target function module is selected by the user from a pre-set set of function modules;

[0007] Send a prompt word corresponding to the target function module to the user, where the prompt word includes: a requirement prompt word and a call relationship prompt word between modules;

[0008] Receive description information returned by the user according to the prompt word, where the description information includes: a requirement description and a call relationship description between modules;

[0009] Obtain Java code from an artificial intelligence large model according to the requirement description, and generate call code according to the call relationship description between modules;

[0010] Generate Java code corresponding to the target function module according to the Java code and the call code.

[0011] In a second aspect, an embodiment of the present application provides a device for generating Java code, the device comprising:

[0012] A determination module, configured to determine a target function module to be edited by the user, where the target function module is selected by the user from a pre-set set of function modules;

[0013] A sending module, configured to send a prompt word corresponding to the target function module to the user, where the prompt word includes: a requirement prompt word and a call relationship prompt word between modules;

[0014] A receiving module, configured to receive description information returned by the user according to the prompt word, where the description information includes: a requirement description and a call relationship description between modules;

[0015] A code generation module, configured to obtain Java code from an artificial intelligence large model according to the requirement description, and generate call code according to the call relationship description between modules;

[0016] An integration module, configured to generate Java code corresponding to the target function module according to the Java code and the call code.

[0017] In a third aspect, an embodiment of the present application provides a system for generating Java code, where the system includes:

[0018] A function module division module, configured to divide Java code into multiple function modules;

[0019] A prompt word module, configured to generate a corresponding prompt word for each of the function modules, where the prompt word includes: a requirement prompt word and a call relationship prompt word between modules;

[0020] A Java code generation module, configured to determine a target function module to be edited by the user, where the target function module is selected by the user from multiple function modules divided by the function module division module, send the prompt word corresponding to the target function module to the user, receive the description information returned by the user according to the prompt word, where the description information includes: a requirement description and a call relationship description between modules, obtain Java code from an artificial intelligence large model according to the requirement description, generate call code according to the call relationship description between modules, and generate Java code corresponding to the target function module according to the Java code and the call code.

[0021] In a fourth aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a storage device, on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method described in any embodiment of the first aspect.

[0022] In a fifth aspect, an embodiment of the present application provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any embodiment of the first aspect is implemented.

[0023] The method, apparatus, device, system, and medium for generating Java code provided by the embodiments of the present application add a prompt word for the call relationship between modules, and guide the generation of mutually dependent Java code through the prompt word for the call relationship between modules, avoiding the problem in the prior art that Java code generated independently by each module cannot be directly called by each other; since each functional module has a corresponding prompt word for the call relationship between modules, the technical solution provided by the embodiments of the present application can handle complex Java code generation requirements; due to the addition of the prompt word for the call relationship between modules, the generated Java code is more accurate and fluent, avoiding the problem in the prior art that during the software development process, programmers need to manually perform secondary development on the Java code generated by the large model, and the quality of the secondary-developed Java code is greatly affected by the programming level of the programmers, and moreover, the efficiency of secondary development by programmers is relatively low. Description of the Drawings

[0024] By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, objects, and advantages of the present application will become more apparent:

[0025] Figure 1 is a flowchart of an embodiment of the method for generating Java code of the present application;

[0026] Figure 2 is a flowchart of another embodiment of the method for generating Java code of the present application;

[0027] Figure 3 is a flowchart of another embodiment of the method for generating Java code of the present application;

[0028] Figure 4 is a schematic structural diagram of an embodiment of the apparatus for generating Java code of the present application;

[0029] Figure 5 is a schematic structural diagram of an embodiment of the system for generating Java code of the application;

[0030] Figure 6 is a schematic structural diagram of an electronic device for implementing the embodiments of the present application. Detailed Embodiments

[0031] All actions of obtaining signals, information, or data in the present application are carried out on the premise of complying with the corresponding data protection regulations and policies of the country where the location is located and obtaining authorization from the owner of the corresponding device.

[0032] The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related invention, rather than limiting the invention. Additionally, it should be noted that for ease of description, only the parts related to the relevant invention are shown in the drawings.

[0033] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the drawings and embodiments.

[0034] Please refer to Figure 1 , which shows a flow 100 of an embodiment of a method for generating Java code according to the present application. The method for generating Java code can be applied to various electronic devices with data processing capabilities. For example, the above-mentioned electronic devices may include, but are not limited to, cloud servers, physical servers, etc. The execution subject of the method for generating Java code can be a processor in the above-mentioned electronic devices.

[0035] As Figure 1 shown, the method for generating Java code includes the following steps:

[0036] Step 101, determine the target function module to be edited by the user, and the target function module is selected by the user from a pre-set function module set.

[0037] In this embodiment, the function module set may include the following function modules:

[0038] 1. Database module, used to define the structure, columns, and primary key of a data table, generate entity classes, mapper interfaces, and Extensible Markup Language (XML) files.

[0039] 2. Data structure module, used to define Data Transfer Objects (DTOs), enumerations (enums), and constants classes.

[0040] Among them, DTO is a design pattern used to transfer data between different layers to reduce communication overhead and simplify the system architecture. A DTO usually contains a set of attributes and methods to access these attributes, but does not contain any business logic. It is mainly used to transfer data from the server side to the client side, or to pass data between different services.

[0041] Among them, enum is a user-defined data type consisting of a set of named constants, which usually represent elements in a set. The main purpose of the enumeration type is to improve the readability and maintainability of the code by using meaningful names to replace integer values or strings.

[0042] Among them, constants refer to the fixed and unchanging values in the program. In programming, constants are usually used to define data that will not change during the execution of the program, which can be in the form of numbers, characters, or strings, etc.

[0043] 3. The API module is used to generate the interface codes for the controller layer, service layer, and the Feign call layer of the wide area network service client.

[0044] In this embodiment, Feign is a declarative Web service client. By using Feign, users only need to create an interface and add corresponding annotations to achieve the invocation of remote services, without the need to write a large amount of HTTP request codes. In the context of the wide area network service client, Feign is usually used to communicate with remote services.

[0045] 4. The utility class module is used to generate utility class codes.

[0046] In this embodiment, the utility class codes can include general utility methods and common services, etc.

[0047] 5. The other module is used to generate the codes for interceptors, exception handling classes, and filters.

[0048] In this embodiment, the above-mentioned other module is only a specific example. In the actual use process, it can also include other codes required for software programming, which will not be elaborated one by one here.

[0049] In this embodiment, the 5 functional modules included in the above functional module set are preset in the Java code programming system. For different scenarios of generating Java codes, users can select the required functional modules from the functional module set according to actual needs for programming use.

[0050] In this embodiment, on the front-end user side, each functional module can correspond to an entry, and step 101 can determine the target functional module to be edited by the user by the user clicking on the entry corresponding to the functional module.

[0051] In this embodiment, the number of target functional modules can be multiple. During the process of generating Java codes, users can click on the required functional modules one by one for operation.

[0052] Step 102: Send a prompt word corresponding to the target function module to the user. The prompt word includes: a requirement prompt word and a prompt word for the call relationship between modules.

[0053] Step 103: Receive the description information returned by the user according to the prompt word. The description information includes: a requirement description and a description of the call relationship between modules.

[0054] In this embodiment, the description information corresponding to different function modules is different, which is specifically as follows:

[0055] 1. The description information corresponding to the database module includes: guiding the generation of database table structures, field definitions, and corresponding entity class codes.

[0056] For example: Generate a Java entity class for the table named "User", including fields "id", "username", and "password".

[0057] 2. The description information corresponding to the data structure module includes: guiding the generation of data transfer objects, enums, and constant class codes.

[0058] 3. The description information corresponding to the API module includes: guiding the generation of interface and controller codes associated with the database and data structure modules, and prompting the associated service layer logic.

[0059] 4. The description information corresponding to the utility class module includes: guiding the generation of utility class codes and indicating that they will be called in other modules.

[0060] For example: Generate a utility class for handling string operations.

[0061] 5. The description information corresponding to other modules includes: guiding the generation of interceptor, exception handling class, and filter codes.

[0062] For example: Generate a request filter for logging HTTP requests and capturing exception information when an exception occurs.

[0063] Step 104: Obtain Java code from the artificial intelligence large model according to the requirement description, and generate call codes according to the description of the call relationship between modules.

[0064] In this embodiment, step 104 can encapsulate the requirement description and send it to the corresponding artificial intelligence large model. The artificial intelligence large model automatically generates Java code according to the requirement description and returns the Java code. It should be noted that this embodiment does not limit the artificial intelligence large model. In actual use, an appropriate artificial intelligence large model can be selected according to the Java code generation requirements.

[0065] In this embodiment, exemplarily, step 104 of generating call code according to the call relationship description between modules may include, but is not limited to:

[0066] In the controller generated by the API module, step 104 automatically adds the interface code for calling the Service layer and guides the generation of Feign interface call code.

[0067] In the entity class generated by the database module, step 104 automatically associates with the interfaces of the Service layer and uses these entity classes in the Mapper code.

[0068] Step 105, generate the Java code corresponding to the target function module according to the Java code and the call code.

[0069] In this embodiment, if there are multiple target function modules, after step 105 generates the Java code corresponding to all target function modules, it will also automatically integrate the Java code corresponding to each target function module, and finally generate the complete Java code.

[0070] The method, device, equipment, system and medium for generating Java code provided by the embodiments of the present application add the call relationship prompt words between modules, and guide the generation of mutually dependent Java code through the call relationship prompt words between modules, avoiding the problem that the Java code generated independently by each module in the prior art cannot be directly called with each other; since each function module has corresponding call relationship prompt words between modules, the technical solution provided by the embodiments of the present application can cope with complex Java code generation requirements; due to the addition of the call relationship prompt words between modules, the generated Java code is more accurate and fluent, avoiding the problem that in the prior art during the software development process, programmers need to manually perform secondary development on the Java code generated by the large model, and the quality of the secondary developed Java code is greatly affected by the programming level of the programmers, and moreover, the efficiency of secondary development by programmers is relatively low.

[0071] Please refer to Figure 2 , which shows the flow 100 of another embodiment of the method for generating Java code according to the present application. This method for generating Java code can be applied to various electronic devices with data processing functions. For example, the above-mentioned electronic devices may include, but are not limited to, cloud servers, physical servers, etc. The execution subject of this method for generating Java code can be the processor in the above-mentioned electronic device.

[0072] As Figure 2 shown, this method for generating Java code is basically the same as Figure 1 shown, the difference is that after step 103 and before step 104, it may further include

[0073] Step 106: Check and correct the description of the call relationships between modules, and obtain the corrected description of the call relationships between modules.

[0074] In this embodiment, the necessary information about the call relationships between the corresponding functional modules can be preset and saved in advance. At this time, step 106 may specifically include: checking and correcting the description of the call relationships between modules according to the necessary information about the call relationships between modules, and obtaining the corrected description of the call relationships between modules.

[0075] Then, at this time, step 104 may be: generating call code according to the corrected description of the call relationships between modules.

[0076] The method for generating Java code provided in this embodiment, on the basis of achieving the beneficial effects brought by the Figure 1 shown technical solution, can automatically check and correct the call relationships between modules input by the user according to the necessary information about the call relationships between the corresponding functional modules set and saved, avoiding the problem of call failure between modules caused by reasons such as user omission or incorrect setting, and further ensuring the quality and efficiency of Java code development.

[0077] Please refer to Figure 3 , which shows the flow 100 of another embodiment of the method for generating Java code according to the present application. The method for generating Java code can be applied to various electronic devices with data processing functions. For example, the above-mentioned electronic devices may include, but are not limited to, cloud servers, physical servers, etc. The execution subject of the method for generating Java code may be a processor in the above-mentioned electronic device.

[0078] As Figure 3 shown, the method for generating Java code is basically the same as the Figure 2 shown one, the difference being that after step 106, it may further include:

[0079] Step 107: Send the corrected description of the call relationships between modules to the user.

[0080] Step 108: Receive the confirmation response returned by the user according to the corrected description of the call relationships between modules.

[0081] Then, at this time, step 104 may be: generating call code according to the confirmation response.

[0082] In this embodiment, the confirmation response may include the corrected information re-entered by the user according to the corrected call relationships between modules, or may only include the confirmation information of the user, or may also include the relevant information for the user to reject the correction. Each case will not be elaborated here one by one.

[0083] Based on the beneficial effects brought by the technical solution shown, for the method for generating Java code provided in this embodiment, after correcting the description of the call relationship between modules sent by the user, the user can be allowed to confirm the corrected description of the call relationship between modules again, so as to avoid the problem that the call relationship between modules may be incorrect due to automatically correcting the description of the call relationship between modules, and further ensure the quality and efficiency of Java code development. Figure 2 For the implementation of the method shown in each figure, please refer to

[0084] As an embodiment of a device for generating Java code provided by this application, this device embodiment corresponds to the method shown in the above embodiments, and this device can be specifically applied to various electronic devices. Figure 4

[0085] As shown in Figure 4

[0086]

[0087] The determination module 401 is used to determine the target function module to be edited by the user, and the target function module is selected by the user from a pre-set function module set;

[0088] The sending module 402 is used to send a prompt word corresponding to the target function module to the user, and the prompt word includes: a requirement prompt word and a call relationship prompt word between modules;

[0089] The receiving module 403 is used to receive the description information returned by the user according to the prompt word, and the description information includes: a requirement description and a call relationship description between modules;

[0090] The code generation module 404 is used to obtain Java code from an artificial intelligence large model according to the requirement description, and generate call code according to the call relationship description between modules;

[0091] The integration module 405 is used to generate Java code corresponding to the target function module according to the Java code and the call code.

[0092] Optionally, the receiving module 403 is further used to check and correct the call relationship description between modules, and obtain the corrected call relationship description between modules;

[0093] The code generation module 404 is further used to generate call code according to the corrected call relationship description between modules.

[0093] Optionally, the receiving module 403 is further configured to check and correct the description of the call relationship between the modules according to the necessary information of the preset call relationship between the modules, and obtain the corrected description of the call relationship between the modules.

[0094] Optionally, the receiving module 403 is further configured to send the corrected description of the call relationship between the modules to the user; receive the confirmation response returned by the user according to the corrected description of the call relationship between the modules;

[0095] The code generation module 404 is further configured to generate call code according to the confirmation response.

[0096] Optionally, the function module set includes:

[0097] A database module, which is used to define the structure, columns and primary key of the data table, and generate entity classes, mapper interfaces and XML files;

[0098] A data structure module, which is used to define data transfer objects, enums and constant classes;

[0099] An API module, which is used to generate interface codes for the controller layer, service layer and WAN service client Feign call layer;

[0100] A tool class module, which is used to generate tool class codes;

[0101] Other modules, which are used to generate codes for interceptors, exception handling classes and filters.

[0102] Optionally, the description information corresponding to the database module includes: guiding the generation of the database table structure, field definitions and corresponding entity class codes; and / or,

[0103] The description information corresponding to the data structure module includes: guiding the generation of data transfer object, enum and constant class codes; and / or,

[0104] The description information corresponding to the API module includes: guiding the generation of interfaces and controller codes associated with the database and data structure modules, and prompting the associated service layer logic; and / or,

[0105] The description information corresponding to the tool class module includes: guiding the generation of tool class codes and indicating that they will be called in other modules; and / or,

[0106] The description information corresponding to the other modules includes: guiding the generation of codes for interceptors, exception handling classes and filters.

[0107] The device for generating Java code provided in this embodiment, the specific implementation method of which can be referred to the method for generating Java code described in the above embodiments, will not be elaborated here.

[0108] The device for generating Java code provided in the embodiments of this application adds a prompt word for the call relationship between modules. By guiding with the prompt word for the call relationship between modules, it generates mutually dependent Java code, avoiding the problem in the prior art that Java code generated by each module independently cannot be directly called with each other; since each functional module has a corresponding prompt word for the call relationship between modules, the technical solution provided in the embodiments of this application can handle complex Java code generation requirements; due to the addition of the prompt word for the call relationship between modules, the generated Java code is more accurate and fluent, avoiding the problem in the prior art that during the software development process, programmers need to manually perform secondary development on the Java code generated by the large model, and the quality of the Java code after secondary development is greatly affected by the programming level of the programmers, and moreover, the efficiency of secondary development by programmers is relatively low.

[0109] Please refer to Figure 5 , as an implementation of the methods shown in the respective figures, this application provides an embodiment of a system for generating Java code. This system embodiment corresponds to the methods shown in the above embodiments, and this system can be specifically applied to various electronic devices.

[0110] As Figure 5 shown, the system 500 for generating Java code in this embodiment includes:

[0111] A functional module division module 501, configured to divide Java code into multiple functional modules;

[0112] A prompt word module 502, configured to generate corresponding prompt words for each of the functional modules, the prompt words including: a requirement prompt word and a prompt word for the call relationship between modules;

[0113] A Java code generation module 503, configured to determine a target functional module to be edited by the user, the target functional module being selected by the user from the multiple functional modules divided by the functional module division module, send the prompt words corresponding to the target functional module to the user, receive the description information returned by the user according to the prompt words, the description information including: a requirement description and a description of the call relationship between modules, obtain Java code from an artificial intelligence large model according to the requirement description, and generate call code according to the description of the call relationship between modules, and generate Java code corresponding to the target functional module according to the Java code and the call code.

[0114] Optionally, the Java code generation module 503 is further configured to check and correct the description of the invocation relationship between the modules, obtain the corrected description of the invocation relationship between the modules, and generate invocation code according to the corrected description of the invocation relationship between the modules.

[0115] Optionally, the Java code generation module 503 is further configured to check and correct the description of the invocation relationship between the modules according to the necessary information of the invocation relationship between the preset modules, and obtain the corrected description of the invocation relationship between the modules.

[0116] Optionally, the Java code generation module 503 is further configured to send the corrected description of the invocation relationship between the modules to the user, receive the confirmation response returned by the user according to the corrected description of the invocation relationship between the modules, and generate invocation code according to the confirmation response.

[0117] Optionally, the function module set includes:

[0118] A database module, which is used to define the structure, columns, and primary key of the data table, and generate entity classes, mapper interfaces, and XML files;

[0119] A data structure module, which is used to define data transfer objects, enums, and constant classes;

[0120] An API module, which is used to generate interface codes for the controller layer, service layer, and WAN service client Feign call layer;

[0121] A utility class module, which is used to generate utility class codes;

[0122] Other modules, which are used to generate codes for interceptors, exception handling classes, and filters.

[0123] Optionally, the description information corresponding to the database module includes: guiding the generation of the database table structure, field definitions, and corresponding entity class codes; and / or,

[0124] The description information corresponding to the data structure module includes: guiding the generation of data transfer object, enum, and constant class codes; and / or,

[0125] The description information corresponding to the API module includes: guiding the generation of interfaces and controller codes associated with the database and data structure modules, and prompting the associated service layer logic; and / or,

[0126] The description information corresponding to the utility class module includes: guiding the generation of utility class codes and indicating that they will be called in other modules; and / or,

[0127] The description information corresponding to the other modules includes: guiding the generation of codes for interceptors, exception handling classes, and filters.

[0128] The system for generating Java code provided in this embodiment, the specific implementation method of which can be referred to the method for generating Java code described in the above embodiments, will not be elaborated here.

[0129] The system for generating Java code provided in the embodiments of this application adds a prompt word for the call relationship between modules, and guides the generation of mutually dependent Java code through the prompt word for the call relationship between modules, avoiding the problem that the Java code generated independently by each module in the prior art cannot be directly called with each other; since each functional module has a corresponding prompt word for the call relationship between modules, the technical solution provided in the embodiments of this application can cope with complex Java code generation requirements; due to the addition of the prompt word for the call relationship between modules, the generated Java code is more accurate and fluent, avoiding the problem that in the process of software development in the prior art, programmers need to manually perform secondary development on the Java code generated by the large model, and the quality of the Java code for secondary development is greatly affected by the programming level of the programmers, and moreover, the efficiency of secondary development by programmers is relatively low.

[0130] The following refers to Figure 6 , which shows a schematic structural diagram of an electronic device for implementing some embodiments of the present application. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present application.

[0131] As Figure 6 shown, the electronic device 600 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage device 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.

[0132] Generally, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic disk, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 6An electronic device 600 with various devices is shown, but it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices may be implemented or had. Figure 6 Each block shown in Figure 6 may represent a device or, as needed, multiple devices.

[0133] In particular, according to some embodiments of the present application, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, some embodiments of the present application include a computer program product that includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowcharts. In such some embodiments, the computer program may be downloaded and installed from the network via the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the methods of some embodiments of the present application are executed.

[0134] It should be noted that the computer-readable medium described in some embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present application, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in some embodiments of the present application, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program codes are carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable signal medium may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program codes contained on the computer-readable medium may be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0135] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (HyperText Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0136] The above computer-readable medium can be included in the above electronic device; or can exist separately without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device is caused to: determine a target function module to be edited by the user, where the target function module is selected by the user from a pre-set set of function modules; send a prompt word corresponding to the target function module to the user, the prompt word including: a requirement prompt word and a prompt word for the call relationship between modules; receive description information returned by the user according to the prompt word, the description information including: a requirement description and a description of the call relationship between modules; obtain Java code from an artificial intelligence large model according to the requirement description, and generate call code according to the description of the call relationship between modules; generate Java code corresponding to the target function module according to the Java code and the call code.

[0137] Computer program code for performing the operations of some embodiments of the present application can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++; and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network connection, or can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet). The above network includes a local area network (LAN) or a wide area network (WAN).

[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0139] The units described in some embodiments of the present application can be implemented in software or in hardware. The described units can also be provided in a processor. For example, it can be described as: a processor includes a first determination unit, a second determination unit, a selection unit, and a third determination unit. Among them, the names of these units do not constitute a limitation to the unit itself in some cases.

[0140] The functions described above can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), and so on.

[0141] The above description is only some preferred embodiments of the present application and an explanation of the technical principles applied. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features having similar functions disclosed in the embodiments of the present application.

Claims

1. A method for generating Java code, characterized in that, The method comprises: Determining a target function module to be edited by a user, wherein the target function module is selected by the user from a preset function module set; Sending prompt words corresponding to the target functional module to the user, the prompt words including: requirement prompt words and calling relationship prompt words between modules; receiving description information returned by the user according to the prompt word, wherein the description information includes: a description of requirements and a description of calling relationships between modules; Obtaining Java code from the artificial intelligence big model according to the requirement description, and generating calling code according to the calling relationship description between the modules; Generate Java code corresponding to the target functional module according to the Java code and the calling code.

2. The method according to claim 1, characterized in that After receiving the description information returned by the user according to the prompt word and before generating the calling code according to the calling relationship description between the modules, the method further includes: Checking and correcting the calling relationship description between the modules to obtain a corrected calling relationship description between the modules; The calling code generated according to the calling relationship description between the modules is: Generate calling code according to the modified calling relationship description between modules.

3. The method according to claim 2, characterized in that The checking and correcting the calling relationship description between the modules to obtain the corrected calling relationship description between the modules includes: According to the preset necessary information of the calling relationship between modules, the description of the calling relationship between modules is checked and corrected to obtain the corrected description of the calling relationship between modules.

4. The method according to claim 2, characterized in that: After checking and correcting the calling relationship description between the modules and obtaining the corrected calling relationship description between the modules, the method further includes: Sending the modified description of the calling relationship between modules to the user; Receiving a confirmation response returned by the user according to the modified description of the calling relationship between modules; The calling code generated according to the calling relationship description between the modules is: A calling code is generated based on the confirmation response.

5. The method according to claim 1, characterized in that The functional module set includes: Database module, used to define the structure, columns and primary keys of data tables, generate entity classes, mapper interfaces and extensible markup language XML files; Data structure module, used to define data transfer objects, enumerations and constant classes; API module, used to generate interface code for controller layer, service layer and WAN service client Feign call layer; Tool module, used to generate tool code; Other modules are used to generate code for interceptors, exception handling classes, and filters.

6. The method according to claim 5, characterized in that The description information corresponding to the database module includes: guiding the generation of database table structure, field definition and corresponding entity class code; and / or, The description information corresponding to the data structure module includes: guiding the generation of data transfer objects, enumeration and constant class codes; and / or, The description information corresponding to the API module includes: guiding the generation of interface and controller codes associated with the database and data structure modules, and prompting the associated service layer logic; and / or, The description information corresponding to the tool class module includes: guiding the generation of tool class code and indicating that it will be called in other modules; and / or, The description information corresponding to the other modules includes: guiding the generation of interceptors, exception handling classes and filter codes.

7. A device for generating Java code, characterized in that: The device comprises: A determination module, used to determine a target function module to be edited by a user, wherein the target function module is selected by the user from a set of pre-set function modules; A sending module, used for sending prompt words corresponding to the target functional module to the user, wherein the prompt words include: requirement prompt words and calling relationship prompt words between modules; A receiving module, used to receive the description information returned by the user according to the prompt word, wherein the description information includes: a description of the requirement and a description of the calling relationship between modules; A code generation module, used to obtain Java code from the artificial intelligence large model according to the requirement description, and to generate a calling code according to the calling relationship description between the modules; The integration module is used to generate the Java code corresponding to the target functional module according to the Java code and the calling code.

8. A system for generating Java code, characterized in that: The system comprises: Functional module division module, used to divide Java code into multiple functional modules; A prompt word module, used to generate corresponding prompt words for each of the functional modules, wherein the prompt words include: requirement prompt words and calling relationship prompt words between modules; A Java code generation module is used to determine a target function module to be edited by a user, wherein the target function module is selected by the user from a plurality of function modules divided by the function module division module, and a prompt word corresponding to the target function module is sent to the user, and description information returned by the user according to the prompt word is received, wherein the description information includes: a description of requirements and a description of a calling relationship between modules, Java code is obtained from a large artificial intelligence model according to the description of requirements, and a calling code is generated according to the description of the calling relationship between modules, and Java code corresponding to the target function module is generated according to the Java code and the calling code.

9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Code generation method and device based on natural language and medium

    CN120469666A