[go: up one dir, main page]

CN114327400B - An agile development method and medium based on java dynamic agent - Google Patents

An agile development method and medium based on java dynamic agent Download PDF

Info

Publication number
CN114327400B
CN114327400B CN202111521213.5A CN202111521213A CN114327400B CN 114327400 B CN114327400 B CN 114327400B CN 202111521213 A CN202111521213 A CN 202111521213A CN 114327400 B CN114327400 B CN 114327400B
Authority
CN
China
Prior art keywords
class
java
partner
dynamic proxy
dynamic
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.)
Active
Application number
CN202111521213.5A
Other languages
Chinese (zh)
Other versions
CN114327400A (en
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.)
Agricultural Bank of China Shanghai Branch
Original Assignee
Agricultural Bank of China Shanghai Branch
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 Agricultural Bank of China Shanghai Branch filed Critical Agricultural Bank of China Shanghai Branch
Priority to CN202111521213.5A priority Critical patent/CN114327400B/en
Publication of CN114327400A publication Critical patent/CN114327400A/en
Application granted granted Critical
Publication of CN114327400B publication Critical patent/CN114327400B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

本发明涉及一种基于java动态代理的敏捷开发方法及介质,所述敏捷开发方法基于用于合作方业务配置动态代理类代码字符串接受、存储和编译的编译程序模块,以及用于根据合作方业务配置动态代理类调用业务委托类实现合作方业务落地的调用程序模块;所述编译程序模块由JavaCompiler.CompilationTask实例来执行合作方业务配置动态代理类的编译任务;所述调用程序模块执行以下步骤:基于Java动态代理InvocationHandler接口中的invoke方法根据合作方业务配置动态代理类调用业务委托类实现合作方业务落地。有益效果是适配高低版本java、执行效率与原生java代码一致、易于维护代码、实现业务快速落地。

The present invention relates to an agile development method and medium based on java dynamic proxy, the agile development method is based on a compiler module for accepting, storing and compiling a code string of a partner business configuration dynamic proxy class, and a caller module for calling a business delegation class according to the partner business configuration dynamic proxy class to implement the partner business landing; the compiler module uses a JavaCompiler.CompilationTask instance to execute the compilation task of the partner business configuration dynamic proxy class; the caller module performs the following steps: based on the invoke method in the Java dynamic proxy InvocationHandler interface, the business delegation class is called according to the partner business configuration dynamic proxy class to implement the partner business landing. The beneficial effects are that it is adaptable to high and low versions of java, the execution efficiency is consistent with the native java code, the code is easy to maintain, and the business is quickly implemented.

Description

