Parameter analysis method, parameter acquisition method, parameter setting method and device

文档序号:1864720 发布日期:2021-11-19 浏览:5次 中文

阅读说明:本技术 参数解析方法、参数获取方法、参数设置方法以及装置 (Parameter analysis method, parameter acquisition method, parameter setting method and device ) 是由 丁天亮 字亚伟 杨雁杰 邬文锦 于 2020-05-14 设计创作,主要内容包括:本发明提供了一种参数解析方法、参数获取方法、参数设置方法以及装置,本发明的构思在于对复杂结构参数进行精确描述及解析,由此可以极大简化相应的参数设置与获取。具体地,是对网络通信中的报文参数、程序设计语言中的各类参数按预设特定的描述语进行节点名称、类型及表达式的解析,因而可以有效解决现有参数获取、设置方式复杂、繁琐、通用性差、缺乏直观性等问题。同时,通过对参数进行全面、直观地描述,可以精确解析出但不限于参数完整路径、参数类型、参数筛选表达式等,并由此可以为后续参数相关操作提供统一的处理标准,由此可见,本发明在减少代码量的同时拓展了适用性,并极大方便了参数的后期维护操作。(The invention provides a parameter analysis method, a parameter acquisition method, a parameter setting method and a parameter setting device. Specifically, the node name, type and expression are analyzed for message parameters in network communication and various parameters in a programming language according to a preset specific description language, so that the problems of complex and tedious parameter acquisition and setting mode, poor universality, lack of intuition and the like in the prior art can be effectively solved. Meanwhile, through comprehensively and visually describing the parameters, the complete path, the parameter type, the parameter screening expression and the like of the parameters can be accurately analyzed, and a uniform processing standard can be provided for the subsequent parameter related operation, so that the method and the device for processing the parameters can reduce the code amount, expand the applicability and greatly facilitate the later maintenance operation of the parameters.)

1. A parameter resolution method, comprising:

describing the structural information of the processing object by using a preset grammar;

according to the level identification in the preset grammar, carrying out level division on a parameter structure;

traversing each level of data, and acquiring the name of each node, the type of the node and the static description information of the expression based on the attribute description identification and the expression identification in the preset grammar;

extracting an attribute type corresponding to the parameter value of the processing object, obtaining a corresponding instantiation object type according to the attribute type, and completing node type analysis;

clustering the expressions, instantiating functions of the clustered expressions, and completing expression analysis;

and generating a structure description linked list by using the analysis result, and storing the structure description linked list in a cache to form a uniform analysis standard for parameter analysis.

2. The parameter resolution method of claim 1, wherein clustering the expressions comprises:

the expression is resolved into one of three types: array/linked list access class, object attribute non-empty filter class, and object attribute compare class.

3. A method for parameter acquisition, comprising:

converting input data and using the converted input data as an object to be processed;

obtaining a structure description linked list based on the parameter analysis method of claim 1 or 2;

traversing the structure description linked list, and taking out the node names, the node types and the expressions one by one;

and acquiring a corresponding parameter type value from the object to be processed based on the extracted node name, node type and expression.

4. The parameter obtaining method according to claim 3, wherein obtaining the corresponding parameter type value from the object to be processed based on the extracted node name, node type, and expression comprises:

judging whether the first node of the object to be processed is consistent with a preset parameter type;

if not, prompting that the value taking is failed;

if the parameters are consistent with the parameters of the nodes of the object to be processed, the first node is taken as a father node, child nodes of the first node are traversed one by one according to the hierarchy, and after the type of the current child node is determined, the current child node is taken as the father node to continue traversing until the parameter type of each node of the object to be processed is obtained;

the method specifically comprises the following steps:

when the type of the father node is a KEY value pair, taking the name of the father node as a KEY and taking the value of the father node as the type value of the current child node; if the father node has an expression, the type result of the current child node is screened and determined according to the rule of the expression;

when the type of the father node is a linked list, traversing each child node in the linked list, and determining the type of each child node; if a plurality of type values are obtained, constructing an intermediate node of an intermediate linked list type for collecting all the plurality of type values which accord with the expression rule;

when the type of the father node is an intermediate linked list, processing according to the type of the linked list;

and when the type of the father node is other self-defined objects, taking the node type description corresponding to the father node as the type value of the current child node.

5. A method for setting parameters, comprising:

the parameter analysis method according to claim 1 or 2, analyzing the user-defined parameter object and obtaining a corresponding structural description linked list;

traversing the structure description linked list, and taking out the node names, the node types and the expressions one by one;

setting a corresponding parameter type value in the user-defined parameter object based on the extracted node name, node type and expression;

and storing the user-defined parameter object with the set parameters.

6. The parameter setting method according to claim 5, wherein setting the corresponding parameter type value in the custom parameter object based on the retrieved node name, node type, and expression comprises:

judging whether the type of the first node of the user-defined parameter object is consistent with that of a preset node;

if not, creating a new custom parameter object;

