CN114691092A - Plug-in generating method and device, electronic equipment and storage medium - Google Patents

Plug-in generating method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114691092A
CN114691092A CN202011592955.2A CN202011592955A CN114691092A CN 114691092 A CN114691092 A CN 114691092A CN 202011592955 A CN202011592955 A CN 202011592955A CN 114691092 A CN114691092 A CN 114691092A
Authority
CN
China
Prior art keywords
plug
file
mvp mode
generating
calling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011592955.2A
Other languages
Chinese (zh)
Inventor
刘建锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202011592955.2A priority Critical patent/CN114691092A/en
Publication of CN114691092A publication Critical patent/CN114691092A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a plug-in generating method, a plug-in generating device, an electronic device and a storage medium, belonging to the technical field of computers, wherein the method comprises the following steps: creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream, and generating MVP mode codes; and calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the calling of the plug-in. According to the method and the device, the MVP mode is introduced, the MVP mode codes are generated, the Android Studio development tool is used for generating the plug-ins, information such as file generation positions, file names and file descriptions can be flexibly configured when the plug-ins are generated by the codes, and the generated plug-ins are called to improve development efficiency.

Description

Plug-in generating method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a plug-in generation method and apparatus, an electronic device, and a storage medium.
Background
In the process of program development, a matter of writing repeated codes is often encountered, a code generation plug-in can be realized by using some templates, the template can be a text file (txt file), codes are directly added in the txt file, or codes needing to be replaced are extracted, then the template file is read through streaming, and finally a class file is generated, but if various types are written based on an MVP (Model-View-Presenter, MVP for short, a code design concept) mode, the work is very repeated and tedious.
Moreover, since most of the variable names and types of the templates are the same, the way of generating the plug-in by the code through the template is realized, and information such as the file generation position, the file name, the file description and the like cannot be configured flexibly.
Disclosure of Invention
The invention provides a plug-in generating method, a plug-in generating device, an electronic device and a storage medium, which are used for solving the problem that the code generating plug-in the prior art cannot flexibly configure information such as file generating position, file name and file description, and realizing flexible configuration of the information such as file generating position, file name and file description when the code generating plug-in.
The invention provides a plug-in generating method, which is characterized by comprising the following steps:
creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream, and generating MVP mode codes;
and calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the calling of the plug-in.
The invention provides a plug-in generating method, wherein a new template file based on an MVP mode is written with codes, and the method comprises the following steps:
dynamically replacing the placeholder of the code in the new template file;
and calling a new dialog box of the MVP mode, and receiving and inputting the name of a creator, the description of the new template file, the module name and the configuration information of the class name prefix in the new dialog box.
The invention provides a plug-in generation method, which includes the steps of calling a file of an MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the calling of a plug-in, wherein the method comprises the following steps:
calling the MVP mode code to generate a plug-in with a file name of plugin.
Receiving input basic information at the plug-in, wherein the basic information comprises one or more of the name of the file, the version of the file and description information of the file;
and calling a construction component in the MVP mode service component library to generate a Jar package, and installing the Jar package.
The invention provides a plug-in generation method, wherein the step of installing the Jar package to an Android Studio development tool to realize the calling of the plug-in comprises the following steps:
after the Jar package is installed, restarting an Android Studio development tool and calling a code menu in a functional menu bar of an MVP mode to correspondingly generate a file name of the plug-in;
receiving one or more kinds of information of creator information, file description information, module names and class name prefixes input in a popup window;
and generating a corresponding plug-in file under the related module.
The present invention also provides a plug-in generating device, including:
the plug-in code compiling module is used for creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream and generating MVP mode codes;
and the plug-in deployment module is used for calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the generation of the plug-in.
According to the plug-in generating device of the present invention, the plug-in code writing module includes:
the new template unit is used for dynamically replacing placeholders of codes in the new template file;
a dialog box generating unit, configured to invoke a new dialog box in the MVP mode, and receive, in the new dialog box, an input author name, a class description of the new template file, a name of the new template file, and configuration information of a prefix of the class name;
and the code generation unit is used for generating the MVP mode code based on the class of the new template file.
According to the plug-in generating device of the present invention, the plug-in deployment module includes:
the plug-in calling unit is used for calling the MVP mode code to generate a plug-in with a file name of plugin.xml;
a first input unit, configured to receive, at the plug-in, input basic information, where the basic information includes one or more of a name of the file, a version of the file, and description information of the file;
and the Jar package generating unit is used for calling the construction component in the service component library of the MVP mode to generate the Jar package.
According to the plug-in generating device of the present invention, the plug-in deployment module further includes:
the Jar installation unit is used for restarting the Android Studio development tool and calling a menu in a functional menu bar of an MVP mode to correspondingly generate a file name of the plug-in after the Jar package is installed;
the second input unit is used for receiving one or more kinds of input information of creator information, file description information, module names and class name prefixes in the popup window;
and the plug-in generating unit is used for generating a corresponding plug-in file under the relevant module.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of the plug-in generation method.
The invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the plug-in generation method as described in any one of the above.
According to the plug-in generation method, device, electronic equipment and storage medium, the MVP mode is introduced to generate the MVP mode codes, the Android Studio development tool is used for generating the plug-ins, information such as file generation positions, file names and file descriptions can be flexibly configured when the plug-ins are generated by the codes, and the development efficiency can be improved by calling the generated plug-ins.
Drawings
In order to more clearly illustrate the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic flow chart diagram of a plug-in generation method provided by the present invention;
FIG. 2 is a flowchart illustrating the steps provided by the present invention for writing plug-in code;
FIG. 3 is a functional block diagram of the MVP mode provided by the present invention;
FIG. 4 is a code diagram of a template Activity example provided by the present invention;
FIG. 5 is a schematic diagram of a dialog box provided by the present invention;
FIG. 6 is a diagram of MVP mode codes provided by the present invention;
FIG. 7 is a flowchart illustrating the steps provided by the present invention for deploying a plug-in;
figure 8 is a schematic diagram of a plugin.xml plug provided by the present invention;
FIG. 9 is a schematic diagram of a Build component provided by the present invention;
FIG. 10 is a schematic diagram of the generation of Jar packages provided by the present invention;
FIG. 11 is a schematic diagram of the installation Jar package provided by the present invention;
FIG. 12 is a schematic diagram of a Code menu provided by the present invention;
FIG. 13 is a schematic view of a pop-up window provided by the present invention;
FIG. 14 is a schematic diagram of generating an add-in file provided by the present invention;
FIG. 15 is a schematic structural diagram of a plug-in generating device provided by the present invention;
fig. 16 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Terms mentioned in the plug-in generation method, device, electronic device and storage medium of the present invention are described below:
the Android Studio is an Android integrated development tool introduced by google, and is based on IntelliJ idea.
The MVP (Model-View-Presenter, MVP for short) design mode is to decouple codes to achieve reusability and testability, and divides an application into three basic parts. The Model is a data providing layer and is responsible for providing data to the Presenter or providing a data processing inlet; view layer, which is responsible for receiving the Presenter notice and updating the interface; and the Presenter is a pivot layer of the View and the Model and is responsible for receiving the command of the View layer, reading and processing data from the Model layer and informing the View to update the interface.
When developing software, the first consideration is the architecture, and a good architecture can provide good expandability, and especially for team development, readability and modularization are the most important parts of the architecture. Since developing software will rely on third party libraries, the architecture should be plug-and-play, while the Android architecture contains all the features of MVP. In the Android project, Activity and Fragment occupy most development work, and MVP is specially generated for optimizing the code of Activity and Fragment.
The MVP mode has the advantages that view logic and business logic are separated, and coupling is reduced; activity only processes tasks in a life cycle, and codes become simpler; the View logic and the service logic are respectively abstracted into the interfaces of the View and the Presenter, so that the readability of the code is improved; the Presenter is abstracted into an interface, and can be realized in various concrete ways, so that unit testing is convenient to perform; the service logic is extracted into the Presenter, and memory leakage caused by the fact that the Activity resources cannot be recycled by the system due to the fact that the Activity is quoted by the background thread is avoided.
According to the plug-in generation method, device, electronic equipment and storage medium, the MVP mode is introduced to generate the MVP mode codes, the Android Studio development tool is used for generating the plug-ins, information such as file generation positions, file names and file descriptions can be flexibly configured when the plug-ins are generated by the codes, and the development efficiency can be improved by calling the generated plug-ins.
The plug-in generation method, apparatus, electronic device and storage medium according to the present invention are described below with reference to fig. 1 to 16.
Fig. 1 is a schematic flowchart of a plug-in generation method provided by the present invention, as shown in the figure. A plug-in generation method, comprising:
step 101, writing plug-in codes: and creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream, and generating MVP mode codes.
The placeholder is a symbol which firstly occupies a fixed position, waits for the symbol of the content added into the placeholder and is used for editing various documents in the computer.
Wherein the stream reading comprises four modes: byte stream reading and writing, byte buffer stream reading and writing, character stream reading and writing and character buffer stream reading and writing. Since the read and write are two different branches, they are usually used separately. For example, the stream may be cached in a buffer reader (character buffer stream read/write), and then the cached content may be obtained by a readLine (waiting for reading stream read data).
Optionally, the new template file may be a text file, such as a txt file, or may be another document type, and the new template file may be edited by a person.
Step 102, deploying plug-ins: and calling the file of the MVP mode code, generating a Jar (English: Java Archive, Chinese: Java Archive file, Jar is a software package file format) package, and installing the Jar package to an Android Studio development tool to realize the calling of the plug-in.
Optionally, the generated plug-in may be deployed to the Android Studio to be used, that is, the plug-in may be called to generate a code.
In summary, the plug-in of the MVP mode code can be generated based on the Android Studio development tool, the code details of the plug-in can be written by different people for different business logics, so that repetitive work can be avoided, and the development efficiency can be improved.
The steps of the plug-in generation method according to the present invention will be described below with respect to specific embodiments.
FIG. 2 is a flowchart of the steps provided by the present invention for writing plug-in code, as shown. The creating of the template file based on the MVP mode and the writing of the codes in the created template file comprise the following steps:
step 201, dynamically replacing the placeholder of the code in the new template file.
Optionally, the placeholder may be one or more characters of $ packagename, $ packagePrefix, $ author, $ description, $ date, $ classpfix, and the placeholder may also be named as other characters for contrasting and replacing the codes.
Optionally, an overall framework is written according to an MVP mode of the project, where the MVP mode is packaged according to functional modules, and includes functional modules such as Activity, Fragment, Presenter, and contact, as shown in fig. 3. It should be noted that the MVP mode is a code design concept, which facilitates code decoupling and improves code maintainability.
Optionally, Template shows Template activity.
Taking the template activity.txt as an example, the internal details of the template activity.txt file are shown in fig. 4. One or more of the $ packagename, $ packagePrefix, $ author, $ description, $ date, $ classPrefix characters in the code shown in FIG. 4 may be dynamically replaced. The specific code details of the newly-built template are checked in the source codes at the end of the document, and new codes can be written in according to actual needs.
Step 202, invoking the new dialog box of the MVP mode, and receiving the name of the creator, the description of the new template file, the module name, the class name prefix, and other configuration information in the new dialog box.
Optionally, the new dialog box may be a dialog component in a service component library of the MVP mode. The dialog component is used for informing the user of the content needing to be filled in.
Optionally, when the new template is completed, a dialog box (as shown in fig. 5) is called, and the name, description, module name, class name prefix, and other configuration information of the creator are input into the dialog box. Wherein the module name represents a code generation location. The invention can analyze the naming list in the item to obtain the package name by appointing the standard code writing rule, thereby determining the position of the file generation.
And then, generating the MVP mode code based on the class of the new template file.
Optionally, the automatic generation of the Code is implemented based on the MVP _ Template _ Code _ GenerateAction class (as shown in fig. 6). The code indicated by the arrow in fig. 6 indicates a file specifying a code template, reading the template file in the form of a stream, replacing dynamic characters in the template file, and generating a corresponding folder and file according to path information input from a pop-up box. Such an MVP mode code generation plug-in is completed and the following description is made of the steps of how to deploy the plug-in.
FIG. 7 is a flowchart illustrating the steps provided by the present invention for deploying a plug-in, as shown. The calling of the file of the MVP mode code generates a Jar package, and the Jar package is installed to an Android Studio development tool to realize the calling of the plug-in, and the calling comprises the following steps:
in step 701, the MVP mode code is called to generate a plug-in with a file name of plugin. xml (see the block shown in fig. 8).
Optionally, the plugin.xml plug-in is automatically generated by a development tool, and is used for adding the description information of the plugin.xml plug-in.
Step 702, receiving the input basic information at the plug-in, where the basic information includes one or more of the name of the file, the version of the file, and the description information of the file.
As shown in fig. 8, the basic information filled in, such as name, version, description, etc., will see its profile when the plug-in is installed.
Step 703, calling a building component in the service component library of the MVP mode to generate a Jar package, and installing the Jar package.
Optionally, the building component is a Build component in a service component library of the MVP mode.
Optionally, clicking the Build- > Prepare plug Module 'MvpCreate' For Deployment unit (as shown in fig. 9) generates a Jar package (mvpcodeautomatically plug. Jar as shown in fig. 10) in the root directory of the project, and the Jar package is retrieved to be installed in the Android Studio development tool.
And 704, after the Jar package is installed, restarting an Android Studio development tool and calling a code menu in a function menu bar of an MVP mode to correspondingly generate a file name of the plug-in.
Alternatively, the Code menu may be a Code menu in a function menu bar of the MVP mode.
Optionally, as shown in fig. 11, the Android Studio development tool is opened, File- > Setting- > plugs- > instrumentation plug from disk is selected, and then the generated Jar package is selected, so that the Jar package can be installed.
After the installation, the restart Studio can be used, and after the restart, the MVP _ Template _ Code Generation option is added under the Code menu, and the call is clicked (as shown in FIG. 12).
Step 705, receiving one or more kinds of information of creator information, file description information, module name and class name prefix input in the popup.
Optionally, when the MVP _ Template _ Code generation menu shown in fig. 12 is clicked, a popup appears, and relevant information is filled in the popup (as shown in fig. 13), where the filled relevant information includes creator information, file description information, a module name, a class name prefix, and other information.
At step 706, a corresponding plug-in file is generated under the relevant module (as shown in FIG. 14). And corresponding codes can be generated through the plug-in by calling the plug-in file later, so that the software development efficiency is improved.
In summary, the plug-in generation method of the present invention can flexibly configure information such as the file generation location, the file name, and the file description, and support the subsequent function extension.
The plug-in generating device provided by the invention is described below, and the plug-in generating device described below and the plug-in generating method described above can be referred to correspondingly.
Fig. 15 is a schematic structural diagram of an electronic device provided in the present invention, as shown in the figure. A plug-in generating apparatus 150 includes a write plug-in code module 151 and a deploy plug-in module 152.
The plug-in code writing module 151 is configured to create a template file based on an MVP mode, write codes into the created template file or set placeholders at positions where the codes need to be replaced, read the created template file through a file stream, and generate MVP mode codes.
And the plug-in deployment module 152 is configured to call the file of the MVP mode code, generate a Jar package, and install the Jar package to an Android Studio development tool to generate the plug-in.
Optionally, the plug-in code writing module 151 includes a new template creation unit 1511, a dialog generation unit 1512, and a code generation unit 1513.
And a new template unit 1511, configured to dynamically replace the placeholder of the code in the new template file.
Optionally, the placeholder may be one or more characters of $ packagename, $ packagePrefix, $ author, $ description, $ date, $ classPrefix.
A dialog box generating unit 1512, configured to invoke a new dialog box in the MVP mode, and receive, in the new dialog box, an input author name, a class description of the new template file, a name of the new template file, and configuration information of a prefix of the class name.
Optionally, the new dialog box may be a dialog component in a service component library of the MVP mode.
A code generating unit 1513, configured to generate the MVP mode code based on the class of the new template file.
Optionally, the deployment plug-in module 152 includes a plug-in calling unit 1521, a first input unit 1522, a Jar package generating unit 1523, a Jar package installing unit 1524, a second input unit 1525, and a plug-in generating unit 1526.
A plug-in calling unit 1521, configured to call a plug-in with a file name of plug in.
A first input unit 1522, configured to receive, at the plug-in, input basic information, where the basic information includes one or more of a name of the file, a version of the file, and description information of the file.
A Jar package generating unit 1523, configured to invoke a building component in the service component library in the MVP mode to generate a Jar package.
Optionally, the building component may be a Build component in a service component library of the MVP mode.
The Jar package installation unit 1524 is configured to restart the Android Studio development tool and call a code menu in the functional menu bar in the MVP mode to generate a file name of the plug-in correspondingly after the Jar package is installed.
Alternatively, the Code menu may be a Code menu in a function menu bar of the MVP mode.
A second input unit 1525, configured to receive, in the popup, one or more types of information input, such as creator information, file description information, a module name, and a class name prefix.
A plug-in generating unit 1526, configured to generate a corresponding plug-in file under the relevant module.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first input unit may be referred to as a second input unit, and similarly, a second input unit may be referred to as a first input unit, without departing from the scope of the present application.
In summary, the MVP mode is introduced to generate the MVP mode code, and the Android Studio development tool is used to generate the plug-in, so that information such as a file generation position, a file name, a file description and the like can be flexibly configured when the plug-in is generated by the code, and the generated plug-in is called to improve the development efficiency.
Fig. 16 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 16: a processor (processor)1610, a communication Interface (Communications Interface)1620, a memory (memory)1630 and a communication bus 1640, wherein the processor 1610, the communication Interface 1620 and the memory 1630 communicate with each other via the communication bus 1640. Processor 1610 may invoke logic instructions in memory 1630 to perform the steps of a plug-in generation method comprising:
writing plug-in codes: creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream, and generating MVP mode codes;
deploying the plug-in: and calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the calling of the plug-in.
In addition, the logic instructions in the memory 1630 may be implemented in software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the steps of the plug-in generation method provided by the above methods, the method comprising:
writing plug-in codes: creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream, and generating MVP mode codes;
deploying the plug-in: and calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the calling of the plug-in.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the steps of the plug-in generation method provided above, the method comprising:
writing plug-in codes: creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream, and generating MVP mode codes;
deploying the plug-in: and calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the calling of the plug-in.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A plug-in generation method, comprising:
creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream, and generating MVP mode codes;
and calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the calling of the plug-in.
2. The plug-in generation method according to claim 1, wherein the creating a template file based on the MVP mode, and writing a code in the creating template file, comprises:
dynamically replacing the placeholder of the code in the new template file;
and calling a new dialog box of the MVP mode, and receiving and inputting the name of a creator, the description of the new template file, the module name and the configuration information of the class name prefix in the new dialog box.
3. The plug-in generation method according to claim 1, wherein the calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to implement the calling of the plug-in includes:
calling the MVP mode code to generate a plug-in with a file name of plug in.
Receiving input basic information at the plug-in, wherein the basic information comprises one or more of the name of the file, the version of the file and description information of the file;
and calling a construction component in the MVP mode service component library to generate a Jar package, and installing the Jar package.
4. The plug-in generation method according to claim 3, wherein the installing the Jar package to the Android Studio development tool to realize the calling of the plug-in comprises:
after the Jar package is installed, restarting an Android Studio development tool and calling a code menu in a functional menu bar of an MVP mode to correspondingly generate a file name of the plug-in;
receiving one or more kinds of input information of creator information, file description information, module name and class name prefix in a popup window;
and generating a corresponding plug-in file under the related module.
5. An apparatus for generating a plug-in, comprising:
the plug-in code compiling module is used for creating a template file based on an MVP mode, writing codes into the created template file or setting placeholders at positions where the codes need to be replaced, reading the created template file through a file stream and generating MVP mode codes;
and the plug-in deployment module is used for calling the file of the MVP mode code, generating a Jar package, and installing the Jar package to an Android Studio development tool to realize the generation of the plug-in.
6. The plug-in generation apparatus according to claim 5, wherein the writing of the plug-in code module includes:
the new template unit is used for dynamically replacing placeholders of codes in the new template file;
a dialog box generating unit, configured to invoke a new dialog box in the MVP mode, and receive, in the new dialog box, an input author name, a class description of the new template file, a name of the new template file, and configuration information of a prefix of the class name;
and the code generation unit is used for generating the MVP mode code based on the class of the new template file.
7. The plug-in generation apparatus according to claim 5, wherein the deployment plug-in module comprises:
the plug-in calling unit is used for calling the MVP mode code to generate a plug-in with a file name of plugin.xml;
a first input unit, configured to receive, at the plug-in, input basic information, where the basic information includes one or more of a name of the file, a version of the file, and description information of the file;
and the Jar package generating unit is used for calling the construction components in the service component library of the MVP mode to generate the Jar package.
8. The plug-in generation apparatus according to claim 5, wherein the deployment plug-in module further comprises:
the Java application server comprises a Jar installation unit, a file name generation unit and a file name generation unit, wherein the Jar installation unit is used for restarting an Android Studio development tool and calling a code menu in a function menu bar of an MVP mode to correspondingly generate a file name of a plug-in after the Jar package is installed;
the second input unit is used for receiving one or more kinds of input information of creator information, file description information, module names and class name prefixes in the popup window;
and the plug-in generating unit is used for generating a corresponding plug-in file under the relevant module.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the plug-in generation method according to any one of claims 1 to 4 are implemented when the processor executes the program.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the plug-in generation method according to any one of claims 1 to 4.
CN202011592955.2A 2020-12-29 2020-12-29 Plug-in generating method and device, electronic equipment and storage medium Pending CN114691092A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011592955.2A CN114691092A (en) 2020-12-29 2020-12-29 Plug-in generating method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011592955.2A CN114691092A (en) 2020-12-29 2020-12-29 Plug-in generating method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114691092A true CN114691092A (en) 2022-07-01