Agile development method and medium based on java dynamic agent
[ Field of technology ]
The invention relates to the technical field of computer software, in particular to an agile development method and medium based on java dynamic proxy.
[ Background Art ]
The existing internal network agile front-end system of the bank and the similar network agile front-end system based on the open code platform have the defects of difficult code maintenance, complex change and long maintenance time consumption. The security verification is weak in the process, and the client can not adapt to the Internet environment, so that the client can trust efficiently.
The Chinese agricultural banking requires that the branches optimize the front-end scene customer acquisition channel of the 'network straggle' (quick e-credit of the help industry, the same as the quick e-credit of the help industry), realize the functions of on-line customer acquisition, pre-credit, and the like, and the customers log in the loan application interface of the agricultural embedded third party platform, and the branches realize the functions of automatic investigation, examination and approval, feedback, white list introduction of the 'network straggle' of the pre-credit. For this service, as a branch, on the premise that the headquarter system provides a final import pre-trust white list and a credit inquiry interface, a quick response needs to be performed on the access of the service in a scene. After the development of the branch system main body is finished, the access partner mainly needs to add different configurations of the partners to the system white list and the trust formula.
Under the situation that the system, the change and the safety management are more and more strict, common software change is required to start from a demand stage, and developers need to execute design, coding, unit test, system test, regression test, on-line production, special care and the like. Because the personnel of the business strip do not have time or are not technology-free, the functional modules required by the cooperators cannot be directly configured through the management end, and the developers are required to carry out simple design, coding and unit test. Therefore, an access flow after unit test is omitted for a developer, and the service can be quickly landed.
The existing mainstream dynamic languages, such as groovy (script language based on JVM) have a certain learning cost, JEP (java EXPRESSION PARSER) can only realize simple formulas and cannot realize complex function call logic for low-version java, or can realize operation on functions in SQL (structured query language), but valuable database link resources are consumed, and SCRIPTENGINEMANAGER provided in high-version java is lower in efficiency than native when running Python and is more than doubled in efficiency when running JS.
The agile development takes the evolution of the user's demands as the core, and adopts an iterative and progressive method to develop software. In agile development, a software project is split into a plurality of sub-projects at the initial stage of construction, and the results of all the sub-projects are tested, so that the method has the characteristics of visibility, integration and operation. In other words, a large item is divided into a plurality of small items which are connected with each other but can be independently operated, and the small items are respectively completed, and the software is always in a usable state in the process.
The API (Application Programming Interface ) in java is a number of predefined functions that are designed to provide the application and developer the ability to access a set of routines based on some software or hardware without having to access source code or understand the details of the internal operating mechanism. The SPI mechanism in java, SPI is totally called Service Provider Interface, is a service providing discovery mechanism built in JDK, in short, is a dynamic replacement discovery mechanism, and is actually a dynamic loading mechanism realized by combining interface-based programming, strategy mode and configuration file.
The proxy mode is a commonly used java design mode and is characterized in that the proxy class has the same interface as the proxy class, and is mainly responsible for preprocessing messages for the proxy class, filtering the messages, forwarding the messages to the proxy class, post-processing the messages and the like. There is typically an association between proxy classes and delegate classes, where the object of one proxy class is associated with the object of one delegate class, which itself does not actually implement the service, but rather provides a specific service by invoking a related method of the object of the delegate class. In short, the real object is accessed through the proxy object, and the proxy mode introduces a certain degree of indirection when the real object is accessed, so that multiple purposes can be added to the indirection. According to the point in time of creating the proxy class, it is classified into a static proxy and a dynamic proxy. The key points of the realization of the dynamic Proxy in Java are Proxy and InvocationHandler, wherein InvocationHandler is to realize the dynamic Proxy by an invoke method in a InvocationHandler interface.
The invention provides a technical improvement on an agile development method for realizing rapid landing of a service based on a java dynamic proxy.
[ Invention ]
The invention aims to provide a quick development method which is adaptive to high-low version java, has the execution efficiency consistent with that of native java codes, is easy to maintain codes and realizes quick landing of services.
In order to achieve the above purpose, the technical scheme adopted by the invention is that the quick development method based on java dynamic proxy is based on a compiler module for receiving, storing and compiling a dynamic proxy class code character string for the service configuration of a partner and a calling program module for calling the service delegation class according to the service configuration of the partner to realize the landing of the service of the partner, wherein the compiler module executes the following steps:
S1, acquiring a java compiler JavaCompiler;
s2, acquiring a standard java file manager StandardJavaFileManager;
S3, initializing a custom java file manager MyForwardingJavaFileManager, receiving STANDARDFILEMANAGER objects as parameters through a constructor, and packaging a custom class file object ClassJavaFileObject for receiving dynamic proxy class code strings of partner service configuration;
S4, initializing a custom java source file object MySimpleJavaFileObject, which is used for storing a dynamic proxy class code character string of partner service configuration to the java source file;
S5, receiving and storing a dynamic proxy class code string of the business configuration of the partner based on the user-defined java source file object MySimpleJavaFileObject and the user-defined java file manager MyForwardingJavaFileManager;
s6, acquiring a JavaCompiler. Compactiontask example from the JavaCompiler examples;
S7, executing the compiling task of the dynamic proxy class of the partner service configuration obtained in the step S5 by the Java compiler. Compiling task instance;
The caller module performs the steps of:
S8, extracting a dynamic proxy class code string of the service configuration of the partner based on the self-defined java source file object MySimpleJavaFileObject and the self-defined java file manager MyForwardingJavaFileManager according to the scene number of the partner;
s9, initializing a custom class loader MyClassLoader;
s10, loading a dynamic proxy class for partner service configuration based on a custom class loader MyClassLoader, wherein the class name is consistent with the dynamic proxy class name transmitted by the partner;
S11, calling a service delegation class according to a dynamic proxy class of the service configuration of the partner based on an invoke method in a Java dynamic proxy InvocationHandler interface to realize the service landing of the partner.
Preferably, the dynamic proxy class code string of the service configuration of the partner obtained in the step S5 comprises a program code string for realizing the landing of the service of the partner based on the service delegation class, and the step S11 calls the program for realizing the landing of the service of the partner based on the service delegation class.
Preferably, the dynamic proxy class for the business configuration of the partner refers to a dynamic proxy class for loan credit according to customer information provided by the partner in a bank express e-credit front-end system, or a dynamic proxy class for programming examination according to the identities of competitors provided by the partner in a programming large-scale competition system, or a dynamic proxy class for arranging operation according to the identities of students provided by the partner in an education system of java training direction.
Preferably, the step S3 custom Java file manager MyForwardingJavaFileManager inherits the parent class ForwardingJavaFileManager, encapsulates an attribute classJavaFileObject of ClassJavaFileObject custom class file type, encapsulates a getClassJavaFileObject method for external calling classJavaFileObject attribute, and returns the custom class file object.
Preferably, step S4 self-defines a java source file class MySimpleJavaFileObject, inherits a parent class SimpleJavaFileObject class, encapsulates a source file content attribute, calls a construction function of the self-defined java source file class MySimpleJavaFileObject, calls a construction function of the parent class SimpleJavaFileObject, assigns a dynamic code character string to a parameter content attribute, rewrites a getCharContent method of the parent class, returns the content character string, and inputs the dynamic code character string by calling the construction function of the self-defined java source file class MySimpleJavaFileObject externally.
Preferably, step S3 self-defines class file type ClassJavaFileObject, inherits parent class SimpleJavaFileObject, encapsulates a ByteArrayOutputStream type byte array output stream, creates a byte array buffer in memory, stores all data sent to the byte array output stream in the byte array buffer, calls the construction function of parent class when calling the construction function of self-defined class file type ClassJavaFileObject, initializes a ByteArrayOutputStream object byte array output stream, and rewrites the openOutputStream method in parent class to return ByteArrayOutputStream object byte array output stream for step S10 self-defining class loader MyClassLoader call.
Preferably, step S9 custom class loader MyClassLoader inherits the parent class ClassLoader, encapsulates a custom class file type ClassJavaFileObject, and assigns parameters to custom class file type attributes when invoking the construction method of custom class loader MyClassLoader.
Preferably, the dynamic class code-based management end program module accepts and manages the partner scene number, the partner service configuration dynamic proxy class code string, and the data required by service configuration.
Preferably, the dynamic class code manager module is based on vue software frameworks.
The invention further aims to provide an agile development medium which is adaptive to java with high and low versions, has the execution efficiency consistent with that of native java codes, is easy to maintain the codes and realizes quick landing of services.
In order to achieve the above object, the present invention provides a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a agile development method based on java dynamic proxy as described above.
The quick development method and medium based on the java dynamic agent have the advantages that 1, the difficulty in maintenance of codes is solved, under the condition that an external partner is continuously accessed, the class or method related to the access is updated, through configuration, the code character string can be called after being compiled once by a management end, the access process is not changed to be completed efficiently, the access of the partner can be completed without intervention of original developers, 2, the maintenance of the codes can be completed without being limited to IDE (integrated development environment IDE, INTEGRATED DEVELOPMENT ENVIRONMENT), the code can be changed by a login management end through a webpage editor, the regression test workload required by the change of a traditional system is greatly reduced, and 3, the method is particularly suitable for application of a bank quick e credit front-end system (a credit giving function according to client data provided by the partner), a programming large-scale system (a function of carrying out examination according to the identity of a participant provided by the partner), an education system in the java training direction (a function of arranging the education system according to the identity of the participant provided by the partner) and the like because the class file compiled by dynamic coding is not required by a server end.
[ Description of the drawings ]
FIG. 1 is a flow chart of a fast e-credit front-end system business.
Fig. 2 is a flowchart of an agile development method for realizing rapid landing of a partner service based on a java dynamic proxy.
[ Detailed description ] of the invention
The invention is further described below with reference to examples and with reference to the accompanying drawings.
Examples
The quick development method for realizing quick landing of the partner service based on the java dynamic proxy is applied to quick development of a quick e-credit front-end system.
FIG. 1 is a flow chart of a fast e-credit front-end system business. As shown in fig. 1, the quick development method for realizing quick landing of the business of the partner based on the java dynamic proxy in the embodiment has the main functions of receiving and storing loan client information and image information pushed by the partner of the fast e-loan, wherein the position in the front-end system of the fast e-loan is positioned in a thick line box. For the fast e-credit service, on the premise that the head office system provides a final lead-in pre-credit white list and a credit inquiry interface, each branch needs to respond quickly to the access of the scene service. After the development of the main body of each branch quick e-credit front-end system is finished, different configurations of each partner are added to the system white list and the credit formula two modules when the partner software is accessed. In general, because the personnel of the business strip line does not have time or is not technology-free, the functional modules required by the cooperators cannot be directly configured through the management end, and the developers are required to carry out simple design, coding and unit test.
The quick development method for realizing quick landing of the partner service based on the java dynamic proxy is used for adding different configurations of each partner to a system white list and a trust formula when the partner software is accessed, the execution efficiency is consistent with that of the original java code, the code character string can be called in the system after once compiled by a management end through configuration, and the quick landing of the quick e-credit service can be realized by omitting the access flow of simple design, coding and unit test when the partner software is accessed to add different configurations of each partner to the system white list and the trust formula after unit test for a developer.
Fig. 2 is a flowchart of an agile development method for realizing rapid landing of a partner service based on a java dynamic proxy. As shown in FIG. 2, the text description of the quick development method for realizing quick landing of a partner service based on a java dynamic proxy is as follows, a java compiler JavaCompiler is acquired, a customized java file manager MyForwardingJavaFileManager is acquired, a customized java file object MySimpleJavaFileObject is acquired, then a Java compiler/complextask instance can be acquired from the instance JavaCompiler, and then the corresponding compiling task is executed by the Java compiler/complextask instance, and the execution process is a concurrent process. After the compiling task is executed, loading the compiled class Object, obtaining a method Object, executing the method, and obtaining a returned Object of the method. Since the object is then used to splice xml messages, there is no need to translate the object type. Other flows may be performed as needed to convert the returned objects to the desired type as needed.
The core dynamic agent type configuration function of the agile development method for realizing rapid landing of partner service based on the java dynamic agent in the embodiment comprises the following program modules:
program module 0 System white list and trust formula
As shown in figure 1, the quick development method for realizing quick landing of the business of the partner based on the java dynamic proxy is implemented, after receiving the client data message sent by the server of the partner, the quick development method enters a system white list module to judge whether the partner meets the admission condition.
The system white list refers to a partner scene white list, and each scene has the following characteristics:
1. the scene numbers of the cooperators are 01-99 used for distinguishing different scenes corresponding to the cooperators, one cooperator can use a plurality of scene numbers to call different credit giving formulas, multi-IP admittance and call back each cooperator notification service.
2. The partner IP white list array is composed of a plurality of source IP addresses of a partner. When a message is received, finding out the IP white list through the scene number, returning to refuse access if the IP white list is not in the white list.
3. The following code string CLASSSTRING is a trust formula code string of a certain automobile decoration partner.
private static String classString2=
"import java.text.DecimalFormat;import work.formula.LoanModelDAO;"
+"public class LoanModel123{"
+"public String do04(LoanModelDAO loanModelDAO){"
+"DecimalFormat decimalFormat=new DecimalFormat(\"#\");"
+"Double bankPerAmount=null;"
+"Double lastHalfYearMonthOrder=loanModelDAO.getRentSalePer();"
+"Double lastYearMonthOrder=loanModelDAO.getYearSaleIncome();"
+"if(lastHalfYearMonthOrder>=lastYearMonthOrder){"
+"bankPerAmount=loanModelDAO.getRentSalePer()*12*2*0.1;"
+"return decimalFormat.format(bankPerAmount);"
+"}"
+"else{"
+"return\"eeee\";"
+"}"
+"}"
+"}";
The trust formula class code character string CLASSSTRING is used for finding trust formula class code character strings corresponding to different scenes through scene numbers when receiving client data messages sent by the partner server. This formula class is the core-dynamic proxy class of this embodiment. The dynamic proxy class is not compiled simultaneously with other classes of the system, but is configured as a character string by using a management end, and the dynamic compiling is realized through the embodiment.
The function of the code string CLASSSTRING of the credit formula class obtains the pre-credit data field through the credit data entity class, and calculates and obtains the branch credit limit by taking the code string CLASSSTRING as an example, firstly initializing a digital format tool DecimalFormat decimalFormat and defining the data format as reserved to an integer. The data of the client's' last half year and month average order total amount lastHalfYearMonthOrder 'is taken from the LoanModelDAO trusted data entity class mentioned below, and the data of the client's 'last year and month average income lastYearMonthOrder' is taken. If monthly order amount is greater than or equal to the average income of months, reporting errors are directly returned to the cooperator, and the client does not accord with the admission condition. And on the contrary, the income of the last year and month is multiplied by 12 (month) and multiplied by 2 (coefficient 1) and multiplied by 0.1 (coefficient 2) to obtain the branch credit line, and the integer obtained by formatting the branch credit line is returned.
The method do04 in the class carries out loan according to the client data, and the trusted data entity class of the parameter object, namely the entrusted class is as follows:
the trust data entity class (entrusting class) acts that unified parameter types, namely trust data entity class (entrusting class) -LoanModelDAO class, are specified to be used in trust formula class code strings (dynamic agent class) of all the cooperators.
And the trusted data entity class (entrusting class) functions that the LoanModelDAO class processes pre-trusted data fields contained in the client data message sent by the partner server as shown by the trusted data entity class (entrusting class) codes. All cooperator trust formulas are not limited to the following fields:
1. private Double rentSalePer;// pre-trust condition data 1
2. Private Double yearSaleIncome,// income from last year and month
3. Private Double monthRent;// pre-trust condition data 2
4. Private Double custCreditAmount;// customer desired amount
5. Private Double loanPeriod;// loan period (month)
6. PRIVATE STRING PARTNERNAME;// partner scene code
The pre-trust condition data 1 comprises data types such as lease rate, monthly order amount in the last half year, and the like
The pre-trust condition data 2 comprises data types such as monthly rent, sales of a month-even store, and the like
These two fields are flexible. Different categories can be input according to different scenes, but the earlier stage and the cooperation party are required to be consistent, and what the category of the data is determined. The calculation mode is determined by the code string of the trust formula class (dynamic proxy class).
The construction method defines the flow of processing the pre-trust data fields in the message transmitted from the partner, wherein the value of each field is obtained from the map object, and if the value is null or null, the value is assigned to be 0. Redefining setter, getter method facilitates modifying and retrieving these pre-trusted data when invoked from outside. The dynamic class mainly uses getter method to obtain the trust data needed by the respective formulas.
And calling back a service address URL of the partner to inform the partner of the pre-credit line obtained by the client.
Program module 1 compiling a java code string
JavaCompiler is an interface for calling a Java programming language compiler from a program.
The compiler may generate diagnostic information (e.g., error messages) during compilation. If a diagnostic listener is provided, then diagnostics will be provided to the listener. If no listener is provided, the diagnostics will be formatted in an unspecified format and written to the default output, system. Even if a diagnostic listener is provided, some diagnostics may not fit into the diagnostics and will write to the default output.
The compiler tool has an associated standard file manager that is the tool's native (or built-in) file manager. The standard file manager may be obtained by call GETSTANDARDFILEMANAGER.
The compiler tool must be used with any file manager as long as any other requirements detailed in the methods below are met. If no file manager is provided, the compiler tool will use a standard file manager, such as the file manager returned by GETSTANDARDFILEMANAGER.
Instances implementing this interface must conform to the Java language specification and generate class files that conform to the Java virtual machine specification. Versions of these specifications are defined in the tool interface. In addition, an instance of this interface supporting sourceVersion. RELEASE_6 or higher must also support annotation processing.
The compiler relies on two services, a diagnostic listener and a file manager. While most classes and interfaces in this package define APIs for compilers (and general tools), interfaces DiagnosticListener, javaFileManager, fileObject and JavaFileObject are not intended for use in applications. Rather, these interfaces are intended to be implemented and used to provide custom services for the compiler, defining the SPI for the compiler.
There are many classes and interfaces in this package that aim to simplify the implementation of SPI to customize compiler behavior-StandardJavaFileManager each compiler implementing this interface provides a standard file manager to manipulate regular files. The StandardJavaFileManager interface defines other methods for creating file objects from regular files.
The code is as follows:
Interval/acquisition java compiler
JavaCompiler compiler=ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager standardFileManager=compiler.getStandardFileManager(null,null,null);
The parameters of GETSTANDARDFILEMANAGER method are as follows:
diagnosticListener a diagnostic listener for non-fatal diagnostics, if null, reporting diagnostics using a default method of the compiler;
The language environment to be applied in diagnosis is formatted by a locale;
charset is used to decode the character set of bytes, and if null, the platform default value is used.
A custom java file manager object (described in detail below) is then initialized:
MyForwardingJavaFileManager classJavaFileManager=newMyForwardingJavaFileManager(standardFileManager);
Reinitializing a java source file object (described in detail below):
MySimpleJavaFileObject stringObject=new MySimpleJavaFileObject(new URI("LoanModel123.java"),JavaFileObject.Kind.SOURCE,classString2);
The parameters are as follows:
file URIs (here named source files, but not actually storing the file in the server);
Java file type (designated source file, i.e., source file);
code strings in the source file (i.e., dynamically entered code).
Representing the interface of the compilation task. But the compiling task has not yet started. If a task needs to be started, call methods are called.
CompilationTask task=compiler.getTask(null,classJavaFileManager,null,null,null,Arrays.asList(stringObject));
task.call()
The dynamic code has been compiled to a class file, but the class file is not stored locally and is then converted to binary by outputStream for invocation.
Program module 2 calling method in class after completion of compilation
Retrieving custom class file objects from a custom java file manager (described in detail below):
ClassJavaFileObject javaFileObject=classJavaFileManager.getClassJavaFileObject();
Initializing a custom class loader:
ClassLoader classLoader=new MyClassLoader(javaFileObject);
the parameters are the above class file objects.
And (3) loading a class:
Object loanModel=classLoader.loadClass("LoanModel123").newInstance();
The class name is consistent with the source file name, and is consistent with the Java xx specification of the native Java executing javac xx.Java in the command line.
The method in the acquisition class comprises the following steps:
Method do04=loanModel.getClass().getMethod("do04",LoanModelDAO.class);
The parameters are as follows:
1. a method name;
2. Type of method parameters.
The method is called:
Object invoke=do04.invoke(loanModel,new LoanModelDAO(190.0,124.0,121.0,121.0,121.0));
The parameters are as follows:
1. A method;
2. The specific parameters input by the method.
The result returned by the completion call is the Object type. Since the object is then used to splice xml messages, the present system does not need to translate the object type. Other flows may be performed as needed to convert the returned object into any desired type as desired.
Program module 3 custom java file management class
As shown in the code, the embodiment self-defines a java file management class MyForwardingJavaFileManager and inherits ForwardingJavaFileManager. An attribute classJavaFileObject of ClassJavaFileObject custom class type is encapsulated. A getClassJavaFileObject method is packaged for external invocation classJavaFileObject properties, returning custom class file objects. While such construction methods invoke the construction method of its parent ForwardingJavaFileManager.
Program module 4 custom java source file class
As shown by codes, the embodiment self-defines a java source file class and inherits a parent class SimpleJavaFileObject class. In this class, a source file content attribute is encapsulated. When such a constructor is called, a third parameter "dynamic code" of the constructor is assigned to the content attribute while the constructor of the parent class is called. The getCharContent method of overwriting the parent class returns the content string. If the constructor is called externally, the content of a file named xx.java is read even if it does not exist, and the parent class does not report errors. The content is that the calling construction method is an input parameter content character string. Thus, a java source file object is obtained.
Program module 5 custom class files
As shown in the code, this embodiment defines a class file class, which inherits the parent class SimpleJavaFileObject class. In this class, a ByteArrayOutputStream type byte array output stream is encapsulated. The byte array output stream is created in memory with a byte array buffer in which all data sent to the output stream is stored.
When such a constructor is called, a ByteArrayOutputStream object is initialized while the constructor of the parent class is called.
The openOutputStream method in the overwrite parent class returns ByteArrayOutputStream to the object for subsequent custom class loader calls.
Program module 6 custom class loader
As shown by codes, the embodiment self-defines a self-defined class loader class and inherits a parent class ClassLoader. An attribute of ClassJavaFileObject types (custom class file class mentioned above) is encapsulated. When the construction method is called, the parameters are assigned to the definition class file attributes. The FINDCLASS method is rewritten to convert the custom class file into binary. Thus, when the MyClassLoader class is called externally, the FINDCLASS method can convert the custom class file into binary even if the file named xx.class does not exist in the file system, and the DEFINECLASS method parameter returned to the calling parent class becomes the binary code of the custom class without reporting that the xx class (xx.class) does not exist.
Program module 7 dynamic class code management side page
The dynamic class code management end page usage framework is vue, vue is a set of progressive JavaScript framework for building user interfaces.
The specific implementation is as follows:
1. first, the command NPMINSTALL ACE-builds-S install dependency needs to be executed;
2. the creation of a document named dynamic encoder.vue, the specific page code has no relevance to the embodiment body, and will not be described in detail here.
The specific application is as follows:
1. Introducing in the page and registering the components;
import CodeEditor from'@/components/CodeEditor'
2. Use;
<code-editor ref="_firstRefs"class="editor h-100"v-model="editorContent"readonly language="json"theme="dracula"></code-editor>
editorContent is bi-directional binding editor content.
The agile development method for realizing rapid landing of the partner service based on the java dynamic proxy can also be used for programming a large-scale competition system (providing a programming examination function) or programming examination of an educational system in the java training direction (providing a working function).
Those skilled in the art will appreciate that all or part of the processes implementing the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and where the program may include processes implementing the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random-access Memory (Random Access Memory, RAM), or the like.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and additions to the present invention may be made by those skilled in the art without departing from the principles of the present invention and such modifications and additions are to be considered as well as within the scope of the present invention.