if the parameters are consistent with the parameters, the first node is taken as a father node, child nodes of the first node are traversed one by one according to the hierarchy, and after the type of the current child node is set, the current child node is taken as the father node to continue traversing until the parameter type of each node of the user-defined parameter object is set;

the method specifically comprises the following steps:

when the type of the father node is a KEY value pair, taking the name of the father node as a KEY, and taking the value of the father node to set the type value of the current child node; if the father node has an expression, the type result of the current child node is screened and set according to the rule of the expression;

when the type of the father node is a linked list, traversing each child node in the linked list, and determining the type of each child node; if a plurality of type values are obtained, constructing an intermediate node of an intermediate linked list type for collecting all the plurality of type values which accord with the expression rule;

when the type of the father node is an intermediate linked list, processing according to the type of the linked list;

when the type of the father node is other self-defined objects, the class object description corresponding to the father node is taken as the type of the current child node;

in any of the above processing links for different father node types, if the value from the father node is null, a corresponding parameter object is constructed and set for the father node based on the self-defined parameter object.

7. A parameter resolution apparatus, comprising:

the parameter description module is used for describing the structural information of the processing object by using a preset grammar;

the hierarchical division module is used for carrying out hierarchical division on the parameter structure according to the hierarchical identification in the preset grammar;

the hierarchy data reading module is used for traversing each hierarchy data and acquiring the name of each node, the type of the node and the static description information of the expression based on the attribute description identification and the expression identification in the preset grammar;

the type analysis module is used for extracting the attribute type corresponding to the parameter value of the processing object and obtaining the corresponding instantiated object type according to the attribute type;

the expression analysis module is used for clustering the expressions and instantiating the functions of the clustered expressions;

and the structure description linked list generating module is used for generating a structure description linked list by utilizing the analysis result and storing the structure description linked list in a cache so as to form a uniform analysis standard for parameter analysis.

8. A parameter acquisition apparatus, comprising:

the object conversion module is used for converting the input data and taking the converted input data as an object to be processed;

a structure description linked list obtaining module, configured to obtain a structure description linked list based on the parameter analysis method according to claim 1 or 2;

the node information reading module is used for traversing the structure description linked list and taking out the node names, the node types and the expressions one by one;

and the parameter acquisition module is used for acquiring a corresponding parameter type value from the object to be processed based on the extracted node name, node type and expression.

9. A parameter setting apparatus, comprising:

a structural description linked list acquisition module, configured to analyze the user-defined parameter object based on the parameter analysis method of claim 1 or 2, and obtain a corresponding structural description linked list;

the node information reading module is used for traversing the structure description linked list and taking out the node names, the node types and the expressions one by one;

the parameter setting module is used for setting a corresponding parameter type value in the self-defined parameter object based on the extracted node name, node type and expression;

and the pre-storage module is used for storing the self-defined parameter object with the set parameters.

10. A network communication device, comprising:

one or more processors, a memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions which, when executed by the apparatus, cause the apparatus to perform the parameter parsing method of claim 1 or 2 and/or the parameter obtaining method of claim 3 or 4 and/or the parameter setting method of claim 5 or 6.

[ technical field ] A method for producing a semiconductor device

The present invention relates to the field of network communications, and in particular, to a parameter analysis method, a parameter acquisition method, a parameter setting method, and an apparatus.

[ background of the invention ]

At present, messages except web services in network communication are mostly transmitted in other custom formats such as xml, json, binary and the like, and when parameters of data in the xml, json, binary and other various custom formats are obtained, an original message is generally analyzed by using an own framework, or messages information is analyzed and extracted by using tools such as XPATH, JSONPath and the like, and parameter values are obtained through a related framework.

However, the method has the defects that a necessary analysis strategy is lacked, message data is usually converted into an internal object of the program, and required parameters are directly extracted from the object, so that the method is troublesome in dereferencing complex multilayer nested parameters, and the universality is poor; furthermore, although the existing tools such as XPATH and JSONPath can analyze parameters, the existing tools are only suitable for xml and Json format messages, the universality is also poor, and particularly, the specific types of the parameters are not judged, and the corresponding parameter types can be determined only by analyzing service scenes.

[ summary of the invention ]

In view of the foregoing, the present invention aims to provide a parameter parsing method, a parameter obtaining method, a parameter setting method, and an apparatus, and accordingly provides a computer-readable storage medium and a computer program product of a network communication device, which can accurately parse message parameters and various parameters in a programming language in network communication, so as to solve the problems of unclear and intuitive parameter types, poor parameter obtaining and parameter setting accuracy, and difficulty in supporting operations for complex objects.

In a first aspect, the present invention provides a parameter analyzing method, including:

describing the structural information of the processing object by using a preset grammar;

according to the level identification in the preset grammar, carrying out level division on a parameter structure;

traversing each level of data, and acquiring the name of each node, the type of the node and the static description information of the expression based on the attribute description identification and the expression identification in the preset grammar;

extracting an attribute type corresponding to the parameter value of the processing object, obtaining a corresponding instantiation object type according to the attribute type, and completing node type analysis;

