Data processing method, data processing device, electronic equipment and storage medium

By extracting method name and parameter information from the call request, building parameter objects and determining the target method, the uncertainty problems caused by high method call cost and overloading of method names in the existing technology are solved, and convenient and accurate method call is achieved .

CN119149141APending Publication Date: 2024-12-17MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411125100.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The prior art is costly and difficult to maintain when determining and calling methods, and overloading method names makes it impossible to accurately determine the target method.

Method used

By extracting method name and parameter information from the call request, building parameter objects, and determining the target method based on the method name and parameter objects, avoiding uncertainty caused by method name overload.

Benefits of technology

It realizes a convenient and accurate target determination method, reduces development costs, and is suitable for a variety of scenarios such as service upgrades and system testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149141A_ABST
    Figure CN119149141A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method, a data processing device, electronic equipment and a computer readable storage medium, and belongs to the technical field of computers. The method comprises the following steps: in response to a calling request for a target method, extracting a method name and method parameter information of the target method from the calling request; constructing a parameter object of the target method according to the method parameter information; and determining the target method according to the method name and the parameter object. The target method can be accurately and effectively determined according to the method name and the method parameter information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, a data processing device, an electronic device, and a computer-readable storage medium. Background Art

[0002] In software development and application scenarios, we often face situations where we need to use specified methods. For example, when a service is upgraded and released, we need to call a specific compatible method in the service to convert and process historical data; during automated testing, we need to call the method of consuming messages in the service to simulate receiving messages, etc. When determining the method to be used, the prior art usually needs to write specific information for the called method, such as the calling code and the calling entry. Only after a complete process of logic development, functional testing, online release, and offline temporary code can the method be determined and called. In the above process, the calling cost is high and the system maintenance is difficult. In addition, since method names are often overloaded, that is, different methods may correspond to the same name, the prior art is also difficult to accurately and uniquely determine the method to be called based on the method name.

[0003] Therefore, how to provide a convenient and effective way to accurately determine the required method is a problem that needs to be solved urgently in the prior art.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The present disclosure provides a data processing method, a data processing device, an electronic device and a computer-readable storage medium, thereby overcoming the problem that the prior art is difficult to determine simply and conveniently, at least to a certain extent.

[0006] According to a first aspect of the present disclosure, a data processing method is provided, comprising: in response to a call request for a target method, extracting a method name and method parameter information of the target method from the call request; constructing a parameter object of the target method according to the method parameter information; and determining the target method according to the method name and the parameter object.

[0007] According to a second aspect of the present disclosure, a data processing device is provided, comprising: a request information acquisition module, used to extract, in response to a call request for a target method, a method name and method parameter information of the target method from the call request; a parameter object construction module, used to construct a parameter object of the target method according to the method parameter information; and a target method determination module, used to determine the target method according to the method name and the parameter object.

[0008] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any one of the above-mentioned data processing methods by executing the executable instructions.

[0009] According to a fourth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, any one of the above-mentioned data processing methods is implemented.

[0010] The exemplary embodiments of the present disclosure have the following beneficial effects:

[0011] In response to a call request for a target method, the method name and method parameter information of the target method are extracted from the call request; a parameter object of the target method is constructed according to the method parameter information; and the target method is determined according to the method name and the parameter object. On the one hand, in this exemplary embodiment, the parameter object of the target method is constructed according to the method parameter information, and the target method is determined based on the method name and the parameter object, which can avoid the problem that the target method cannot be determined based on the method name alone when the method name is overloaded; on the other hand, the call request includes the method name and method parameter information. This exemplary embodiment can determine the corresponding target method according to the call request, has a simple processing process, low development cost, and a wide range of applicable scenarios. It can provide an accurate way to determine the target method in a variety of scenarios that require method calls, such as service upgrades and system testing.

[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0014] Figure 1 A flow chart schematically illustrates a data processing method in this exemplary embodiment;

[0015] Figure 2 A sub-flow chart schematically illustrates a data processing method in this exemplary embodiment;

[0016] Figure 3 A sub-flow chart schematically illustrates another data processing method in this exemplary embodiment;

[0017] Figure 4 A schematic diagram of an architecture module for invoking a method within an application in this exemplary embodiment is schematically shown;

[0018] Figure 5 A flowchart schematically illustrates another data processing method in this exemplary embodiment;

[0019] Figure 6 A block diagram schematically shows a structure of a data processing device in this exemplary embodiment;

[0020] Figure 7 An electronic device for implementing the above method in this exemplary embodiment is schematically shown. DETAILED DESCRIPTION

[0021] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0022] The exemplary embodiment of the present disclosure first provides a data processing method. Figure 1 This exemplary embodiment is further described as follows. Figure 1 As shown, the data processing method may include the following steps S110 to S130:

[0023] Step S110 , in response to a call request for a target method, extracting a method name and method parameter information of the target method from the call request.

[0024] In actual applications, when it is necessary to implement certain functions or use specified methods, method calls are often required. The target method refers to the method that needs to be called, which can be a static method or an instance method. The target method can be expressed in the form of code or method body. The call request can be information sent by the call requester for requesting to call the target method, which can include relevant information required for the specific request to call the target method, such as method name, method parameter information, and one or more information such as the class where the method is located and the call object. Depending on the specific target method to be called, the call request also has differences. For example, the call request corresponding to the static method and the instance method can include different request information. For example, when calling a static target method, the call request may not include the call object, while when calling the instance target method, the call request needs to include the call object. Method parameter information refers to the relevant parameter information involved in calling the target method. For example, in this exemplary embodiment, the method parameter information can include the parameter type, parameter value, parameter processing engine data, etc. of the target method. The parameter type and parameter value are used to reflect the classification of the parameter and the specific value of the parameter. The parameter processing engine data can be pre-configured flag data used to determine the method for parameter parsing or parameter object construction.

[0025] In this exemplary embodiment, the call request for the target method can be implemented in the following manner: the call request end can first determine the call requirement information of the target method, and generate a structured call request for the target method based on the call requirement information; the call request end determines the call request based on the structured call request, and sends the call request to the call end.

[0026] In this exemplary embodiment, the calling end can obtain the calling request information from the calling request end, wherein the calling request can be configured by the calling request end. Before making a method call, the calling request end can determine the calling requirement information of the target method to be called, such as clarifying what method needs to be called, which can specifically include the method name of the target method to be called, the class where the method belongs, the method parameters, whether the calling object needs to be specified, and what kind of calling object to specify. Then, according to the calling requirement information, structured standard data that can be recognized or processed by the computer is generated, that is, structured calling information.

[0027] Table 1 below shows a definition of structured call information and a corresponding call information description example in this exemplary embodiment:

[0028] Table 1

[0029]

[0030] The following is a sample code for calling the structured call information configured by the requester:

[0031] {

[0032] "targetClass":"The fully qualified name of the class where the target method is located",

[0033] "targetMethod":"The method name of the target method",

[0034] "targetObject": "The name of the calling object, such as the Bean name beanName of the Spring application. If you are calling a static target method, you do not need to specify it",

[0035] "args":[

[0036] {

[0037] "type":"The fully qualified name of the method parameter type, which can support complex nested generics",

[0038] "param":"The method parameter value corresponding to the method parameter type can support null, numbers, strings and JSON objects",

[0039] "engine":"json|groovy, the execution engine for parameter processing, the default value is json"

[0040] } ]

[0042] }

[0043] Furthermore, the call request end may determine the call request based on the structured call information and send the call request to the call end, for example, using the structured call information as the call request information and sending it to a unified external request interface, so that the call end receives the call request information and processes it.

[0044] After receiving the call request, the method name and method parameter information of the target method may be extracted from the call request.

[0045] The method name refers to the name of the target method to be called. This exemplary embodiment can search for the target method according to the method name, for example, in all methods, or in the class where the target method is located, and determine the target method according to the method name. In actual applications, due to the existence of method overloading in Java, that is, multiple methods with the same method name may be defined in the same class at the same time, at this time, it is difficult to determine the unique target method according to the method name. This exemplary embodiment can extract the method name of the target method from the call request by identifying a specific field or definition code in the call request, such as identifying the content of "targetMethod" in the call request to obtain the method name of the target method. Method parameter information refers to part or all of the information of parameters such as variables and indicators involved in the process of calling the target method, which may include some basic data, data types, data values ​​and parameter details that need to be transmitted. This exemplary embodiment can also extract the method parameter information of the target method from the call request by identifying a specific field or definition code in the call request, such as identifying the content of "args" in the call request to obtain the method parameter information of the target method. The method parameter information may include other parameter indicator fields, such as "type", "param", and "engine", which respectively represent the method parameter type, method parameter value, and parameter processing engine data.

[0046] Step S120: construct a parameter object of the target method according to the method parameter information.

[0047] A parameter object may refer to a specific instance of serialized data information converted through deserialization processing for executing a target method call. This exemplary embodiment may construct a parameter object of a target method based on the method parameter information to execute a subsequent method call process. There may be multiple construction methods, such as directly writing a parameter object based on a method parameter value by object writing, or processing the method parameter type and method parameter value by a specific programming language, such as Java, to construct a parameter object, etc. This exemplary embodiment may configure identification data, such as parameter processing engine data, in the method parameter information to determine how to construct a parameter object of a target method by detecting the data.

[0048] In an exemplary embodiment, if Figure 2 As shown, the above step S130 may include the following steps:

[0049] Step S210, extracting parameter processing engine data from method parameter information;

[0050] Step S220, determining a parameter object construction method according to parameter processing engine data;