Claims (10)

1. A quick development method based on java dynamic proxy is characterized by comprising the following steps of receiving, storing and compiling a dynamic proxy class code character string based on a compiler module for partner service configuration and calling a service proxy class to realize partner service landing according to the partner service configuration dynamic proxy class, wherein the compiler module executes the following steps:
S1, acquiring a java compiler JavaCompiler;
s2, acquiring a standard java file manager StandardJavaFileManager;
S3, initializing a custom java file manager MyForwardingJavaFileManager, receiving STANDARDFILEMANAGER objects as parameters through a constructor, and packaging a custom class file object ClassJavaFileObject for receiving dynamic proxy class code strings of partner service configuration;
S4, initializing a custom java source file object MySimpleJavaFileObject, which is used for storing a dynamic proxy class code character string of partner service configuration to the java source file;
S5, receiving and storing a dynamic proxy class code string of the business configuration of the partner based on the user-defined java source file object MySimpleJavaFileObject and the user-defined java file manager MyForwardingJavaFileManager;
s6, acquiring a JavaCompiler. Compactiontask example from the JavaCompiler examples;
S7, executing the compiling task of the dynamic proxy class of the partner service configuration obtained in the step S5 by the Java compiler. Compiling task instance;
The caller module performs the steps of:
S8, extracting a dynamic proxy class code string of the service configuration of the partner based on the self-defined java source file object MySimpleJavaFileObject and the self-defined java file manager MyForwardingJavaFileManager according to the scene number of the partner;
s9, initializing a custom class loader MyClassLoader;
s10, loading a dynamic proxy class for partner service configuration based on a custom class loader MyClassLoader, wherein the class name is consistent with the dynamic proxy class name transmitted by the partner;
S11, calling a service delegation class according to a dynamic proxy class of the service configuration of the partner based on an invoke method in a Java dynamic proxy InvocationHandler interface to realize the service landing of the partner.
2. The quick development method based on java dynamic proxy according to claim 1, wherein the dynamic proxy class code string of the partner service configuration obtained in step S5 includes a program code string for realizing partner service landing based on a service delegation class, and step S11 invokes the program for realizing partner service landing based on the service delegation class.
3. The quick development method based on java dynamic proxy is characterized in that the partner service configuration dynamic proxy class refers to a dynamic proxy class for loan credit according to client data provided by a partner in a bank express e-credit front-end system, or a dynamic proxy class for programming examination according to the identity of a competitor provided by the partner in a programming large-scale competition system, or a dynamic proxy class for arranging operation according to the identity of a learner provided by the partner in a java training direction education system.
4. The quick development method based on the java dynamic proxy of claim 1, wherein the step S3 is characterized in that the Java file manager MyForwardingJavaFileManager is customized to inherit the parent class ForwardingJavaFileManager, the attribute classJavaFileObject of the ClassJavaFileObject custom class file type is encapsulated, and the method getClassJavaFileObject is encapsulated for externally calling classJavaFileObject attribute and returning the custom class file object.
5. The quick development method based on the java dynamic agent according to claim 4, wherein the step S4 is characterized in that the self-defining java source file class MySimpleJavaFileObject inherits the parent class SimpleJavaFileObject class and encapsulates a source file content attribute, the construction function of the self-defining java source file class MySimpleJavaFileObject is called, the construction function of the parent class SimpleJavaFileObject is called, the dynamic code character string is assigned to the parameter content attribute, the getCharContent method of the parent class is rewritten, the content character string is returned, and the dynamic code character string is input by calling the construction function of the self-defining java source file class MySimpleJavaFileObject externally.
6. The quick development method based on the java dynamic proxy of claim 5, wherein step S3 is characterized in that a class file type ClassJavaFileObject is customized, a parent class SimpleJavaFileObject is inherited, a ByteArrayOutputStream type byte array output stream is packaged, a byte array buffer is created in a memory by the byte array output stream, all data sent to the byte array output stream are stored in the byte array buffer, when a construction function of the class file type ClassJavaFileObject is called, the construction function of the parent class is called, meanwhile, the byte array output stream of a ByteArrayOutputStream object is initialized, and a openOutputStream method in the parent class is rewritten to return a ByteArrayOutputStream object byte array output stream for being called by a step S10 custom class loader MyClassLoader.
7. The quick development method based on java dynamic proxy of claim 6, wherein step S9 is characterized in that custom class loader MyClassLoader inherits parent class ClassLoader, encapsulates a custom class file type ClassJavaFileObject, and assigns parameters to custom class file type attribute when the construction method of custom class loader MyClassLoader is called.
8. The quick development method based on java dynamic proxy of claim 1, wherein the management end program module based on dynamic class code accepts and manages the scene number of the partner, the dynamic proxy class code character string of the partner service configuration, and the data required by the service configuration.
9. The agile development method based on java dynamic proxy of claim 8, wherein the dynamic class code manager module is based on vue software framework.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements a agile development method based on java dynamic proxy according to any one of claims 1 to 9.
CN202111521213.5A 2021-12-13 2021-12-13 An agile development method and medium based on java dynamic agent Active CN114327400B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111521213.5A CN114327400B (en) 2021-12-13 2021-12-13 An agile development method and medium based on java dynamic agent

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111521213.5A CN114327400B (en) 2021-12-13 2021-12-13 An agile development method and medium based on java dynamic agent