clustering the expressions, instantiating functions of the clustered expressions, and completing expression analysis;

and generating a structure description linked list by using the analysis result, and storing the structure description linked list in a cache to form a uniform analysis standard for parameter analysis.

In one possible implementation manner, the clustering the expressions includes:

the expression is resolved into one of three types: array/linked list access class, object attribute non-empty filter class, and object attribute compare class.

In a second aspect, the present invention provides a parameter analyzing apparatus, including:

the parameter description module is used for describing the structural information of the processing object by using a preset grammar;

the hierarchical division module is used for carrying out hierarchical division on the parameter structure according to the hierarchical identification in the preset grammar;

the hierarchy data reading module is used for traversing each hierarchy data and acquiring the name of each node, the type of the node and the static description information of the expression based on the attribute description identification and the expression identification in the preset grammar;

the type analysis module is used for extracting the attribute type corresponding to the parameter value of the processing object and obtaining the corresponding instantiated object type according to the attribute type;

the expression analysis module is used for clustering the expressions and instantiating the functions of the clustered expressions;

and the structure description linked list generating module is used for generating a structure description linked list by utilizing the analysis result and storing the structure description linked list in a cache so as to form a uniform analysis standard for parameter analysis.

In a third aspect, the present invention provides a parameter obtaining method, including:

converting input data and using the converted input data as an object to be processed;

obtaining a structure description linked list based on the parameter analysis method;

traversing the structure description linked list, and taking out the node names, the node types and the expressions one by one;

and acquiring a corresponding parameter type value from the object to be processed based on the extracted node name, node type and expression.

In one possible implementation manner, the obtaining, based on the extracted node name, node type, and expression, a corresponding parameter type value from the object to be processed includes:

judging whether the first node of the object to be processed is consistent with a preset parameter type;

if not, prompting that the value taking is failed;

if the parameters are consistent with the parameters of the nodes of the object to be processed, the first node is taken as a father node, child nodes of the first node are traversed one by one according to the hierarchy, and after the type of the current child node is determined, the current child node is taken as the father node to continue traversing until the parameter type of each node of the object to be processed is obtained;

the method specifically comprises the following steps:

when the type of the father node is a KEY value pair, taking the name of the father node as a KEY and taking the value of the father node as the type value of the current child node; if the father node has an expression, the type result of the current child node is screened and determined according to the rule of the expression;

when the type of the father node is a linked list, traversing each child node in the linked list, and determining the type of each child node; if a plurality of type values are obtained, constructing an intermediate node of an intermediate linked list type for collecting all the plurality of type values which accord with the expression rule;

when the type of the father node is an intermediate linked list, processing according to the type of the linked list;

and when the type of the father node is other self-defined objects, taking the node type description corresponding to the father node as the type value of the current child node.

In a fourth aspect, the present invention provides a parameter obtaining apparatus, including:

the object conversion module is used for converting the input data and taking the converted input data as an object to be processed;

the structure description linked list acquisition module is used for acquiring a structure description linked list based on the parameter analysis method;

the node information reading module is used for traversing the structure description linked list and taking out the node names, the node types and the expressions one by one;

and the parameter acquisition module is used for acquiring a corresponding parameter type value from the object to be processed based on the extracted node name, node type and expression.

In a fifth aspect, the present invention provides a parameter setting method, including:

analyzing the user-defined parameter object based on the parameter analysis method to obtain a corresponding structural description linked list;

traversing the structure description linked list, and taking out the node names, the node types and the expressions one by one;

setting a corresponding parameter type value in the user-defined parameter object based on the extracted node name, node type and expression;

and storing the user-defined parameter object with the set parameters.

In one possible implementation manner, the setting, based on the extracted node name, node type, and expression, a corresponding parameter type value in the custom parameter object includes:

judging whether the type of the first node of the user-defined parameter object is consistent with that of a preset node;

if not, creating a new custom parameter object;

if the parameters are consistent with the parameters, the first node is taken as a father node, child nodes of the first node are traversed one by one according to the hierarchy, and after the type of the current child node is set, the current child node is taken as the father node to continue traversing until the parameter type of each node of the user-defined parameter object is set;

the method specifically comprises the following steps:

when the type of the father node is a KEY value pair, taking the name of the father node as a KEY, and taking the value of the father node to set the type value of the current child node; if the father node has an expression, the type result of the current child node is screened and set according to the rule of the expression;

when the type of the father node is a linked list, traversing each child node in the linked list, and determining the type of each child node; if a plurality of type values are obtained, constructing an intermediate node of an intermediate linked list type for collecting all the plurality of type values which accord with the expression rule;

when the type of the father node is an intermediate linked list, processing according to the type of the linked list;

when the type of the father node is other self-defined objects, the class object description corresponding to the father node is taken as the type of the current child node;

in any of the above processing links for different father node types, if the value from the father node is null, a corresponding parameter object is constructed and set for the father node based on the self-defined parameter object.