Family

ID=82132571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011592955.2A Pending CN114691092A (en) 2020-12-29 2020-12-29 Plug-in generating method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114691092A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110055800A1 (en) * 2009-08-31 2011-03-03 Sybase, Inc. Extensible Template-Based Code Generator Builder
US20110265061A1 (en) * 2010-04-27 2011-10-27 Verizon Patent And Licensing Inc. Code generation
US20160078539A1 (en) * 2014-09-15 2016-03-17 Aesthetic Integration Limited System and method for modeling and verifying financial trading platforms
CN109799979A (en) * 2019-04-01 2019-05-24 北京邮电大学 A kind of educational product operation management method based on wechat community
CN110688145A (en) * 2019-09-10 2020-01-14 中国平安财产保险股份有限公司 Android MVP code automatic generation method, device, medium and electronic equipment
CN111309404A (en) * 2019-12-19 2020-06-19 上海金融期货信息技术有限公司 System operation method of client framework

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110055800A1 (en) * 2009-08-31 2011-03-03 Sybase, Inc. Extensible Template-Based Code Generator Builder
US20110265061A1 (en) * 2010-04-27 2011-10-27 Verizon Patent And Licensing Inc. Code generation
US20160078539A1 (en) * 2014-09-15 2016-03-17 Aesthetic Integration Limited System and method for modeling and verifying financial trading platforms
CN109799979A (en) * 2019-04-01 2019-05-24 北京邮电大学 A kind of educational product operation management method based on wechat community
CN110688145A (en) * 2019-09-10 2020-01-14 中国平安财产保险股份有限公司 Android MVP code automatic generation method, device, medium and electronic equipment
CN111309404A (en) * 2019-12-19 2020-06-19 上海金融期货信息技术有限公司 System operation method of client framework

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
卧水莱藤: "用IntelliJ IDEA开发Android Studio中生成MVP框架的插件", Retrieved from the Internet <URL:https://www.jianshu.com/p/4adc3eed9a60> *
张ZX: "Android Studio插件开发 MVP框架代码生成插件", Retrieved from the Internet <URL:https://blog.csdn.net/fengdezhudi/article/details/53584497> *
番茄焖西红柿: "Android Studio开发快速创建MVP框架插件", Retrieved from the Internet <URL:https://www.jianshu.com/p/1dfda463fd4e> *