Publications (2)

Publication Number Publication Date
CN114327400A CN114327400A (en) 2022-04-12
CN114327400B true CN114327400B (en) 2025-02-21

Family

ID=81051542

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111521213.5A Active CN114327400B (en) 2021-12-13 2021-12-13 An agile development method and medium based on java dynamic agent

Country Status (1)

Country Link
CN (1) CN114327400B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118631895A (en) * 2023-03-09 2024-09-10 蔚来移动科技有限公司 Unified communication method, electronic device and medium based on mobile terminal

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929597A (en) * 2012-09-24 2013-02-13 摩卡软件(天津)有限公司 Java-platform-based web service support method and device
CN109947430A (en) * 2019-03-26 2019-06-28 山东浪潮通软信息科技有限公司 A kind of code compilation Core Generator based on on-the-flier compiler and a kind of on-the-flier compiler method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6973646B1 (en) * 2000-07-21 2005-12-06 International Business Machines Corporation Method for compiling program components in a mixed static and dynamic environment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929597A (en) * 2012-09-24 2013-02-13 摩卡软件(天津)有限公司 Java-platform-based web service support method and device
CN109947430A (en) * 2019-03-26 2019-06-28 山东浪潮通软信息科技有限公司 A kind of code compilation Core Generator based on on-the-flier compiler and a kind of on-the-flier compiler method