[0051] Step S230, parsing the method parameter information through the parameter object construction method to construct a parameter object;

[0052] Among them, the parameter object construction method includes a standard language construction method and a non-standard language construction method.

[0053] Considering that the forms of method parameter information in programming languages ​​(such as Java) are flexible and diverse, for example, method parameter information can include basic types, package types, arrays, generics, nested generics, etc., and considering that the complexity or difficulty of expressing method parameter information is also different, for example, most calling parameters can be expressed through standard languages, such as standard JSON. When the method parameter information is highly complex or appears in special forms, it is difficult to express it through standard languages.

[0054] In order to balance convenience and scalability, this exemplary embodiment can extract parameter engine data in the call request, determine the parameter object construction method, and use a suitable method to construct the parameter object of the target method.

[0055] Parameter processing engine data refers to identification data that can provide a detection basis for the caller and determine the parameter processing method. For example, engine. By configuring this data in the call request, the caller can parse the data and determine how to construct the parameter object.

[0056] The parameter object construction method may include a standard language construction method and a non-standard language construction method. The standard language processing method may be a general processing method, such as using JSON to process method parameter information. The non-standard language construction method is other methods that cannot be processed by the standard language processing method. It may be a construction method specified by a technician, such as constructing method parameter information by Groovy. The parameter processing engine data may include identification information for indicating the processing method, such as "0" and "1" identification. When it is "0", it is determined to use the standard language construction method, and when it is "1", it is determined to use the non-standard language construction method; or it may also include a specific method sequence for indicating the construction method, such as "JSON" or "Groovy". The specific settings can be customized according to the situation, and the present disclosure does not make specific limitations on this.

[0057] When the technician initiates a call request at the call request end, the technician can pre-configure the method parameter information based on the actual demand, complexity, parsing difficulty and other factors, so that after the call end obtains the parameter processing engine data, it can determine which parameter object construction method to use to construct the parameter object. In this exemplary embodiment, the parameter processing engine data can also be configured by default to parse the method parameter information in a standard language processing method.

[0058] In an exemplary embodiment, if Figure 3 As shown, the above step S130 may include the following steps:

[0059] Step S310, extracting the parameter type and parameter value of the target method from the method parameter information;

[0060] Step S320, determining the generic type corresponding to the parameter type;

[0061] Step S330, constructing a type object corresponding to the generic type according to the generic type;

[0062] Step S340, constructing a parameter object according to the type object and the parameter value.

[0063] In the standard language construction mode, this exemplary embodiment can determine the type of generic corresponding to the parameter type by extracting the parameter type and parameter value of the target method from the method parameter information. For example, by detecting the content under the parameter type type field in the method parameter information, the type of generic corresponding to the parameter type can be determined. According to the type of generic, a corresponding type object can be constructed, and a parameter object can be constructed according to the type object and the parameter value. Among them, the type object refers to a type instance object converted from the sequence information of the parameter type in the call request through deserialization processing. When the computer language constructs the parameter object based on the type information and the method parameter value, the type object needs to be used to implement the construction process.

[0064] In an exemplary embodiment, step S330 may include:

[0065] If the generic type is a single generic type, object conversion is performed on the single generic type to generate a type object corresponding to the single generic type.

[0066] In this exemplary embodiment, the generic type corresponding to the parameter type may include multiple forms, for example, a single generic form such as a basic type, a packaging type, an array, or a nested generic form.

[0067] Generics are a data structure in computer language, which is essentially a type parameterization or parameterized type. A single generic refers to a method that contains only one generic type, such as "char" is a single generic type, "string" is also a single generic type, etc. In this exemplary embodiment, when it is detected that the method parameter type is a single generic type, the data of the single generic type can be loaded through a preset class processing tool, and the single generic type data can be converted to an object to obtain a type object corresponding to the single generic type, wherein the object conversion can be performed through deserialization and bytecode generation, and the preset class processing tool can be, for example, Spring's ClassUtils tool class. For example, the single generic type can be loaded into memory through Spring's ClassUtils tool class loader to obtain a type object corresponding to the single generic type.

[0068] Java has a very rich JSON library. This exemplary embodiment uses the fastjson library as a preset programming language for deserialization processing. When the type is detected to be a basic type (single generic type), the code expression of the method parameter information in the call request is as follows:

[0069]

[0070] This exemplary embodiment can first extract the parameter type and parameter value of the target method from the method parameter information, determine the generic type corresponding to the parameter type type, such as char corresponding to type, and then load char into memory with the help of Spring's ClassUtils tool class to obtain the corresponding type object. The parseObject method of the fastjson library can be used for further processing to construct a parameter object according to the type object and parameter value. The core code of the processing process includes the following code example:

[0071] Class<? >cCls=ClassUtils.forName("char");

[0072] char c=JSON.parseObject("'c'",cCls);

[0073] Class<? >iCls=ClassUtils.forName("int");

[0074] int i=JSON.parseObject("1",iCls);

[0075] This code indicates that a corresponding parameter object can be constructed based on a single generic char and parameter value c, and a corresponding parameter object can be constructed based on a single generic int and parameter value 1.

[0076] When it is detected that the method parameter generic type is a wrapper type (single generic type), the code expression of the method parameter information in the call request is as follows:

[0077]

[0078] The processing is similar to that of the basic type. The core code for parameter object construction includes the following code examples:

[0079] Class<? >strCls=ClassUtils.forName("java.lang.String");

[0080] String hello=JSON.parseObject("'hello'",strCls);

[0081] This code shows that the corresponding parameter object can be constructed based on the generic type String and parameter value hello.

[0082] When it is detected that the generic type of the method parameter is an array type (single generic type), the code expression of the method parameter information in the call request is as follows:

[0083]

[0084] "param":[["c"]]

[0085] } ]

[0087] The processing process is similar to that of the basic type. The core code for parameter object construction includes the following code examples:

[0088] Class<? >csCls=ClassUtils.forName("char[][]");

[0089] char[][]cs=JSON.parseObject("[[\"c\"]]",csCls);

[0090] This code shows that the corresponding parameter object can be constructed based on the generic type char[][] and parameter value ["c"].

[0091] In an exemplary embodiment, the above step S330 may further include:

[0092] If the generic type is a nested generic, the generic features are extracted from the nested generic data;

[0093] Generic information of multiple single generics is determined in the nested generics based on the generic features, and a type object of the generic type is constructed according to the generic information of each single generic.

[0094] Among them, nested generics refer to nested generics that include multiple single generic data, and generic features refer to character features used to characterize or reflect the internal structure of generics, such as symbols such as ",",".",";,"<,"">" and feature information such as the number of each symbol. When this exemplary embodiment detects that the type of generics is a nested generic, generic features can be extracted from it to perform segmentation in the nested generics based on the generic features to determine generic information of multiple single generics, and the generic information may include what each single generic obtained by the segmentation is specifically and / or the number of single generics. Furthermore, a type object of the generic type can be constructed based on the generic information of each single generic.

[0095] In an exemplary embodiment, the above-mentioned determining generic information of multiple single generics in nested generics based on generic features may include:

[0096] Perform generic division on the nested generics according to the generic features, and determine multiple single generics and the number of each single generic in the nested generics;

[0097] The multiple single generics and the number of the multiple single generics are used as the generic information of each single generic.

[0098] The nested generics include multiple single generics. The generic information of each single generic can be determined by generic features. For example, the generic parameter variables can be extracted from the type field. When the type is a nested generic, generic features such as "," (comma), "<" and ">" are extracted from the nested generics. The generic features are used as delimiters. When a delimiter is encountered, it means that the content before or after the delimiter is a single generic. For example, a generic feature starting with "<" holds a generic type; when encountering a generic feature of ",", data backtracking is required to find the first type "<" that holds a generic, and the number of generics held is increased by 1. Usually, standard JSON can only express up to two generic contents, such as list and map; when encountering ">", it can be determined to save the previous type string (if there is a string). In the above manner, all single generics in multi-generic nested data and the number of each single generic can be obtained. Afterwards, this exemplary embodiment can use the single generic and the number of each single generic as the generic information of each single generic.

[0099] In this exemplary embodiment, the generic information of a single generic can be stored in a preset data structure, wherein the preset data structure refers to a data structure in which a single generic and a single generic quantity have a corresponding relationship. For example, the preset data structure can be an array structure, in which a single generic and a single generic quantity are stored in an array while maintaining the original order. The preset data structure can also include other data structures such as relationship mapping tables, key-value data, and the like.

[0100] The following code example illustrates the parsing of nested generics. The parsing of nested generics can use a tool class that implements the type object, such as a tool class such as GenericUtils. Furthermore, Spring's ClassUtils tool class can be used to load the parsed generic information into memory to generate a type object corresponding to the nested generic.

[0101] The code example is represented as:

[0102] / / java.util.List <java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Integer> >>>

[0103] Parse the string in sequence according to the character dimension, using "<", ">" and "," as delimiters. When a delimiter is encountered, it means that the content before the delimiter is a string of the type. A string starting with "<" means that it holds a single generic type. When a "," is encountered, it means that it holds two single generic types. Record the generic category and the number of generics held by the category, and finally store the result in an array.

[0104] The generic string in the above example can be parsed as follows:

[0105]

[0106]

[0107] After obtaining the generic information of multiple single generics, the type object of the single generic can be determined based on the generic information. Specifically, for example, the generic information can be saved through the java.lang.reflect.Type object. When fastjson deserializes the generic type, it can use the parseObject method of fastjson to pass in the generic type through TypeReference (the wrapper object of java.lang.reflect.Type).

[0108] It should be noted that fastjson only provides a declarative way to build TypeReference (that is, pass in generic information when creating an anonymous TypeReference object new TypeReference <List <integer>>(){}), in the above nested generic data, the degree of complex nesting is high. By using the generic information parsed in the previous step, the type object can be dynamically constructed effectively and conveniently.

[0109] In this exemplary embodiment, during the dynamic construction of a type object, a nested generic string can be converted into an underlying processing method of the type object, that is, a ParameterizedTypeImpl chain is constructed to store generic information.

[0110] The following nested generics are List <Map<String,List<Map<String,Integer> >>> Take the deserialization process as an example to explain the type object construction process of fastjson in detail.

[0111] In this exemplary embodiment, the JSON content corresponding to the type string is:

[0112] String json="[{\"k1\":[{\"k11\":123}]}]";

[0113] The innermost map:

[0114] ParameterizedTypeImpl p1=new ParameterizedTypeImpl(new Type[]{String.class,Integer.class},null,Map.class);

[0115] The list that contains the innermost map:

[0116] ParameterizedTypeImpl p2=new ParameterizedTypeImpl(new Type[]{p1},null,List.class);

[0117] Outer map:

[0118] ParameterizedTypeImpl p3=new ParameterizedTypeImpl(new Type[]{String.class,p2},null,Map.class);

[0119] The outermost list:

[0120] ParameterizedTypeImpl p4=new ParameterizedTypeImpl(new Type[]{p3},null,List.class);

[0121] Deserialization:

[0122] List <Map<String,List<Map<String,Integer> >>>list=JSON.parseObject(json,p4);

[0123] This exemplary embodiment is represented by the above code. The nested generic string can be converted into generic information first, and then the type object can be constructed recursively. The type object can be implemented by the GenericUtils tool class. The code is represented as follows:

[0124] ParameterizedTypeImpl genericType=new

[0125] GenericUtils().parse("java.util.List <java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Integer> >>>");

[0126] After dynamically constructing the type object, you can use fastjson to deserialize it to get the parameter object. The code is as follows:

[0127] List <Map<String,List<Map<String,Integer> >>>list=JSON.parseObject(json,genericType);

[0128] In an exemplary embodiment, the above-mentioned construction of a parameter object according to a type object and a parameter value may include:

[0129] Parse the parameter value in the form of a character sequence into a parameter value in the form of an object;

[0130] Constructs a parameter object from a type object and method parameter values ​​in object form.

[0131] This exemplary embodiment can parse parameter values ​​in the form of character sequences into parameter values ​​in the form of objects. For example, this exemplary embodiment can use a preset programming language, such as deserializing parameter values ​​in JSON format through an existing JSON tool library, and deserializing the parameter values ​​of the target method to obtain parameter values ​​in the form of objects. Among them, the deserialization process can allow the byte stream to be reconverted into the state of the original object, realize object recovery or convert the byte sequence into an operable object. After obtaining the type object and the method parameter value in the form of an object, the parameter object can be constructed through the object construction tool, such as using the paraseObject method of fastjson, and the parameter object can be directly constructed according to the type object and the method parameter value in the form of an object.

[0132] In an exemplary embodiment, in a non-standard language construction mode, the above step S130 may include:

[0133] The parameter value in the method parameter information is used as the script content, and the parameter object is constructed using the preset script language.

[0134] The preset script language refers to a preset language that can be used to construct script objects, such as Groovy. The script construction method parameter: supports constructing parameter objects through Groovy scripts, executing scripts through the Groovy script engine, and constructing method parameter objects.

[0135] The following code example is used to illustrate:

[0136] Method signature: func(com.demo.Student stu)

[0137] JSON expression (args array part): [

[0139] {

[0140] "param":"def stu=new com.demo.Student(); stu.setSno(\"001\"); stu.setName(\"Zhang San\"); return stu;",

[0141] "engine":"groovy"

[0142] } ]

[0144] The process of constructing a parameter object through a Groovy script may include: extracting parameter processing engine data engine from method parameter information, and when parsing it determines that the value is "groovy", it indicates that the current parameter needs to be constructed through a Groovy script. At this time, the parameter value (param) is the script content. Executing the script content through GroovyShell can obtain the execution result. The core code is as follows:

[0145] String script = "def stu = new com.demo.Student();\n"

[0146] + "stu.setSno(\"001\");\n"

[0147] + "stu.setName(\"张三\");\n"

[0148] + "return stu;"

[0149] / / At this time, the actual type of param is com.demo.Student

[0150] Object param = new GroovyShell().evaluate(script);

[0151] Step S130, determine the target method according to the method name and the parameter object.

[0152] Considering that the method name may be overloaded, in this exemplary embodiment, the target method is determined based on the method name and the parameter object of the target method parsed from the call request, avoiding the problem that the target method cannot be accurately and effectively found due to method name overloading. Invoking the target method can also be combined with the class where the target method is located. In addition, in this exemplary embodiment, when the target method is a static method, the target method can be determined according to the method name and the parameter object, and the invocation of the target method can be realized. When the target method is an instance method, the invocation process of the target method also needs to be combined with the instance of the calling object.

[0153] In an exemplary embodiment, before determining the target method according to the method name and the parameter object, the above method invocation method may further include:

[0154] Extract the class where the method is located from the call request;

[0155] The above step S130 may include:

[0156] Perform method matching in the class where the method is located according to the method name and the parameter object to determine the target method that matches the method name and the parameter object.

[0157] Among them, the class where the method is located refers to the class to which the target method to be called belongs. This exemplary embodiment can extract the name of the class where the method is located from the call request, determine the class where the target method is located based on the name, and search for the target method that matches the method name and parameter object in the class to execute the calling process.

[0158] In an exemplary embodiment, the above method may further include:

[0159] The target method is called to perform service processing.

[0160] After determining the target method, the process of calling the target method can be executed to perform related service processing. The service processing can include service processing processes in scenarios such as system service upgrades and system service maintenance. For example, in a system service upgrade scenario, if a certain function needs to be used, the target method related to the function can be determined, and the operation of calling the target method can be executed.

[0161] In an exemplary embodiment, when the target method is an instance method, the above-mentioned calling the target method to perform service processing may include:

[0162] Extracting a call instance name of a target method from a call request, and extracting a target call instance according to the call instance name;

[0163] The target method is called through the target invocation instance to perform service processing.

[0164] When the target method is an instance method, during the method call process, the target method call is also required with the help of an instance. The call instance name of the target method can be extracted from the call request, and the target call instance can be extracted based on the call instance name, for example, the instance object can be obtained from the IOC container based on the call object name.

[0165] When executing a method call, multiple methods with the same method name as the method in the call request may appear. This exemplary embodiment can scan the methods included in the class where the method is located through reflection, for example, scanning all methods in the class where the method is located. When there are multiple candidate methods with the same method name as the target method in the class where the method is located, the target method to be called is determined from the multiple candidate methods in combination with the parameter object. Finally, the method call is executed through reflection, the target method is called through the target call instance, and the result is returned to the call requester to perform service processing.

[0166] The core code for executing the call is as follows:

[0167] / / The method parameter object parsed in the previous step

[0168] List <object>arguments = null;

[0169] / / If the calling object name is specified, the calling object is obtained from the IOC container by calling the object name

[0170] Object targetObject = null;

[0171] / / Reflection scans all methods of the class where the method is located, and finds the method object by combining the method name and parameter information

[0172] Method method = null;

[0173] / / Reflection call, get method call result

[0174] Object result=method.invoke(targetObject,arguments);

[0175] Based on the above description, in this exemplary embodiment, in response to a call request for a target method, the method name and method parameter information of the target method are extracted from the call request; a parameter object of the target method is constructed according to the method parameter information; and the target method is determined according to the method name and the parameter object. On the one hand, in this exemplary embodiment, a parameter object of the target method is constructed according to the method parameter information, and the target method is determined based on the method name and the parameter object, which can avoid the problem that the target method cannot be determined based on the method name alone when the method name is overloaded; on the other hand, the call request includes the method name and method parameter information. This exemplary embodiment can determine the corresponding target method according to the call request, has a simple processing process, low development cost, and a wide range of applicable scenarios. It can provide an accurate way to determine the target method in a variety of scenarios that require method calls, such as service upgrades and system testing.

[0176] Figure 4 A schematic diagram of an architecture module for implementing method calls within application A of this exemplary embodiment is shown, which may specifically include: an external interface module 410, used to receive a call request 411 sent by an external call request end; a parameter object construction module 420, used to construct a parameter object according to method parameter information, and the specific construction method may include a standard language JSON construction method 421 and a Groovy script construction method 422; a method call module 430, which determines a target method from multiple call methods 432 through a reflection processing unit 431, and implements the call of the target method within the application; a result return module 440, used to aggregate method call results and return them to the call request end.

[0177] Figure 5 A flow chart of another data processing method in this exemplary embodiment is shown, which may specifically include the following steps:

[0178] Call the request side to execute:

[0179] Step S502, determining the call requirement information of the target method, and generating a structured call request of the target method according to the call requirement information;

[0180] Step S504, determining a call request based on the structured call request by the call request end, and sending the call request to the call end, so that the call end obtains the call request of the target method;

[0181] The calling end executes:

[0182] Step S506, obtaining a call request;

[0183] Step S508, extracting the method name and method parameter information of the target method from the call request;

[0184] Step S510, extracting parameter processing engine data from the method parameter information, and determining a parameter object construction method according to the parameter processing engine data;

[0185] When the parameter object construction method is the standard language construction method, step S512 is executed to extract the parameter type and the parameter value of the target method from the method parameter information, and determine the generic type corresponding to the parameter type;

[0186] Step S514, determining whether the type of the generic is a single generic or a nested generic;

[0187] Step S516, if the generic type is a single generic type, object conversion is performed on the single generic type to generate a type object corresponding to the single generic type;

[0188] Step S518, if the generic type is a nested generic, extracting generic features from the nested generic;

[0189] Step S520, determining generic information of multiple single generics in the nested generics based on the generic features, and constructing a type object of the type according to the generic information of each single generic;

[0190] Step S522, constructing a parameter object according to the type object and the parameter value;

[0191] When the parameter object construction method is a non-standard language construction method, step S524 is executed to construct the parameter object using the script content with the parameter value in the method parameter information and the preset script language;

[0192] Step S526, determining the class of the target method according to the call request;

[0193] Step S528, determining whether the target method is an instance method;

[0194] When the target method is a non-instance method, step S530 is executed to search in the class where the method is located, determine the target method that matches the method name and the parameter object, and call the target method;

[0195] When the target method is an instance method, step S532 is executed to extract the call instance name of the target method from the call request, and extract the target call instance according to the call instance name;

[0196] Step S534, calling the target method through the target calling instance to execute the service processing.

[0197] The exemplary embodiments of the present disclosure also provide a data processing device. Figure 6 The device 600 may include a request information acquisition module 610, which is used to extract the method name and method parameter information of the target method from the call request in response to the call request for the target method; a parameter object construction module 620, which is used to construct the parameter object of the target method according to the method parameter information; and a target method determination module 630, which is used to determine the target method according to the method name and the parameter object.

[0198] In an exemplary embodiment, a parameter object construction module includes: a parameter type and parameter value extraction unit, which is used to extract the parameter type and the parameter value of the target method from the method parameter information; a type determination unit, which is used to determine the type of the generic corresponding to the parameter type; a type object construction unit, which is used to construct a type object corresponding to the generic type according to the generic type; and a parameter object construction unit, which is used to construct a parameter object according to the type object and the parameter value.

[0199] In an exemplary embodiment, the type object construction unit includes: a first type object construction subunit, which is used to perform object conversion on the single generic type if the type of the generic type is a single generic type, and generate a type object corresponding to the single generic type.

[0200] In an exemplary embodiment, the type object construction unit also includes: a second type object construction sub-unit, which is used to extract generic features from the nested generics if the generic type is a nested generic; and determine generic information of multiple single generics in the nested generics based on the generic features, and construct a type object of the generic type according to the generic information of each single generic.

[0201] In an exemplary embodiment, the second type object construction subunit includes: a generic division subunit, used to determine multiple single generics and the number of each single generic in the nested generics based on the generic features; a generic information determination subunit, used to use the multiple single generics and the number of the multiple single generics as generic information of each single generic.

[0202] In an exemplary embodiment, the parameter object construction unit includes: a parameter value parsing subunit for parsing parameter values ​​in the form of character sequences into parameter values ​​in the form of objects; and a parameter object construction subunit for constructing a parameter object according to a type object and a method parameter value in the form of an object.

[0203] In an exemplary embodiment, before determining the target method based on the method name and parameter object, the data processing device also includes: a class extraction unit, used to extract the class where the method is located from the call request; a target method determination module, including: a method matching unit, used to match the method in the class where the method is located based on the method name and parameter object, and determine the target method that matches the method name and parameter object.

[0204] In an exemplary embodiment, the data processing device further includes: a calling module, configured to call a target method to execute service processing.

[0205] In an exemplary embodiment, if the target method is an instance method, the calling module includes: a calling instance extraction unit, which is used to extract the calling instance name of the target method from the calling request, and extract the target calling instance according to the calling instance name; and a service processing unit, which is used to call the target method through the target calling instance to perform service processing.

[0206] The specific details of each part of the above-mentioned device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.

[0207] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0208] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the above data processing method is implemented.

[0209] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.

[0210] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.

[0211] The code of the computer program can be written in one or more programming languages. Programming languages ​​such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).

[0212] The computer program may be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. The electronic device may convert the signal carrying the computer program into a digital signal, thereby running the computer program. When the computer program is run on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device may execute) the method steps of various exemplary embodiments of the present disclosure, such as the above-mentioned data processing method.

[0213] The exemplary embodiment of the present disclosure also provides an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as program code. The processor executes the method in the exemplary embodiment by executing the executable instructions. In addition, the electronic device may also include a display for displaying a graphical user interface.

[0214] Reference below Figure 7 , the electronic device is exemplarily described in the form of a general-purpose computing device. It should be understood that Figure 7 The electronic device 700 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0215] like Figure 7 As shown, the electronic device 700 may include: a processor 710 , a memory 720 , a bus 730 , an I / O (input / output) interface 740 , a network adapter 750 , and a display 760 .

[0216] The memory 720 may include a volatile memory, such as a RAM 721, a cache unit 722, and may also include a non-volatile memory, such as a ROM 723. The memory 720 may also include one or more program modules 724, such program modules 724 include but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. For example, the program module 724 may include each module in the above-mentioned device.

[0217] The processor 710 may include one or more processing units. For example, the processor 710 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc.

[0218] The processor 710 may be used to execute executable instructions stored in the memory 720, such as executing the above-mentioned data processing method.

[0219] The bus 730 is used to realize the connection between different components of the electronic device 700, and may include a data bus, an address bus, and a control bus.

[0220] The electronic device 700 can communicate with one or more external devices 800 (eg, a keyboard, a mouse, an external controller, etc.) through the I / O interface 740 .

[0221] The electronic device 700 can communicate with one or more networks through the network adapter 750. For example, the network adapter 750 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, near field communication, etc. The network adapter 750 can communicate with other modules of the electronic device 700 through the bus 730.

[0222] The electronic device 700 can display a graphical user interface through the display 760, such as displaying a game editing scene.

[0223] although Figure 7 Not shown, other hardware and / or software modules may also be provided in the electronic device 700, including but not limited to: a display (if it has been mentioned above that the electronic device includes a display, then the "display" shall be deleted here), microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0224] As can be seen from the above, the technical solution of the present disclosure can be implemented as a method, an apparatus, a system, a computer program product, a storage medium, an electronic device, etc. Those skilled in the art can understand that various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software, such as being respectively referred to as a "circuit", "module" or "system".

[0225] It should be understood that the present disclosure is not limited to the specific method steps or structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. Those skilled in the art will easily think of other embodiments based on the specific embodiments provided by the present disclosure. Therefore, the specific embodiments provided by the present disclosure are only exemplary, and the scope and spirit of the present disclosure are indicated by the claims, and any variations, uses or adaptive changes of the present disclosure should be covered, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field that are not disclosed in the present disclosure.

[0226] It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be collectively referred to herein as "circuit", "module" or "system". Those skilled in the art will readily think of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptive changes of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and implementation are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0227] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.< / object> < / integer>

Claims

1. A data processing method, It is characterized in that The method comprises: In response to a call request for a target method, extracting a method name and method parameter information of the target method from the call request; Constructing a parameter object of the target method according to the method parameter information; The target method is determined according to the method name and the parameter object.

2. The method according to claim 1, It is characterized in that The step of constructing a parameter object of the target method according to the method parameter information includes: Extracting the parameter type of the target method and the parameter value of the target method from the method parameter information; Determine the generic type corresponding to the parameter type; According to the type of the generic type, construct a type object corresponding to the type of the generic type; Construct the parameter object according to the type object and the parameter value.

3. The method according to claim 2, It is characterized in that The step of constructing a type object corresponding to the generic type according to the generic type includes: If the type of the generic type is a single generic type, object conversion is performed on the single generic type to generate a type object corresponding to the single generic type.

4. The method according to claim 2, It is characterized in that The step of constructing a type object corresponding to the generic type according to the generic type includes: If the type of the generic is a nested generic, extracting generic features from the nested generic; Based on the generic feature, generic information of multiple single generics is determined in the nested generics, and a type object corresponding to the type of the generic is constructed according to the generic information of each single generic.

5. The method according to claim 4, It is characterized in that The determining of generic information of a plurality of single generics in the nested generics based on the generic features includes: According to the generic features, determining a plurality of single generics and the quantity of each single generic in the nested generics; The multiple single generics and the number of the multiple single generics are used as generic information of each of the single generics.

6. The method according to claim 2, It is characterized in that The step of constructing the parameter object according to the type object and the parameter value includes: Parse the parameter value in the form of a character sequence into a parameter value in the form of an object; Construct the parameter object according to the type object and the parameter value in the object form.

7. The method according to claim 1, It is characterized in that Before determining the target method according to the method name and the parameter object, the method further includes: Extracting the class where the method is located from the call request; The determining the target method according to the method name and the parameter object includes: According to the method name and the parameter object, method matching is performed in the class where the method is located, and a target method matching the method name and the parameter object is determined.

8. The method according to claim 1, It is characterized in that If the target method is an instance method, the method further includes: Extracting a call instance name of the target method from the call request, and extracting a target call instance according to the call instance name; The target method is called through the target call instance.

9. A device for service processing, It is characterized in that include: A request information acquisition module, configured to extract a method name and method parameter information of the target method from the call request in response to the call request for the target method; A parameter object construction module, used to construct a parameter object of the target method according to the method parameter information; The target method determination module is used to determine the target method according to the method name and the parameter object.

10. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 8 by executing the executable instructions.

11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.