Metamodel processing method and device in IDEA development environment and medium
By initializing the metamodel enhancement plug-in in the IDEA development environment, dynamic indexing and synchronous updates are realized, intelligent completion and jump processing are provided, and static variables and custom methods are generated, which solves the efficiency of metamodel processing in the IDEA development environment in the existing technology. and the problem of insufficient accuracy improves development efficiency and code standardization.
Patent Information
- Application Number
- CN202411198014.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-08-29
AI Technical Summary
The existing technology cannot efficiently index and synchronously update model files in large-scale projects under the IDEA development environment, and lacks effective completion prompts and shading navigation support for custom annotation and annotation methods parameters, and generates static variables and customizations. The getter setter method is not fully functional, resulting in insufficient development efficiency and accuracy.
Provide a meta-model processing method, including initializing the meta-model enhancement plug-in, dynamic indexing and synchronous update of cached model files, providing intelligent completion, shading and jump processing, performing attribute prompts and jump detection on custom annotations, and generating based on annotation Static variables and automatic generation getter setter methods.
It improves the efficiency and accuracy of metamodel processing in the IDEA development environment, provides smarter code completion and detection functions, simplifies the workflow of developers, and improves coding efficiency and code standardization.
Smart Images

Figure CN119166117A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a metamodel processing method, device and medium in an IDEA development environment. Background Art
[0002] At present, the enhancement technology of IDEA (full name IntelliJ IDEA, an integrated environment for Java language development) development environment is mainly concentrated in code completion, syntax coloring and jump navigation. Although there are many plug-ins that can provide similar functions, there are still obvious deficiencies in the processing and optimization of the IIDP platform for complex meta-models.
[0003] For example, existing methods cannot efficiently dynamically index and synchronously update model files in large-scale projects, and lack effective completion prompts and coloring navigation support for method parameters annotated with custom annotations. In addition, the functions of generating static variables and generating custom getter and setter methods have not been fully applied in the current IDEA development environment, and cannot effectively improve the development efficiency of the IDEA development environment. Summary of the invention
[0004] The embodiment of the present application provides a metamodel processing method, device and medium in the IDEA development environment to solve the problems existing in the related technologies. The technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a metamodel processing method in an IDEA development environment, characterized by comprising:
[0006] Initialize the metamodel enhancement plug-in in the IIDP platform, and configure the dependent libraries and environment variables required by the metamodel enhancement plug-in;
[0007] Calling the metamodel enhancement plug-in to dynamically index and synchronously update cache of file information related to the metamodel in the current project;
[0008] Calling the metamodel enhancement plug-in to perform intelligent completion, coloring, jump and detection processing on the target method parameters in the metamodel, wherein the target method parameters refer to the method parameters annotated with custom annotations;
[0009] Calling the metamodel enhancement plug-in to perform intelligent prompting and jump detection processing on the custom annotations in the metamodel;
[0010] Calling the metamodel enhancement plug-in to generate static variables related to model information according to specified annotations in the metamodel, and providing intelligent completion prompts for the static variables;
[0011] Calling the metamodel enhancement plug-in to automatically generate a get method and a set method applicable to the metamodel according to the @Getter annotation and the @Setter annotation on the model attribute of the metamodel;
[0012] The processed meta-model is saved on the IIDP platform.
[0013] In one embodiment, calling the metamodel enhancement plug-in to dynamically index and synchronously update cache of file information related to the metamodel in the current project includes:
[0014] Calling the metamodel enhancement plug-in to traverse all files in the current project, and identifying files containing metamodel definitions among all the files to obtain metamodel files;
[0015] Extracting the model name, model attributes and model methods of the metamodel file to obtain file information related to the metamodel;
[0016] Cache the file information into a memory, and establish a target index between the file information and the meta-model;
[0017] The metamodel enhancement plug-in is called to access the metamodel according to the target index, and after the metamodel is updated, the file information cached in the memory is synchronously updated.
[0018] In one implementation, calling the metamodel enhancement plug-in to perform intelligent completion, coloring, jump, and detection processing on target method parameters in the metamodel includes:
[0019] Calling the metamodel enhancement plug-in to parse the annotation information in the target method parameter and identify the annotation type of the target method parameter;
[0020] Calling the metamodel enhancement plug-in to perform syntax coloring on the target method parameters according to the annotation type;
[0021] Calling the metamodel enhancement plug-in to add a jump navigation function to the target method parameter;
[0022] The metamodel enhancement plug-in is called to provide intelligent completion prompts for the target method parameters and perform syntax and logic detection processing.
[0023] In one embodiment, calling the metamodel enhancement plug-in to perform intelligent prompting and jump detection processing on the custom annotations in the metamodel includes:
[0024] Calling the metamodel enhancement plug-in to parse the custom annotation and extract the target attribute in the custom annotation;
[0025] Calling the metamodel enhancement plug-in to provide intelligent completion prompts for the target attributes;
[0026] Calling the metamodel enhancement plug-in to perform syntax coloring processing on the specified attribute in the target attribute and add a jump function;
[0027] The metamodel enhancement plug-in is called to perform validity detection processing on the specified attribute.
[0028] In one embodiment, calling the metamodel enhancement plug-in to generate static variables related to model information according to specified annotations in the metamodel, and providing intelligent completion prompts for the static variables includes:
[0029] Calling the metamodel enhancement plug-in to parse the specified annotation, and generating the static variable according to the parsing result;
[0030] The metamodel enhancement plug-in is called to provide intelligent completion prompts for the static variables.
[0031] In one embodiment, calling the metamodel enhancement plug-in to automatically generate a get method and a set method applicable to the metamodel according to the @Getter annotation and the @Setter annotation on the model attribute of the metamodel includes:
[0032] Calling the metamodel enhancement plug-in to parse the @Getter annotation, obtaining the attribute type and name of the @Getter annotation, and automatically generating a custom get method according to the attribute type and name of the @Getter annotation;
[0033] Calling the metamodel enhancement plug-in to parse the @Setter annotation, obtain the attribute type and name of the @Getter annotation, and automatically generate a custom set method according to the attribute type and name of the @Getter annotation;
[0034] The get method and the set method are inserted into the corresponding model class in the metamodel.
[0035] In one embodiment, the method further comprises:
[0036] Calling the metamodel enhancement plug-in to count the total number of metamodels, model attributes and model methods for the file information related to the metamodel in the cache, and displaying the statistical results;
[0037] The method further comprises:
[0038] The meta-model enhancement plug-in is called to provide a user interface operation entry, and the user interface operation entry allows manual initiation of a scanning process for file information related to the meta-model in the scanning cache.
[0039] In a second aspect, the embodiment of the present application further provides a metamodel processing device in an IDEA development environment, including:
[0040] A configuration unit, used to initialize the metamodel enhancement plug-in in the IIDP platform and configure the dependent libraries and environment variables required by the metamodel enhancement plug-in;
[0041] A processing unit is used to call the metamodel enhancement plug-in to dynamically index and synchronously update the cache of file information related to the metamodel in the current project; call the metamodel enhancement plug-in to intelligently complete, color, jump and detect the target method parameters in the metamodel, and the target method parameters refer to the method parameters annotated with custom annotations; call the metamodel enhancement plug-in to perform intelligent prompts and jump detection on the properties of the custom annotations in the metamodel; call the metamodel enhancement plug-in to generate static variables related to the model information according to the specified annotations in the metamodel, and provide intelligent completion prompts for the static variables; call the metamodel enhancement plug-in to automatically generate get methods and set methods applicable to the metamodel according to the @Getter annotations and @Setter annotations on the model attributes of the metamodel; and save the processed metamodel on the IIDP platform.
[0042] In one embodiment, when the processing unit is used to call the metamodel enhancement plug-in to dynamically index and synchronously update the cache of file information related to the metamodel in the current project, it is specifically used to:
[0043] Calling the metamodel enhancement plug-in to traverse all files in the current project, and identifying files containing metamodel definitions among all the files to obtain metamodel files;
[0044] Extracting the model name, model attributes and model methods of the metamodel file to obtain file information related to the metamodel;
[0045] Cache the file information into a memory, and establish a target index between the file information and the meta-model;
[0046] The metamodel enhancement plug-in is called to access the metamodel according to the target index, and after the metamodel is updated, the file information cached in the memory is synchronously updated.
[0047] In one embodiment, when the processing unit is used to call the metamodel enhancement plug-in to perform intelligent completion, coloring, jump and detection processing on the target method parameters in the metamodel, it is specifically used to:
[0048] Calling the metamodel enhancement plug-in to parse the annotation information in the target method parameter and identify the annotation type of the target method parameter;
[0049] Calling the metamodel enhancement plug-in to perform syntax coloring on the target method parameters according to the annotation type;
[0050] Calling the metamodel enhancement plug-in to add a jump navigation function to the target method parameter;
[0051] The metamodel enhancement plug-in is called to provide intelligent completion prompts for the target method parameters and perform syntax and logic detection processing.
[0052] In one embodiment, when the processing unit is used to call the metamodel enhancement plug-in to perform intelligent prompt and jump detection processing on the custom annotation in the metamodel, it is specifically used to:
[0053] Calling the metamodel enhancement plug-in to parse the custom annotation and extract the target attribute in the custom annotation;
[0054] Calling the metamodel enhancement plug-in to provide intelligent completion prompts for the target attributes;
[0055] Calling the metamodel enhancement plug-in to perform syntax coloring processing on the specified attribute in the target attribute and add a jump function;
[0056] The metamodel enhancement plug-in is called to perform validity detection processing on the specified attribute.
[0057] In one embodiment, when the processing unit is used to call the metamodel enhancement plug-in to generate static variables related to model information according to specified annotations in the metamodel and provide intelligent completion prompts for the static variables, it is specifically used to:
[0058] Calling the metamodel enhancement plug-in to parse the specified annotation, and generating the static variable according to the parsing result;
[0059] The metamodel enhancement plug-in is called to provide intelligent completion prompts for the static variables.
[0060] In one embodiment, when the processing unit is used to call the metamodel enhancement plug-in to automatically generate a get method and a set method applicable to the metamodel according to the @Getter annotation and the @Setter annotation on the model attribute of the metamodel, it is specifically used to:
[0061] Calling the metamodel enhancement plug-in to parse the @Getter annotation, obtaining the attribute type and name of the @Getter annotation, and automatically generating a custom get method according to the attribute type and name of the @Getter annotation;
[0062] Calling the metamodel enhancement plug-in to parse the @Setter annotation, obtain the attribute type and name of the @Getter annotation, and automatically generate a custom set method according to the attribute type and name of the @Getter annotation;
[0063] The get method and the set method are inserted into the corresponding model class in the metamodel.
[0064] In one embodiment, the processing unit is further used to: call the metamodel enhancement plug-in to count the total number of metamodels, model attributes and model methods for the file information related to the metamodel in the cache, and display the statistical results;
[0065] The processing unit is further used to call the meta-model enhancement plug-in to provide a user interface operation entry, wherein the user interface operation entry allows manual initiation of a scanning process for file information related to the meta-model in the scanning cache.
[0066] In a third aspect, an embodiment of the present application further provides a computer device, comprising: a memory and a processor, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement a method in any one of the above-mentioned aspects, wherein the memory and the processor communicate with each other through an internal connection path.
[0067] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the method in any one of the above-mentioned embodiments is implemented.
[0068] The advantages or beneficial effects of the above technical solution include at least:
[0069] This application can effectively improve the efficiency and accuracy of metamodel processing in the IDEA development environment, provide more intelligent code completion, jump and detection functions, solve the efficiency, accuracy and maintenance problems existing in the prior art in the IDEA development environment, simplify the workflow and maintenance difficulty of developers in development based on the IIDP platform, and further improve coding efficiency and code standardization.
[0070] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.
[0072] Figure 1 A flowchart of a metamodel processing method in an IDEA development environment provided in an embodiment of the present application;
[0073] Figure 2 A flowchart of a metamodel processing method in an IDEA development environment provided in an embodiment of the present application;
[0074] Figure 3 A flowchart of another metamodel processing method in an IDEA development environment provided in an embodiment of the present application;
[0075] Figure 4 A structural block diagram of another metamodel processing device in the IDEA development environment provided in an embodiment of the present application;
[0076] Figure 5 A structural block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.
[0078] In the related technologies, it is impossible to efficiently dynamically index and synchronously update model files in large-scale projects, and there is a lack of effective completion prompts and coloring navigation support for method parameters annotated with custom annotations. In addition, the functions of generating static variables and generating custom getter setter methods have not been fully applied in the current IDEA development environment, and the development efficiency of the IDEA development environment cannot be effectively improved.
[0079] Specifically, the existing technology mainly faces the following problems:
[0080] (1) Dynamic indexing and synchronization issues: Traditional methods usually perform a global static scan of the entire project, which is not only time-consuming, but also cannot be updated in real time when the model file changes locally, resulting in a mismatch between the index data and the actual project content, thus affecting development efficiency and accuracy.
[0081] (2) Inadequate processing of method parameters: The current IDEA plug-in can only provide basic coloring and jump support for method parameters annotated with specific annotations. It lacks accurate completion prompts and error detection for method parameters, especially the inability to parse the semantics of custom annotations, which seriously affects the convenience and reliability of code writing.
[0082] (3) Limitations of annotation processing: Existing methods cannot automatically prompt and complete the attributes in complex annotations, such as name and parent in the @Model annotation. This makes it easy for developers to make mistakes when manually filling in annotation attributes. At the same time, there is a lack of jump and detection functions for annotation content, which increases the difficulty of code maintenance.
[0083] (4) Static variable generation and prompts: In traditional methods, the generation of static variables usually relies on manual operations, which is time-consuming and error-prone. Existing prompt systems are also unable to provide effective real-time completion prompts for generated static variables, affecting the fluency and accuracy of code writing.
[0084] Based on this, the embodiment of the present application provides a metamodel processing solution in the IDEA development environment to effectively solve the above problems:
[0085] (I) Support dynamic indexing and synchronous updating: The model files in the current project are indexed and cached, which can effectively support synchronous updating after local changes in model names, model properties and methods, ensuring the real-time accuracy of the index.
[0086] (ii) Enhanced processing of method parameters: Supports coloring, jumping, detection, and completion of method parameters annotated with @ModelName, @ModelField, and @ModelMethod, greatly improving the code writing experience and accuracy.
[0087] (III) Intelligent prompts for annotation attributes: Supports name and parent completion prompts in @Model annotations, making annotation writing faster and more accurate. At the same time, it can color, jump and detect parents, simplifying code maintenance.
[0088] (IV) New static variable, getter and setter method generation and completion functions: Based on @StaticVar, @Getter and @Setter annotations, static variables and getter setter methods related to model information are automatically generated, including model name, model attributes and model methods, and intelligent prompt completion of static variables is provided, which improves development efficiency.
[0089] Through the above-mentioned improvements provided in the embodiments of the present application, the efficiency and accuracy of metamodel processing can be greatly improved, which brings significant convenience to code writing and maintenance in the IDEA development environment.
[0090] The technical solution provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0091] Figure 1 A flow chart of a metamodel processing method in an IDEA development environment according to an embodiment of the present application is shown. Figure 1 As shown, the method may include the following steps:
[0092] S110 , initializing the metamodel enhancement plug-in in the IIDP platform, and configuring the dependent libraries and environment variables required by the metamodel enhancement plug-in.
[0093] In one implementation, step S110 may include correctly installing a Java development environment and a Java package sie-iidp-plugin.
[0094] In the embodiment of the present application, by executing buS10, it can be ensured that the metamodel enhancement plug-in can work normally in the IDEA development environment.
[0095] S120 , calling the metamodel enhancement plug-in to dynamically index and synchronously update cache of file information related to the metamodel in the current project.
[0096] In one implementation, the implementation process of step S120 may include the following steps:
[0097] S121. Call the metamodel enhancement plug-in to traverse all files in the current project, and identify all files containing metamodel definitions to obtain metamodel files.
[0098] Exemplarily, in step S121, all files in the current project that may contain model definitions may be traversed, and then files containing model definitions may be identified based on the file contents.
[0099] As an example, according to the development specifications of the IIDP platform, all metamodel definitions are unified under the model package and declared through the @Model annotation, for example:
[0100] @Model(name="operator_log",parent="operator_log",displayName="Operation log",isAutoLog=Bool.True,
[0101] type = Model.ModelType.Buss)
[0102] public class OperatorLog extends BaseModel <operatorlog>{
[0103] @Property(displayName="id")
[0104] private String id;
[0105] @Property(displayName="Access Time",dataType=DataType.DATE_TIME)
[0106] private Date accessStartTime;
[0107] @Property(displayName="app name")
[0108] private String appName;
[0109] @Property(displayName="Model Name")
[0110] private String logModelName;
[0111] @Property(displayName = "Service Name")
[0112] private String serviceName;
[0113] @MethodService(auth="search", description="create")
[0114] public List <operatorlog>search(RecordSet r,Filter filter,List <string>proper ties,Integer limit,Integer offset,String order){
[0115] return LogStorageService.queryLog(filter,properties,limit,offset,order);
[0116] }
[0117] }
[0118] From the above example, we can identify the file containing the model definition based on the model package.
[0119] S122: Extract the model name, model attributes and model methods of the metamodel file to obtain file information related to the metamodel.
[0120] For example, from the above example, the model operator_log annotated with @Model, the properties id, appName, serviceName, etc. annotated with @Property, and the method search annotated with @MethodService, etc. can be extracted.
[0121] S123: Cache the file information related to the meta-model into the memory, and establish a target index between the file information and the meta-model.
[0122] Exemplarily, according to the above example, information related to the metamodel operator_log can be obtained. This information will be cached in the memory map as metadata. In this case, the target index can use the model name as the key of the map, and the value is the detailed information of the metamodel operator_log, including the model name, fully qualified name, attribute list, method list, parent model, etc.
[0123] S124: calling the metamodel enhancement plug-in to access the metamodel according to the target index, and after the metamodel is updated, synchronously updating the file information related to the metamodel cached in the memory.
[0124] For example, in actual use, according to the above example, calling the metamodel enhancement plug-in can quickly index the detailed information of the metamodel through the model name according to the target index. In addition, the information of the parent model can also be quickly indexed according to the parent model. Because the memory map is used, fast access and update can be achieved.
[0125] In the embodiment of the present application, by executing step S120, the file information related to the meta-model in the current project can be dynamically indexed and synchronously updated, thereby ensuring that the index information can be automatically and synchronously updated when the meta-model undergoes local changes.
[0126] S130, calling the metamodel enhancement plug-in to perform intelligent completion, coloring, jump and detection processing on the target method parameters in the metamodel.
[0127] In one implementation, the target method parameter refers to a method parameter annotated with a custom annotation.
[0128] Exemplarily, the target method parameter may be a method parameter annotated with `@ModelName`, `@ModelField`, or ˋ@ModelMethodˋ.
[0129] In one implementation, the implementation process of step S130 may include the following steps:
[0130] S131. Call the metamodel enhancement plug-in to parse the annotation information in the target method parameter and identify the annotation type of the target method parameter.
[0131] S132: Call the metamodel enhancement plug-in to perform syntax coloring on the target method parameters according to the annotation type.
[0132] In the embodiment of the present application, by executing step S132, it is possible to easily identify the target method parameters.
[0133] S133. Call the metamodel enhancement plug-in to add a jump navigation function for the target method parameter.
[0134] In the embodiment of the present application, by executing step S133, developers can be supported to quickly locate relevant model information.
[0135] S134. Call the metamodel enhancement plug-in to provide intelligent completion prompts for target method parameters and perform syntax and logic detection processing.
[0136] In the embodiment of the present application, by executing step S134, the correctness of the code of the target method parameter can be ensured.
[0137] In an embodiment of the present application, by executing step S130, intelligent processing and completion prompts of method parameter annotations can be provided, intelligent prompts and jump detection of annotation attributes can be supported, and the purpose of effectively providing completion prompts and coloring navigation support for method parameters marked with custom annotations can be achieved.
[0138] S140: Call the metamodel enhancement plug-in to perform intelligent prompting and jump detection processing on the attributes of the custom annotations in the metamodel.
[0139] In one implementation, the implementation process of step S140 may include the following steps:
[0140] S141. Calling the metamodel enhancement plug-in to parse the custom annotation in the metamodel, and extracting the target attribute in the custom annotation.
[0141] As an example, taking the custom annotation as the @Model annotation, the metamodel enhancement plug-in can be called to parse the @Model annotation in the metamodel and extract the name attribute and the parent attribute in the @Model annotation. That is, in this example, the target attribute includes the name attribute and the parent attribute.
[0142] S142. Call the metamodel enhancement plug-in to provide intelligent completion prompts for target attributes.
[0143] Exemplarily, according to the above example, the metamodel enhancement plug-in may be called to provide intelligent completion hints for the name attribute and the parent attribute.
[0144] For example, when building a filter query in the business code, as follows:
[0145] Filter f1=Filter.equal("appName",valuesList.stream().map(m->m.get("appN name")).collect(Collectors.toList()));
[0146] Filter f2=Filter.equal("logModelName",valuesList.stream().map(m->m.get("logModelName")).collect(Collectors.toList()));
[0147] Filter f3=Filter.equal("serviceName",valuesList.stream().map(m->m.get("serviceName")).collect(Collectors.toList()));
[0148] List <Map<String,Object> >ret=recordSet.getMeta().get(Blacklist.MODEL_NAME).search(Filter.AND(f1,f2,f3),Collections.singletonList("id"),1,0,null);
[0149] When a string with the word "app" is entered in the Filter.equal() parameter, the conventional smart prompt cannot help complete it because it is a common string. However, when executing step S142, the metamodel enhancement plug-in will recognize that the declaration of the equal method requires a model name (because the parameter contains the @ModelName annotation), and will automatically scan the previously created memory map, and will match all model names that match the prefix after "app". Similarly, when a parent model is needed, it can also be indexed in the previously created memory map.
[0150] In the embodiment of the present application, by executing step S142, manual input errors can be reduced.
[0151] S143. Call the metamodel enhancement plug-in to perform syntax coloring processing on the specified attributes in the target attributes, and add a jump function.
[0152] As an example, taking the custom annotation as the @Model annotation, the specified attribute may be the parent attribute.
[0153] In an embodiment of the present application, by executing step S143, jump detection of custom annotation attributes can be supported based on common methods in the industry combined with the grammatical rules and language elements of the IIDP platform itself, so as to facilitate developers to quickly locate related parent models.
[0154] S144. Call the metamodel enhancement plug-in to perform validity detection on the specified attribute.
[0155] In the specific implementation, all validity checks and correctness are performed on the basis of the above-mentioned scanning of the metamodel file and the file information related to the metamodel and saved in the memory map. If the file information related to the metamodel exists, it can be correctly referenced and checked. If it does not exist, a warning will be issued.
[0156] Although parent in the above example is a language element of the IIDP platform, it is also a common metamodel and can be detected and judged.
[0157] In the embodiment of the present application, by executing step S144, it can be ensured that the referenced parent model exists and is correct.
[0158] In the embodiment of the present application, by executing step S140, intelligent prompts and jump detection of custom annotation attributes can be supported, for example, intelligent completion prompts for the name attribute and the parent attribute in the @Model annotation are supported, and coloring, jump and detection functions are supported for the parent attribute.
[0159] At present, although many IDEs also provide element coloring, jump navigation and intelligent completion functions, they are all targeted at programming languages that are already in use in the industry, such as Java, etc., and this application is targeted at the IIDP platform, which has its own grammatical rules and language elements. Conventional coloring and jump functions cannot meet them, so it is necessary to combine the special functions of the IIDP platform itself to redevelop the language intelligent recognition function. By executing the above steps S130 and S140, this application can support the redevelopment of the language intelligent recognition function for the special functions of the IIDP platform itself.
[0160] S150, calling the metamodel enhancement plug-in to generate static variables related to the model information according to the specified annotations in the metamodel, and providing intelligent completion prompts for the static variables.
[0161] As an example, the specified annotation may be a @StaticVar annotation.
[0162] In one implementation, the static variables may include, but are not limited to: model name, model attributes, and model methods.
[0163] In one implementation, the implementation process of step S150 may include the following steps:
[0164] S151. Call the metamodel enhancement plug-in to parse the specified annotation, and generate static variables according to the parsing results.
[0165] As an example, step S151 can be performed based on the industry's Pluggable Annotations Processing API, which is different from the industry's commonly used method for generating getter and setter methods, that is, the metamodel enhancement plug-in generates static metamodel information based on the characteristics of the IIDP platform. For example, the following example generates many static variable representations of attribute literals for the User metamodel:
[0166] public class User extends BaseModel{
[0167] public static final String F_BOOK_SUBCLASS_LIST="bookSubclassList";
[0168] public static final String F_USER_I_D="userID";
[0169] public static final String F_FULL_NAME="fullName";
[0170] public static final String F_REMARK="remark";
[0171] public static final String F_CLASSIFICATION_NAME="classificationName";
[0172] public static final String F_CLASSIFICATION_CODE="classificationCode";
[0173] public static final String F_IS_ENABLE="isEnable";
[0174] public static final String M_EXCEL_EXPORT="excelExport";
[0175] public static final String M_GEN_CLASSIFICATION_CODE="genClassificationCode";
[0176] public static final String MODEL_NAME="user";
[0177] }
[0178] S152. Call the metamodel enhancement plug-in to provide intelligent completion prompts for the static variable.
[0179] As an example, step S152 may be performed using an open interface provided by IDEA.
[0180] In the embodiment of the present application, by executing step S152, developers can quickly use static variables.
[0181] In the embodiment of the present application, by executing step S150, static variable generation and prompt functions of newly added model information can be supported.
[0182] S160. Call the metamodel enhancement plug-in to automatically generate a get method and a set method applicable to the metamodel according to the @Getter annotation and the @Setter annotation on the model attributes of the metamodel.
[0183] In one implementation, the implementation process of step S160 may include the following steps:
[0184] S161. Call the metamodel enhancement plug-in to parse the @Getter annotation, obtain the attribute type and name of the @Getter annotation, and automatically generate a custom get method based on the attribute type and name of the @Getter annotation.
[0185] S162. Call the metamodel enhancement plug-in to parse the @Setter annotation, obtain the attribute type and name of the @Getter annotation, and automatically generate a custom set method according to the attribute type and name of the @Getter annotation.
[0186] In specific implementation, step S161 and step S162 may be executed simultaneously, or may be executed in a corresponding sequence, which is not limited in the embodiment of the present application.
[0187] S163. Insert the get method and the set method into the corresponding model class in the metamodel.
[0188] In the embodiment of the present application, by executing step S163, the standardization and integrity of the metamodel code can be ensured.
[0189] As an example, combined with the User metamodel in the above example, the above steps S161 to S163 can be implemented by the following code:
[0190] public User setBookSubclassList(List <person>bookSubclassList){
[0191] this.set("bookSubclassList",bookSubclassList);
[0192] return this;
[0193] }
[0194] public User setUserID(Integer userID){
[0195] this.set("userID",userID);
[0196] return this;
[0197] }
[0198] public User setFullName(String fullName){
[0199] this.set("fullName",fullName);
[0200] return this;
[0201] }
[0202] public User setRemark(String remark){
[0203] this.set("remark",remark);
[0204] return this;
[0205] }
[0206] public User setClassificationName(String classificationName){
[0207] this.set("classificationName",classificationName);
[0208] return this;
[0209] }
[0210] public User setClassificationCode(String classificationCode){
[0211] this.set("classificationCode",classificationCode);
[0212] return this;
[0213] }
[0214] public User setIsEnable(Boolean isEnable){
[0215] this.set("isEnable",isEnable);
[0216] return this;
[0217] }
[0218] In the embodiment of the present application, by executing step S160, it is possible to support automatic generation of get methods and set methods applicable to the metamodel according to the @Getter annotation and @Setter annotation on the model attributes of the metamodel. In addition, in the embodiment of the present application, the getter method and setter method generated by the metamodel enhancement plug-in are customized by the IIDP platform.
[0219] S170. Save the processed meta-model on the IIDP platform.
[0220] In summary, the metamodel processing method in the IDEA development environment provided by the embodiment of the present application can effectively improve the efficiency and accuracy of metamodel processing in the IDEA development environment, provide more intelligent code completion, jump and detection functions, and solve the efficiency, accuracy and maintenance problems existing in the prior art in the IDEA development environment. It simplifies the workflow and maintenance difficulty of developers in development based on the IIDP platform, and further improves coding efficiency and code standardization.
[0221] In practical applications, the current IDEA development tool lacks support for statistical information of models after scanning. Developers cannot intuitively understand the distribution and total amount of models, attributes and methods in the project, which is not conducive to the overall control and optimization of the project.
[0222] In response to the above problems, in an applicable scenario provided in an embodiment of the present application, a model statistical information viewing function can be provided: supporting the viewing of model statistical information after scanning, including the total number of models, the total number of attributes and the total number of methods, so that developers can have a global grasp of the distribution of models in the project.
[0223] Specifically, in the above scenario, combined with Figure 1 and Figure 2 As shown, the metamodel processing method in the IDEA development environment provided in the embodiment of the present application may also include the following steps:
[0224] S180 , calling the metamodel enhancement plug-in to count the total number of metamodels, model attributes, and model methods for the file information related to the metamodel in the cache, and displaying the statistical results.
[0225] In one implementation, it can be known from the above step S120 that the entire metamodel information has been scanned and stored in the memory map, so the metamodel information can be statistically analyzed according to specific needs, such as how many metamodels are included, what are the specific attributes and methods included in each metamodel, etc. That is, in the embodiment of the present application, the metamodel enhancement plug-in provides a visual interface for users to query this information.
[0226] In one implementation, the statistical results may be displayed in a tool view of IDEA, so that developers can intuitively understand the model status in the project.
[0227] In practical applications, since existing methods lack efficient dynamic scanning capabilities for engineering files, developers can only rely on manual operations when they need to obtain the latest model information, which increases the complexity and uncertainty of the work.
[0228] In response to the above problem, in another applicable scenario provided in the embodiment of the present application, a manual scanning support function can be provided: supporting manual scanning of the model information of the entire project file and the currently opened file to ensure that the latest data can be obtained at any time.
[0229] Specifically, in the above scenario, combined with Figure 1-Figure 3 As shown, the metamodel processing method in the IDEA development environment provided in the embodiment of the present application may also include the following steps:
[0230] S190. Call the metamodel enhancement plug-in to provide a user interface operation entry.
[0231] In one embodiment, the user interface operation portal allows manual initiation of a scanning process for file information related to the meta-model in the scanning cache.
[0232] In one embodiment, the scanning process may be as follows:
[0233] According to the above step S120, the project file or the currently opened file is scanned and the cache information is updated; and then the model statistical information is updated according to the scanning result.
[0234] In specific implementation, the embodiment of the present application does not limit the execution order of step S180 and step S190.
[0235] From the above description, it can be seen that the present application can effectively improve the efficiency and accuracy of metamodel processing in the IDEA development environment, provide more intelligent code completion, jump and detection functions, solve the efficiency, accuracy and maintenance problems existing in the prior art in the IDEA development environment, simplify the workflow and maintenance difficulty of developers in development based on the IIDP platform, and further improve coding efficiency and code standardization.
[0236] Figure 4 FIG. 2 shows a block diagram of a metamodel processing device in an IDEA development environment according to an embodiment of the present application. Figure 4 As shown, the device may include:
[0237] The configuration unit 210 is used to initialize the metamodel enhancement plug-in in the IIDP platform and configure the dependent libraries and environment variables required by the metamodel enhancement plug-in;
[0238] Processing unit 220 is used to call the metamodel enhancement plug-in to dynamically index and synchronously update the cache of file information related to the metamodel in the current project; call the metamodel enhancement plug-in to intelligently complete, color, jump and detect the target method parameters in the metamodel, and the target method parameters refer to the method parameters annotated with custom annotations; call the metamodel enhancement plug-in to perform intelligent prompts and jump detection on the properties of the custom annotations in the metamodel; call the metamodel enhancement plug-in to generate static variables related to the model information according to the specified annotations in the metamodel, and provide intelligent completion prompts for the static variables; call the metamodel enhancement plug-in to automatically generate the get method and set method suitable for the metamodel according to the @Getter annotation and @Setter annotation on the model attributes of the metamodel; save the processed metamodel on the IIDP platform.
[0239] In one implementation, when the processing unit 220 is used to call the metamodel enhancement plug-in to dynamically index and synchronously update the cache of file information related to the metamodel in the current project, it is specifically used to:
[0240] Call the metamodel enhancement plug-in to traverse all files in the current project, and identify all files that contain metamodel definitions to obtain metamodel files;
[0241] Extract the model name, model attributes and model methods of the metamodel file to obtain file information related to the metamodel;
[0242] Cache the file information into memory and establish a target index between the file information and the meta-model;
[0243] The metamodel enhancement plug-in is called to access the metamodel according to the target index, and after the metamodel is updated, the file information cached in the memory is synchronously updated.
[0244] In one implementation, when the processing unit 220 is used to call the metamodel enhancement plug-in to perform intelligent completion, coloring, jump and detection processing on the target method parameters in the metamodel, it is specifically used to:
[0245] Call the metamodel enhancement plug-in to parse the annotation information in the target method parameters and identify the annotation type of the target method parameters;
[0246] Call the metamodel enhancement plug-in to perform syntax coloring on the target method parameters according to the annotation type;
[0247] Call the metamodel enhancement plug-in to add jump navigation function to the target method parameters;
[0248] The metamodel enhancement plug-in is called to provide intelligent completion prompts for the target method parameters and perform syntax and logic detection.
[0249] In one implementation, when the processing unit 220 is used to call the metamodel enhancement plug-in to perform intelligent prompting and jump detection processing on the custom annotations in the metamodel, it is specifically used to:
[0250] Call the metamodel enhancement plug-in to parse the custom annotation and extract the target attributes in the custom annotation;
[0251] Call the metamodel enhancement plug-in to provide intelligent completion hints for target attributes;
[0252] Call the metamodel enhancement plug-in to perform syntax coloring for the specified attributes in the target attributes and add a jump function;
[0253] Call the metamodel enhancement plug-in to perform validity detection on the specified attributes.
[0254] In one embodiment, when the processing unit 220 is used to call the metamodel enhancement plug-in to generate static variables related to the model information according to the specified annotations in the metamodel and provide intelligent completion prompts for the static variables, it is specifically used to:
[0255] Call the metamodel enhancement plug-in to parse the specified annotation and generate static variables based on the parsing results;
[0256] Call the metamodel enhancement plug-in to provide smart completion hints for static variables.
[0257] In one embodiment, when the processing unit 220 is used to call the metamodel enhancement plug-in to automatically generate a get method and a set method applicable to the metamodel according to the @Getter annotation and the @Setter annotation on the model attribute of the metamodel, it is specifically used to:
[0258] Call the metamodel enhancement plug-in to parse the @Getter annotation, obtain the attribute type and name of the @Getter annotation, and automatically generate a custom get method based on the attribute type and name of the @Getter annotation;
[0259] Call the metamodel enhancement plug-in to parse the @Setter annotation, obtain the attribute type and name of the @Getter annotation, and automatically generate a custom set method based on the attribute type and name of the @Getter annotation;
[0260] Insert the get and set methods into the corresponding model classes in the metamodel.
[0261] In one embodiment, the processing unit 220 is further used to: call the metamodel enhancement plug-in to count the total number of metamodels, model attributes and model methods for the file information related to the metamodel in the cache, and display the statistical results;
[0262] The processing unit 220 is further configured to call the meta-model enhancement plug-in to provide a user interface operation entry, wherein the user interface operation entry allows manual initiation of a scanning process for file information related to the meta-model in the scanning cache.
[0263] The functions of each unit in the metamodel processing device in the IDEA development environment of the embodiment of the present application can be found in the corresponding description in the above method, which will not be repeated here.
[0264] Figure 5 FIG. 2 shows a block diagram of a computer device according to an embodiment of the present application. Figure 5 As shown, the computer device includes: a memory 310 and a processor 320. The memory 310 stores instructions, and the instructions are loaded and executed by the processor 320 to implement the metamodel processing method in the IDEA development environment in the above embodiment. The number of the memory 310 and the processor 320 can be one or more.
[0265] The computer device also includes:
[0266] The communication interface 330 is used to communicate with external devices and perform data exchange transmission.
[0267] If the memory 310, the processor 320 and the communication interface 330 are implemented independently, the memory 310, the processor 320 and the communication interface 330 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0268] Optionally, in a specific implementation, if the memory 310, the processor 320 and the communication interface 330 are integrated on a chip, the memory 310, the processor 320 and the communication interface 330 can communicate with each other through an internal interface.
[0269] An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the method provided in the embodiment of the present application is implemented.
[0270] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in a memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.
[0271] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.
[0272] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the Advanced RISC Machines (ARM) architecture.
[0273] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM).
[0274] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0275] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0276] Any process or method description in the flow chart or otherwise described herein can be understood to represent a module, fragment or portion of a code including one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0277] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0278] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0279] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0280] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.< / person> < / string> < / operatorlog> < / operatorlog>
Claims
1. A metamodel processing method in an IDEA development environment, characterized in that: include: Initialize the metamodel enhancement plug-in in the IIDP platform, and configure the dependent libraries and environment variables required by the metamodel enhancement plug-in; Calling the metamodel enhancement plug-in to dynamically index and synchronously update cache of file information related to the metamodel in the current project; Calling the metamodel enhancement plug-in to perform intelligent completion, coloring, jump and detection processing on the target method parameters in the metamodel, wherein the target method parameters refer to the method parameters annotated with custom annotations; Calling the metamodel enhancement plug-in to perform intelligent prompting and jump detection processing on the custom annotations in the metamodel; Calling the metamodel enhancement plug-in to generate static variables related to model information according to specified annotations in the metamodel, and providing intelligent completion prompts for the static variables; Calling the metamodel enhancement plug-in to automatically generate a get method and a set method applicable to the metamodel according to the @Getter annotation and the @Setter annotation on the model attribute of the metamodel; The processed meta-model is saved on the IIDP platform.
2. The method according to claim 1, characterized in that Calling the metamodel enhancement plug-in to dynamically index and synchronously update cache of file information related to the metamodel in the current project includes: Calling the metamodel enhancement plug-in to traverse all files in the current project, and identifying files containing metamodel definitions among all the files to obtain metamodel files; Extracting the model name, model attributes and model methods of the metamodel file to obtain file information related to the metamodel; Cache the file information into a memory, and establish a target index between the file information and the meta-model; The metamodel enhancement plug-in is called to access the metamodel according to the target index, and after the metamodel is updated, the file information cached in the memory is synchronously updated.
3. The method according to claim 1, characterized in that Calling the metamodel enhancement plug-in to intelligently complete, color, jump and detect target method parameters in the metamodel includes: Calling the metamodel enhancement plug-in to parse the annotation information in the target method parameter and identify the annotation type of the target method parameter; Calling the metamodel enhancement plug-in to perform syntax coloring on the target method parameters according to the annotation type; Calling the metamodel enhancement plug-in to add a jump navigation function to the target method parameter; The metamodel enhancement plug-in is called to provide intelligent completion prompts for the target method parameters and perform syntax and logic detection processing.
4. The method according to claim 1, characterized in that: Calling the metamodel enhancement plug-in to perform intelligent prompting and jump detection processing on the custom annotations in the metamodel includes: Calling the metamodel enhancement plug-in to parse the custom annotation and extract the target attribute in the custom annotation; Calling the metamodel enhancement plug-in to provide intelligent completion prompts for the target attributes; Calling the metamodel enhancement plug-in to perform syntax coloring processing on the specified attribute in the target attribute and add a jump function; The metamodel enhancement plug-in is called to perform validity detection processing on the specified attribute.
5. The method according to claim 1, characterized in that Calling the metamodel enhancement plug-in to generate static variables related to model information according to the specified annotations in the metamodel, and providing intelligent completion prompts for the static variables includes: Calling the metamodel enhancement plug-in to parse the specified annotation, and generating the static variable according to the parsing result; The metamodel enhancement plug-in is called to provide intelligent completion prompts for the static variables.
6. The method according to claim 1, characterized in that Calling the metamodel enhancement plug-in to automatically generate a get method and a set method applicable to the metamodel according to the @Getter annotation and the @Setter annotation on the model attribute of the metamodel includes: Calling the metamodel enhancement plug-in to parse the @Getter annotation, obtaining the attribute type and name of the @Getter annotation, and automatically generating a custom get method according to the attribute type and name of the @Getter annotation; Calling the metamodel enhancement plug-in to parse the @Setter annotation, obtain the attribute type and name of the @Getter annotation, and automatically generate a custom set method according to the attribute type and name of the @Getter annotation; The get method and the set method are inserted into the corresponding model class in the metamodel.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: Calling the metamodel enhancement plug-in to count the total number of metamodels, model attributes and model methods for the file information related to the metamodel in the cache, and displaying the statistical results; The method further comprises: The meta-model enhancement plug-in is called to provide a user interface operation entry, and the user interface operation entry allows manual initiation of a scanning process for file information related to the meta-model in the scanning cache.
8. A metamodel processing device in an IDEA development environment, characterized in that: include: A configuration unit, used to initialize the metamodel enhancement plug-in in the IIDP platform and configure the dependent libraries and environment variables required by the metamodel enhancement plug-in; A processing unit, used to call the metamodel enhancement plug-in to dynamically index and synchronously update cache of file information related to the metamodel in the current project; The metamodel enhancement plug-in is called to perform intelligent completion, coloring, jump and detection processing on the target method parameters in the metamodel, wherein the target method parameters refer to the method parameters annotated with custom annotations; the metamodel enhancement plug-in is called to perform intelligent prompts and jump detection processing on the properties of the custom annotations in the metamodel; the metamodel enhancement plug-in is called to generate static variables related to the model information according to the specified annotations in the metamodel, and provide intelligent completion prompts for the static variables; the metamodel enhancement plug-in is called to automatically generate the get method and set method applicable to the metamodel according to the @Getter annotation and @Setter annotation on the model attributes of the metamodel; and the processed metamodel is saved on the IIDP platform.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on a computer, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and device for creating cloud development environment, electronic equipment and storage medium
CN116225394A
Entity object information synchronization method and device and storage medium
CN116303759A
Non-invasive interface document automatic generation method and device, equipment and medium
CN116775116A
Intelligent integrated digital platform designed to control large systems, and a method of controlling large systems
RU2693680C1
Exstensibility application programming interface and framework for meta-model objects
US20050066338A1