Also Published As

Publication number Publication date
CN114327400A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
JP4015375B2 (en) Server-side control object that handles client-side user interface elements
US7971194B1 (en) Programming language techniques for client-side development and execution
US7269792B2 (en) System and method for generating high-function browser widgets with full addressability
US7152229B2 (en) Workflow code generator
US7603658B2 (en) Application functionality for a test tool for application programming interfaces
RU2351976C2 (en) Mechanism for provision of output of data-controlled command line
US7007266B1 (en) Method and software system for modularizing software components for business transaction applications
US20040181713A1 (en) Automatic identification of input values that expose output failures in software object
US7739691B2 (en) Framework for declarative expression of data processing
US20020099738A1 (en) Automated web access for back-end enterprise systems
US20030149799A1 (en) System supporting unified event handling in ECMAScript
US20040015832A1 (en) Method and apparatus for generating source code
US20030084401A1 (en) Efficient web page localization
US20150242194A1 (en) System for Translating Diverse Programming Languages
US7996816B2 (en) Method and apparatus for dynamically binding service component implementations for specific unit test cases
US20120174068A1 (en) Testing Software Code
CN112860260A (en) Web-based cross-platform application construction tool and method in college scene
US20050172300A1 (en) System and method for transferring computer-readable objects across a remote boundary
CN111259042B (en) Dynamic query method and system
NO329240B1 (en) System and method for explanatory definition and use of document encoding subgroups
CN114327400B (en) An agile development method and medium based on java dynamic agent
Irwin et al. Object oriented metrics: Precision tools and configurable visualisations
US7657869B2 (en) Integration of external tools into an existing design environment
US8930960B2 (en) Methods and systems for object interpretation within a shared object space
US20080127128A1 (en) Type Validation for Applications Incorporating A Weakly-Typed Language

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
GR01 Patent grant
GR01 Patent grant