In a sixth aspect, the present invention provides a parameter setting apparatus, including:

the structure description linked list acquisition module is used for analyzing the user-defined parameter object based on the parameter analysis method and acquiring a corresponding structure description linked list;

the node information reading module is used for traversing the structure description linked list and taking out the node names, the node types and the expressions one by one;

the parameter setting module is used for setting a corresponding parameter type value in the self-defined parameter object based on the extracted node name, node type and expression;

and the pre-storage module is used for storing the self-defined parameter object with the set parameters.

In a seventh aspect, the present invention provides a network communication device, including:

one or more processors, a memory, which may employ a non-volatile storage medium, and one or more computer programs, which are stored in the memory, the one or more computer programs including instructions that, when executed by the apparatus, cause the apparatus to perform the above-described parameter parsing method and/or the above-described parameter obtaining method and/or the above-described parameter setting method.

In an eighth aspect, the present invention provides a computer-readable storage medium having stored therein a computer program which, when run on a computer, causes the computer to execute the above-described parameter analysis method and/or the above-described parameter acquisition method and/or the above-described parameter setting method.

In a ninth aspect, the present invention further provides a computer program product, which is used to execute the above parameter analysis method and/or the above parameter acquisition method and/or the above parameter setting method when being executed by a computer or other devices.

In a possible design of the ninth aspect, the relevant program related to the product may be stored in whole or in part on a memory packaged with the processor, or may be stored in part or in whole on a storage medium not packaged with the processor.

The invention has the conception that the parameters with complex structures are accurately described, the setting and the acquisition of the parameters can be greatly simplified, the positions of the parameters can be visually shown, and the specific types can be directly and clearly specified by setting the types of the parameters. Specifically, a specific description language is preset for message parameters in network communication and various parameters in a programming language, and the parameters are analyzed based on the content in the description language, so that the problems of complex and tedious setting mode, poor generality, lack of intuitiveness and the like of the conventional parameter acquisition can be effectively solved. Meanwhile, through comprehensively and visually describing the parameters, the complete path, the parameter type, the parameter screening expression and the like of the parameters can be accurately analyzed, and a uniform processing standard can be provided for the subsequent parameter related operation, so that the method and the device for processing the parameters can reduce the code amount, expand the applicability and greatly facilitate the later maintenance operation of the parameters.

Based on the parameter obtaining and setting scheme, the invention further has the following beneficial effects:

1) simplifying the acquisition and setting modes of the parameters: through intuitive description and accurate analysis of the parameters, the acquisition and the setting of the parameters can be uniformly processed according to a set standard without compiling different codes for each parameter, so that the code amount can be reduced, and the readability and the universality can be improved; the method has the advantages that the tasks which can be completed by writing a large number of loop statements in the existing mode can be realized by using very few codes for complex objects, and the development efficiency is greatly improved.

2) Do benefit to the later maintenance: the parameter structure, the type and the like can be visually displayed, and the later-stage parameter maintenance is facilitated. If the parameters need to be newly added or modified in the later period, the large section of codes and the relevant codes do not need to be read, so that the complicated operation can be effectively avoided, and the associated errors caused by more operations are particularly avoided. After the parameters are analyzed by the method provided by the invention, the complete parameter path can be obtained, and when the parameter setting and adjustment are needed in the later period, only a small amount of modification needs to be carried out on the parameter path.

[ description of the drawings ]

In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.

Fig. 1 is a flowchart of a parameter analysis method according to an embodiment of the present invention;

fig. 2 is a flowchart of a parameter obtaining method according to an embodiment of the present invention;

fig. 3 is a flowchart of a parameter setting method according to an embodiment of the present invention;

fig. 4 is a schematic diagram of a parameter analysis apparatus according to an embodiment of the present invention;

fig. 5 is a schematic diagram of a parameter obtaining apparatus according to an embodiment of the present invention;

FIG. 6 is a diagram illustrating a parameter setting apparatus according to an embodiment of the present invention;

fig. 7 is a schematic diagram of a network communication device according to an embodiment of the present invention.

[ detailed description ] embodiments

Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.

Before explaining the technical scheme of the invention, the existing message analysis and the corresponding parameter operation mode are introduced.

For xml, json, binary and other format messages, the general idea is to use various open source frames to analyze xml and json messages, then convert the xml and json messages into internal objects in deserialization and other ways, and similarly, convert the binary messages into the internal objects in deserialization and then obtain parameter values from the internal objects.

As described above, some structural description languages also exist at present, such as XPATH for describing xml and json path for describing json, and some open source frameworks have already implemented XPATH and json path related functions, and can perform setting, value taking and other operations on xml and json more conveniently compared with the conventional manner, for example, fastjson implements json the json related functions, and libxml2 implements the XPATH related functions.

However, as a result of further analysis by the present invention, the above-mentioned methods still have their respective drawbacks:

1) the traditional parameter acquisition and setting mode is complex and tedious. When obtaining various other custom format parameters such as xml, json, binary and the like, the method generally only needs to convert the parameters into the internal objects of the program and then directly obtain the required parameters from the objects. The complicated multilayer nested parameter values are inconvenient and complicated, for example, List-b is taken from List-a, Map-c is taken from List-b, and finally Key-d is taken from Map-c. For similar value-taking tasks, the common method is to traverse List-a to obtain List-b, traverse List-b to obtain Map-c, and finally obtain the value of Key-d from Map-c. When compiling codes, two for loops and a get method need to be set to obtain the value of Key-d, and particularly, if a parameter is changed, similar code values need to be repeated, so that the implementation is troublesome, a large amount of codes are needed to be realized, the parameter setting is also troublesome, and the later maintenance is very unfavorable.

2) The frames such as XPATH, JSONPath and the like are used, although parameters can be set and obtained conveniently to a certain extent, the method also has various defects, such as limitation on message formats, poor universality, incapability of intuitively and accurately obtaining parameter types and capability of judging only according to specific services.

In view of the above, on the basis of the XPATH and JSONPath description languages, the present invention is further extended and improved to provide a set of parameter parsing ideas based on specific syntax, and accordingly, the functions of parameter acquisition and setting are realized. Through the embodiments of the present invention described below, the specific position, type, etc. of the parameter in the object can be visually represented, and thus the precise obtaining and setting of the parameter value can be realized, and any complex object operation can be supported, for example, but not limited to, operations supporting multiple layers of nested complex parameters, such as any combination of multiple layers of maps and multiple layers of lists as exemplified above.

Accordingly, the present invention provides at least one embodiment of a parameter analysis method, as shown in fig. 1, which includes the following steps:

step S1, describing the structure information of the processing object by using the preset grammar;

step S2, according to the level identification in the preset grammar, the parameter structure is divided into levels;

step S3, traversing each level of data, and acquiring the static description information of each node name, node type and expression based on the attribute description identification and expression identification in the preset grammar;

step S4, extracting the attribute type corresponding to the parameter value of the processing object, obtaining the corresponding instantiation object type according to the attribute type, and completing the node type analysis;

step S5, clustering the expressions, instantiating functions of the clustered expressions, and completing expression analysis;

and step S6, generating a structure description linked list by using the analysis result, and storing the structure description linked list in a cache to form a uniform analysis standard for parameter analysis.

In actual practice, the definition of a specific description language may be made based on the following examples: the hierarchy delimiter may be "" "/" etc., and each layer format may be KEY @ _ TYPE _ [ expression ], where:

1) KEY: a key, i.e., a node name, may not be null except for the parent node that is the root node.

2) @: attribute specifier, which is followed by TYPE of KEY.

For example: @ java.util.hashmap < java.lang.string, java.lang.integer > indicates the type of KEY is HashMap < String, Integer >; lang, STRING or STRING indicates that the type is a STRING, of course, if no attribute is specified, the STRING may be defaulted to, i.e., _ STRING _.

Generally, the node types supported by the system may refer to the following, which is conventional in the art and will not be described in detail:

_STRING_:java.lang.String

_INTEGER_:java.lang.Integer

_LONG_:java.lang.Long

_DOUBLE_:java.lang.Double

_BOOLEAN_:java.lang.Boolean

_BYTE_:java.lang.Byte

_SHORT_:java.lang.Short

_FLOAT_:java.lang.Float

_CHAR_:java.lang.Character

_ARRAY_:java.util.ArrayList

_MAP_:java.util.HashMap

_LIST_:java.util.ArrayList

3) the expression is used for describing specific rules of the array and the linked list:

[ n ]: array access, where n is a number;

[ n0, n1, n2.. ]: array multiple element access, where n is a number, returning multiple elements in the array;

end [ start ]: array range access, where start and end are the start small table and end subscript;

[? (key) ]: object attribute non-empty filtering;

[ key > -12 ]: object attribute comparison filtering, comparison operator support! (ii) a value of ">, < >;

based on the foregoing, a parameter structure description example using the above specific syntax is given:

list _ A @ _ LIST _ < _ STRING _ > [0 ]: describing the first value in List _ A;

class _ A @ com.test.class _ A/Class _ B @ com.test.class _ B/Class _ C @ com.test.class _ C/List _ D @ LIST _ < _ STRING _ [0 ]: the description takes an object Class _ B from the object Class _ a, an object Class _ C from the object Class _ B, a List _ D from the object Class _ C, and a List value. If the Class _ B attribute in the object Class _ A is not visible, the process automatically transitions to getClass _ B () or setClass _ B () process.

With reference to fig. 1, a corresponding detailed description is provided herein. Converting or deserializing input data in other formats such as xml, json, binary data and the like into an internal object by using the existing method, wherein the internal object is the object to be processed. And then, describing the object to be processed by combining the appointed grammar, and analyzing to obtain a parameter structure description linked list. Specifically, the parameter structure is divided according to the hierarchy description identification, data of each hierarchy is obtained, data of each hierarchy is traversed, and static description information of each node name, node type and expression is obtained according to the attribute description identification "@" and the expression identification "[ ]". And when the attribute type is analyzed, acquiring the attribute type corresponding to the parameter value of the object to be processed, and acquiring the corresponding Class object according to the attribute type value. If the acquisition fails (if the node is missing and no parameter exists), the analysis is considered to fail, and the exception can be thrown out at the moment; when interpreting the contents of an expression, the expression can be categorized into, but not limited to, the following three types:

array/List access (e.g., List _ A @ _ LIST _ < _ STRING _ > [0,1,2 ]);

object attribute non-empty filtering (e.g., Map _ a @ _ Map _ < _ strong [;

object attribute comparison (e.g., Map _ a @ _ Map _ < _ interval _ > [ value >12 ]);

after analyzing the above various types respectively, instantiating a related processing method; similarly, if an exception occurs, the message is thrown out and the analysis is failed is prompted. Finally, after the analysis is successful, the corresponding structural description linked list is output, the analysis result is put into the cache, and then when the same structural object is processed, the analysis description result can be directly obtained from the cache without repeated analysis operation, so that the program processing speed can be effectively improved.

Accordingly, the present invention further provides an embodiment of a parameter obtaining method, as shown in fig. 2, including:

step S10, converting the input data and using the converted input data as an object to be processed;

step S20, obtaining a structure description linked list based on the parameter analysis method;

step S30, traversing the structure description linked list, and taking out the node names, the node types and the expressions one by one;

and step S40, acquiring a corresponding parameter type value from the object to be processed based on the extracted node name, node type and expression.

Specifically to step S40, the present invention provides the following, but non-limiting, implementation references:

firstly, judging whether a first node of the object to be processed is consistent with a preset parameter type; that is, it is determined whether the root node and the type thereof are legal, and if the root node and the type thereof are not matched with the pre-stored data type, the root node and the type thereof cannot be analyzed, so that an exception can be thrown out, and a user is prompted that the class of object cannot be processed. It can be further explained here that, in the actual operation, whether the name of the first node of the traversal search is limited, that is, the present invention does not impose the requirement on the initial search path, and in some scenarios, any node can be regarded as the first node, that is, the root node, and the parent node of other nodes.

Of course, if it is determined that the first node matches the type of the object pre-stored in the system, the first node may be used as a parent node, and the child nodes (i.e., non-first nodes) of the first node are traversed one by one according to the hierarchical relationship, and after the type of the current child node is determined, the current child node is used as the parent node to continue traversing until the parameter types of the nodes of the object to be processed are obtained.

In the process of traversing the nodes layer by layer, for the values of each level of child node types, the following corresponding processing modes for different types of parent nodes can be referred to:

(1) when the type of the father node is a KEY value pair MAP, taking the name of the father node as a KEY and taking the value of the father node as the type value of the current child node; if the father node has an expression, the type result of the current child node is screened and determined according to the rule of the expression;

(2) when the type of the father node is a linked LIST, traversing each child node in the linked LIST, and performing cyclic processing to determine the type of each child node; at this time, there are a plurality of nodes that may accord with the expression rule, that is, a plurality of type values are obtained, and then an intermediate node of an intermediate linked list type part can be constructed to collect all the plurality of type values that accord with the expression rule;

(3) when the type of the father node is the middle linked LIST PARTLIIST, processing according to the type of the linked LIST LIST;

(4) and when the type of the father node is other self-defined objects, taking the node type description corresponding to the father node as the type value of the current child node, namely accessing the range of the domain value of the self-defined object, and of course, if the domain value is inaccessible, taking out the empty object.

Correspondingly, the present invention further provides an embodiment of a parameter setting method, as shown in fig. 3, including:

s100, analyzing the user-defined parameter object based on the parameter analysis method to obtain a corresponding structural description linked list;

s200, traversing the structure description linked list, and taking out the node names, the node types and the expressions one by one;

step S300, setting corresponding parameter type values in the user-defined parameter objects based on the extracted node names, node types and expressions;

and S400, storing the user-defined parameter object with the set parameters.

It should be noted that the parameter setting concept is similar to the parameter obtaining concept, and can be understood as an inverse process, that is, a user-defined data object is given, the concept of analyzing and obtaining parameters is referred to, the parameter setting is performed on the user-defined data, and the user-defined data is stored in the system to be used for performing the operation of obtaining the parameter on the external input data.

In summary, the idea of the present invention is to accurately describe the parameters of the complex structure, so as to greatly simplify the setting and obtaining of the parameters, visually display the positions of the parameters, and directly and clearly specify the specific types for setting the types of the parameters. Specifically, a specific description language is preset for message parameters in network communication and various parameters in a programming language, and the parameters are analyzed based on the content in the description language, so that the problems of complex and tedious setting mode, poor generality, lack of intuitiveness and the like of the conventional parameter acquisition can be effectively solved. Meanwhile, through comprehensively and visually describing the parameters, the complete path, the parameter type, the parameter screening expression and the like of the parameters can be accurately analyzed, and a uniform processing standard can be provided for the subsequent parameter related operation, so that the method and the device for processing the parameters can reduce the code amount, expand the applicability and greatly facilitate the later maintenance operation of the parameters.

Based on the parameter obtaining and setting scheme, the invention further has the following beneficial effects:

1) simplifying the acquisition and setting modes of the parameters: through intuitive description and accurate analysis of the parameters, the acquisition and the setting of the parameters can be uniformly processed according to a set standard without compiling different codes for each parameter, so that the code amount can be reduced, and the readability and the universality can be improved; the method has the advantages that the tasks which can be completed by writing a large number of loop statements in the existing mode can be realized by using very few codes for complex objects, and the development efficiency is greatly improved.

2) Do benefit to the later maintenance: the parameter structure, the type and the like can be visually displayed, and the later-stage parameter maintenance is facilitated. If the parameters need to be newly added or modified in the later period, the large section of codes and the relevant codes do not need to be read, so that the complicated operation can be effectively avoided, and the associated errors caused by more operations are particularly avoided. After the parameters are analyzed by the method provided by the invention, the complete parameter path can be obtained, and when the parameter setting and adjustment are needed in the later period, only a small amount of modification needs to be carried out on the parameter path.

Corresponding to the above embodiments and preferred solutions, the present invention further provides embodiments of a parameter analyzing device, a parameter obtaining device, and a parameter setting device, as shown in fig. 4, fig. 5, and fig. 6, which may specifically include the following components:

parameter analysis device 100:

a parameter description module 101, configured to describe structure information of a processing object by using a preset syntax;

the hierarchical division module 102 is configured to perform hierarchical division on the parameter structure according to the hierarchical identifier in the preset syntax;

the hierarchical data reading module 103 is configured to traverse each hierarchical data, and obtain each node name, node type, and static description information of an expression based on the attribute description identifier and the expression identifier in the preset syntax;

the type analysis module 104 is used for extracting an attribute type corresponding to the parameter value of the processing object and obtaining a corresponding instantiation object type according to the attribute type;

the expression analysis module 105 is used for clustering the expressions and instantiating the functions of the clustered expressions;

and the structure description linked list generating module 106 is configured to generate a structure description linked list according to the analysis result, and store the structure description linked list in a cache to form a uniform analysis standard for parameter analysis.

The parameter acquisition device 200:

an object conversion module 201, configured to convert input data and serve as an object to be processed;

a structure description linked list obtaining module 202, configured to obtain a structure description linked list based on the parameter analysis method;

the node information reading module 203 is used for traversing the structure description linked list and taking out the node names, the node types and the expressions one by one;

and the parameter obtaining module 204 is configured to obtain a corresponding parameter type value from the object to be processed based on the extracted node name, node type, and expression.

The parameter setting device 300:

a structural description linked list obtaining module 301, configured to analyze the user-defined parameter object based on the parameter analysis method, and obtain a corresponding structural description linked list;

a node information reading module 302, configured to traverse the structure description linked list, and take out node names, node types, and expressions one by one;

a parameter setting module 303, configured to set a corresponding parameter type value in the custom parameter object based on the extracted node name, node type, and expression;

and the pre-storage module 304 is configured to store the user-defined parameter object with the set parameter.

It should be understood that the division of the components of the devices shown in fig. 4, 5, and 6 is merely a logical division, and the actual implementation may be wholly or partially integrated into one physical entity or physically separated. And these components may all be implemented in software invoked by a processing element; or may be implemented entirely in hardware; and part of the components can be realized in the form of calling by the processing element in software, and part of the components can be realized in the form of hardware. For example, a certain module may be a separate processing element, or may be integrated into a certain chip of the electronic device. Other components are implemented similarly. In addition, all or part of the components can be integrated together or can be independently realized. In implementation, each step of the above method or each component above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.

For example, the above components may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors (DSPs), one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, these components may be integrated together and implemented in the form of a System-On-a-Chip (SOC).

In view of the foregoing examples and their preferred embodiments, it will be appreciated by those skilled in the art that in practice, the invention may be practiced in a variety of embodiments, and that the invention is illustrated schematically in the following vectors:

(1) a network communication device, which may comprise:

one or more processors, memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions, which when executed by the apparatus, cause the apparatus to perform the steps/functions of the foregoing embodiments or equivalent implementations.

Fig. 7 is a schematic structural diagram of an embodiment of a network communication device provided in the present invention, where the device may be an electronic device or a circuit device built in the electronic device. The electronic equipment can be a PC, a server, an intelligent mobile terminal (a mobile phone, a tablet, a watch, glasses and the like), an intelligent television, a sound box, a set top box, a remote controller, an intelligent screen, a teller machine, a robot, an unmanned aerial vehicle, an ICV, an intelligent (automobile) vehicle, an on-board device and the like.

As shown in particular in fig. 7, the network communication device 900 includes a processor 910 and a memory 930. Wherein, the processor 910 and the memory 930 can communicate with each other and transmit control and/or data signals through the internal connection path, the memory 930 is used for storing computer programs, and the processor 910 is used for calling and running the computer programs from the memory 930. The processor 910 and the memory 930 may be combined into a single processing device, or more generally, separate components, and the processor 910 is configured to execute the program code stored in the memory 930 to implement the functions described above. In particular implementations, the memory 930 may be integrated with the processor 910 or may be separate from the processor 910.

In addition, to further enhance the functionality of the network communication device 900, the device 900 may further include one or more of an input unit 960, a display unit 970, an audio circuit 980, a camera 990, a sensor 901, etc., which may further include a speaker 982, a microphone 984, etc. The display unit 970 may include a display screen, among others.

Further, the network communication device 900 may also include a power supply 950 for providing power to various devices or circuits within the device 900.

It should be understood that the network communication device 900 shown in fig. 7 is capable of implementing the various processes of the methods provided by the foregoing embodiments. The operations and/or functions of the various components of the apparatus 900 may each be configured to implement the corresponding flow in the above-described method embodiments. Reference is made in detail to the foregoing description of embodiments of the method, apparatus, etc., and a detailed description is omitted here as appropriate to avoid redundancy.

It should be understood that the processor 910 in the network communication device 900 shown in fig. 7 may be a system on chip SOC, and the processor 910 may include a Central Processing Unit (CPU), and may further include other types of processors, such as: an image Processing Unit (GPU), etc., which will be described in detail later.

In summary, various portions of the processors or processing units within the processor 910 may cooperate to implement the foregoing method flows, and corresponding software programs for the various portions of the processors or processing units may be stored in the memory 930.

(2) A readable storage medium, on which a computer program or the above-mentioned apparatus is stored, which, when executed, causes the computer to perform the steps/functions of the above-mentioned embodiments or equivalent implementations.

In the several embodiments provided by the present invention, any function, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on this understanding, some aspects of the present invention may be embodied in the form of software products, which are described below, or portions thereof, which substantially contribute to the art.

(3) A computer program product (which may comprise the above-mentioned means) which, when run on a terminal device, causes the terminal device to perform the steps/functions of the preceding embodiments or equivalent implementations.

From the above description of the embodiments, it is clear to those skilled in the art that all or part of the steps in the above implementation method can be implemented by software plus a necessary general hardware platform. With this understanding, the above-described computer program products may include, but are not limited to, refer to APP; continuing on, the aforementioned device/terminal may be a computer device (e.g., a mobile phone, a PC terminal, a cloud platform, a server cluster, or a network communication device such as a media gateway). Moreover, the hardware structure of the computer device may further specifically include: at least one processor, at least one communication interface, at least one memory, and at least one communication bus; the processor, the communication interface and the memory can all complete mutual communication through the communication bus. The processor may be a central Processing unit CPU, a DSP, a microcontroller, or a digital Signal processor, and may further include a GPU, an embedded Neural Network Processor (NPU), and an Image Signal Processing (ISP), and may further include a specific integrated circuit ASIC, or one or more integrated circuits configured to implement the embodiments of the present invention, and the processor may have a function of operating one or more software programs, and the software programs may be stored in a storage medium such as a memory; and the aforementioned memory/storage media may comprise: non-volatile memories (non-volatile memories) such as non-removable magnetic disks, U-disks, removable hard disks, optical disks, etc., and Read-Only memories (ROM), Random Access Memories (RAM), etc.

In the embodiments of the present invention, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, and means that there may be three relationships, for example, a and/or B, and may mean that a exists alone, a and B exist simultaneously, and B exists alone. Wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c may represent: a, b, c, a and b, a and c, b and c or a and b and c, wherein a, b and c can be single or multiple.

Those of skill in the art will appreciate that the various modules, elements, and method steps described in the embodiments disclosed in this specification can be implemented as electronic hardware, combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

In addition, the embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments may be referred to each other. In particular, for embodiments of devices, apparatuses, etc., since they are substantially similar to the method embodiments, reference may be made to some of the descriptions of the method embodiments for their relevant points. The above-described embodiments of devices, apparatuses, etc. are merely illustrative, and modules, units, etc. described as separate components may or may not be physically separate, and may be located in one place or distributed in multiple places, for example, on nodes of a system network. Some or all of the modules and units can be selected according to actual needs to achieve the purpose of the above-mentioned embodiment. Can be understood and carried out by those skilled in the art without inventive effort.

The structure, features and effects of the present invention have been described in detail with reference to the embodiments shown in the drawings, but the above embodiments are merely preferred embodiments of the present invention, and it should be understood that technical features related to the above embodiments and preferred modes thereof can be reasonably combined and configured into various equivalent schemes by those skilled in the art without departing from and changing the design idea and technical effects of the present invention; therefore, the invention is not limited to the embodiments shown in the drawings, and all the modifications and equivalent embodiments that can be made according to the idea of the invention are within the scope of the invention as long as they are not beyond the spirit of the description and the drawings.

22页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种Office文档加密方法和解密方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类