Similar Documents

Publication Publication Date Title
CN111241454B (en) Method, system and device for generating webpage codes
US11429365B2 (en) Systems and methods for automated retrofitting of customized code objects
US20060265469A1 (en) XML based scripting framework, and methods of providing automated interactions with remote systems
CN106775744B (en) Method and device for generating static library
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
US20170220613A1 (en) Systems and methods for database orientation transformation
CN110673923A (en) XWIKI system configuration method, system and computer equipment
CN111158687B (en) Interface generation method and device of JAVA plugin, computer equipment and storage medium
CN110688145B (en) Android MVP code automatic generation method and device, medium and electronic equipment
CN105589959A (en) Form processing method and form processing system
CN113553035A (en) Design and construction method of universal front-end UI component library
CN116301951A (en) Micro-service application installation upgrading method and device based on kubernetes
CN112835568A (en) Project construction method and device
CN113835691B (en) IOS application development method, system, device, medium and program product
CN111367512B (en) Method and device for creating Android library module dependency relationship in application development
CN115543440A (en) Method for migrating android project to android-like system, electronic equipment and storage medium
CN112631563A (en) System development method and device based on framework, computer equipment and storage medium
CN114691092A (en) Plug-in generating method and device, electronic equipment and storage medium
CN113641594B (en) Cross-terminal automatic testing method and related device
CN115407971A (en) Software product generation method and device
CN113641351A (en) Method for completing front-end foundation function building of one-key type scaffold
CN114741296A (en) Unit testing method, unit testing device, electronic equipment and storage medium
CN114115982A (en) Code issuing method, device, equipment and storage medium
CN108762745B (en) Service script generation method and device
CN105183491A (en) Cross-platform desktop GIS and starting method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination