Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to FIG. 1, a data processing system is shown according to an embodiment of the present application. As shown in FIG. 1, the data processing system includes a client 101 and a server 102. The client 101 and the server 102 are connected through a wired network or a wireless network. It should be noted that, the implementation environment may include one or more clients, and fig. 1 illustrates that the implementation environment includes only one client.
The server 102 may be configured to generate target Fair DSL data of the interface to be generated. The generated target fairdsl data is transmitted to the client 101. The target Fair DSL data may be a structure description file corresponding to the interface to be generated. The client 101 may receive target fairdsl data sent by the server 102. The target Fair DSL data is parsed to generate an interface, i.e., the generated interface is displayed at the client. Alternatively, the client 101 may store the target FairDSL data of the interface to be generated after receiving the target fairdsl data sent by the server 102. And responding to an interface display instruction triggered by a user, acquiring stored target Fair DSL data, and displaying an interface. Or the client 101 may generate an interface display request in response to a trigger display operation of the user for a page to be generated. And sending the interface display request to the server to receive target Fair DSL data corresponding to the interface to be generated, which is sent by the server in response to the interface display request, so as to display the interface. Alternatively, the client 101 may be installed at a terminal. The terminal can be a mobile phone, a tablet computer or wearable equipment, etc. The server 102 may be one server, or may be a service cluster formed by a plurality of servers.
Referring to fig. 2, a flowchart of a data processing method according to an embodiment of the application is shown. The data processing method may be applied to the data processing system shown in fig. 1, and executed by a server in the data processing system shown in fig. 1. As shown in fig. 2, the data processing method may include:
Step 201, converting Flutter source code data corresponding to an interface to be generated into initial FairDSL data through Fair. The Flutter source code data comprise first source code data and second source code data, wherein the first source code data are Flutter source code data corresponding to a target component in an interface to be generated, the second source code data are Flutter source code data written into a specific method function, and the second source code data comprise calling sentences for the first source code data.
In the embodiment of the application, the server adopts Flutter and Fair to write the interface to be generated, and compiles the interface by utilizing a Flutter compiler to obtain initial Fair DSL data. The interface to be generated is Flutter interface, namely UI interface constructed by Flutter. The data structure of Flutter interfaces is a component (Widget) tree structure, i.e., a tree data structure composed of a plurality of components. The basic building element of Flutter interfaces is widgets, each of which may also include one or more widgets. And obtaining the Widget tree forming the interface through layer-by-layer wrapping of the Widget.
Wherein the interface may include a plurality of UI components. There is a class of widgets that can be used to encapsulate UI components. The component FairDSL data corresponding to the widgets can be used for describing the structure of the UI component, so that after the component FairDSL data is parsed, the UI component can be drawn. Alternatively, the target component (target Widget) may refer to an independent component for packaging the UI component. The Flutter source code data corresponding to the independent component is not written into the specific method function.
In the embodiment of the application, the server side can convert Flutter source code data corresponding to the interface to be generated into initial Fair DSL data through the Fair by utilizing Flutter compiler. In the process of converting the second source code data written into the specific method function, the first source code data is called through a calling statement aiming at the first source code data so as to convert the first source code data. And the Flutter source code data corresponding to the interface to be generated are converted into initial Fair DSL data.
Step 202, extracting component Fair DSL data corresponding to the target component from the initial Fair DSL data, and interface Fair DSL data corresponding to the specific method function, wherein the interface Fair DSL data comprises a target component identifier corresponding to the target component.
In an alternative implementation, as shown in fig. 3, the process of extracting, by the server, component fairdsl data corresponding to the target component and interface fairdsl data corresponding to the specific method function from the initial fairdsl data may include:
step 301, the server converts the initial Fair DSL data into abstract syntax tree data.
In the embodiment of the application, the server side can perform abstract syntax tree (Abstract Syntax Tree, AST) analysis on the initial Fair DSL data to obtain AST data corresponding to the initial Fair DSL data. AST is an abstract representation of the syntax structure of source code data (also known as source code). It represents the syntax structure of the programming language in the form of a tree, each node on the tree representing a structure in the source code data.
Step 302, the server side extracts the component data corresponding to the target component under the component label node in the AST, and generates component Fair DSL data corresponding to the target component identifier based on the component data.
In the embodiment of the application, the component tag node refers to a node for indicating a Flutter source code data corresponding structure for describing a target component. The server side can traverse all nodes in AST data, and the component data corresponding to the target component under the component label node is obtained through screening. In an alternative implementation, where the target component is used to encapsulate an independent component of the UI component, the component tag node refers to a node that is used to indicate an independent Flutter source code data structure.
Alternatively, in the case where the object of the target component is a function, i.e., the target component is an encapsulation function. The component identifier corresponding to the target component may be a function name (className). The component tag nodes may include nodes with a node type of function declaration (FunctionDeclaration) and/or nodes with a node type of method declaration (MethodDeclaration). For ease of illustration, function declaration nodes are employed to indicate that the node type is a function declaration node. The method declaration node is adopted to indicate that the node type is the node of the method declaration. The component tag node includes a function declaration node and/or a method declaration node. It should be noted that, in the case where the component tag node is of the method declaration type, the component identifier of the target component does not include a function name of a specific method function (build method function).
The process of extracting the component data corresponding to the target component under the component tag node in the AST by the server side may include extracting the component data (function data) corresponding to each function name under the function declaration node in the AST by the server side, and extracting the component data (function data) corresponding to each function name except the function name of the specific method function in each function under the method declaration node.
In the embodiment of the application, the server side adopts the standard format of the component FairDSL to convert the component data corresponding to the target component into the component FairDSL data. Alternatively, the data format of the component Fair DSL data may be JSON. For example, the component FairDSL standard format may be:
"{" className ":" target component identification ",
"Na": { component data } "and"
If the component data indicates that the target component indicated by the target component identifier has a sub-component (i.e. a nested dynamic component), the component fairdsl standard format may be:
In step 303, the server extracts the target data except the component data corresponding to the target component in the AST, and generates the interface Fair DSL data based on the target data.
In the embodiment of the application, the server can traverse each node in AST data, and screen and obtain the target data except the component data corresponding to the target component under each node. And the server side converts the target data into interface FairDSL data by adopting an interface Fair DSL standard format. The interface Fair DSL standard format can be set based on actual service requirements.
For example, as shown in fig. 4, the server generates initial fairdsl data, and traverses each node in AST data corresponding to the initial fairdsl data. For any node, the server side judges whether the node is a function declaration node. If the node is a function declaration node (FunctionDeclaration), extracting each function name and component data corresponding to the function name under the function declaration node, and generating component Fair DSL data corresponding to each function name. If the node is not a function declaration node, it is determined whether the node is a method declaration node (MethodDeclaration). If the node is not the method statement node, extracting target data under the node, and generating interface FairDSL data. If the node is a method declaration node, judging whether the function name corresponding to the component data is a specific function name (build) of a specific method function or not according to the component data under the method declaration node, namely judging whether the function corresponding to the component data is a specific method function or not. And if the function name is not the specific function name, extracting the function name and the component data corresponding to the function name, and generating the component Fair DSL data corresponding to the function name. And if the function name is a specific function name, extracting target data corresponding to the specific function name, and generating interface Fair DSL data. The function names and corresponding component Fair DSL data are written into a method dictionary (methodMap), and interface Fair DSL data are written into a DSL dictionary (Map).
In another alternative implementation, component Fair DSL data corresponding to the target component, and interface Fair DSL data corresponding to the specific method function may be manually extracted from the initial Fair DSL data.
And 203, adding component Fair DSL data corresponding to the target component to the interface Fair DSL data to generate target Fair DSL data.
Optionally, the server adds the component Fair DSL data corresponding to the target component to the interface Fair DSL data, and various implementation manners for generating the target Fair DSL data are provided.
In a first alternative implementation, the process of adding, by the server, component fairdsl data corresponding to the target component to the interface FairDSL data may include adding, by the server, first mapping data to the interface fairdsl data, to obtain target FairDSL data. The first mapping data includes a target component identification and associated stored component Fair DSL data corresponding to the target component.
The server may obtain, based on the target component identifier, component fairdsl data stored in association with the target component identifier from the stored component fairdsl data, and generate first mapping data. Alternatively, the data format of the first mapping data may be a dictionary format. The first mapping data may be referred to as a method dictionary (methodMap). The first mapping data includes a first key-value pair, a key field of the first key-value pair is used for storing a target component identifier, and a value field is used for storing corresponding component Fair DSL data.
In a second alternative implementation, the process of adding the component FairDSL data corresponding to the target component to the interface FairDSL data by the server may include generating second mapping data. The second mapping data includes method dictionary identifications and associated stored first mapping data. And adding second mapping data to the interface Fair DSL data to obtain target Fair DSL data. Wherein the method dictionary identification is used to indicate component FairDSL data support calls in the first mapping data.
The server may generate the second mapping data after generating the first mapping data. The generation of the first mapping data may refer to the generation of the first mapping data in the aforementioned second alternative implementation manner. The embodiments of the present application will not be described in detail again. Alternatively, the data format of the second mapping data may be a dictionary format. The second mapping data includes a second key-value pair, a key field of the second key-value pair is used for storing a method dictionary identification, and a value field is used for storing corresponding first mapping data.
In a third alternative implementation manner, the process of adding, by the server, component fairdsl data corresponding to the target component to the interface FairDSL data may include directly adding, by the server, component fairdsl data corresponding to the target component to the interface fairdsl data, to obtain the target fairdsl data.
The server may extract, from the stored component Fair DSL data, component Fair DSL data stored in association with the target component identifier based on the target component identifier. And adding the component Fair DSL data to the interface Fair DSL data to obtain target Fair DSL data. The target Fair DSL data is used for completely describing the structure corresponding to the interface to be generated. It should be noted that, after adding the component fairdsl data to the interface fairdsl data, the server may delete the target component identifier originally included from the interface fairdsl data. In this way, when the target FairDSL data is analyzed later, the repeated analysis and generation of the component Fair DSL data caused under the condition that the target Fair DSL data comprises the component Fair DSL data corresponding to the target component and the target component identifier are avoided. And the interface generation accuracy is ensured.
And 204, sending target Fair DSL data to the client so that the client analyzes the target Fair DSL data and generates an interface.
In the embodiment of the application, the server side can package the target Fair DSL data into the DSL dictionary (DSLMap), and send the DSL dictionary comprising the target Fair DSL data to the client side at a set time. After receiving the DSL dictionary, the client analyzes the DSL dictionary to obtain target Fair DSL data. And analyzing the target Fair DSL data to generate an interface. The setting time may be an interface update time triggered by the developer. For example, for an interface of an application, the update timing of the interface is the version update timing of the application. The server may add the target FairDSL data to the installation package corresponding to the application, and send the installation package to the client. When the client receives trigger display operation of a user for an interface to be generated, target Fair DSL data are obtained, and the target Fair DSL data are analyzed to generate the interface. Or the set opportunity may be a reception opportunity for the server to receive an interface display request for an interface to be generated. That is, the server may send the target Fair DSL data to the client after receiving the interface display request for the interface to be generated sent by the client.
In summary, in the data processing method provided by the embodiment of the present application, the Flutter source code data corresponding to the interface to be generated is converted into the DSL data of the specific language in the initial Fair domain by Fair. Component Fair DSL data corresponding to the target component and interface Fair DSL data corresponding to the specific method function are extracted from the initial Fair DSL data. And adding the component Fair DSL data corresponding to the target component into the interface Fair DSL data to generate target Fair DSL data. And sending the target Fair DSL data to the client, so that the client analyzes the target Fair DSL data and generates an interface. In the technical scheme, flutter source code data comprise first source code data and second source code data. The first source code data is Flutter source code data corresponding to a target component in the interface to be generated. The second source code data is Flutter source code data written into a specific method function, and the second source code data comprises a call statement for the first source code data. By calling the component Fair DSL data corresponding to the target component in the interface Fair DSL data, the complete interface can be generated by Fair based on Flutter source code data corresponding to the target component which is independently packaged and Flutter source code data of a specific method function. Compared with the technology, all Flutter source code data corresponding to all interfaces to be generated, including all components of the interfaces, are not required to be written into the specific method function, so that the complexity of codes in the specific method function is reduced, the readability of the codes in the specific method function is improved, and the maintenance cost is reduced.
And since it is not necessary to write all code to the same specific method function. Therefore, flutter source code data corresponding to different components in the interface can be developed by different personnel. And finally, the code is modularly developed by calling the interface Fair DSL data, so that the design thought of a developer is more met, the interface design experience of the developer is improved, and the development efficiency is improved.
Referring to fig. 5, a flowchart of another data processing method according to an embodiment of the application is shown. The data processing method may be applied to the data processing system shown in fig. 1, and executed by a client in the data processing system. As shown in fig. 5, the method includes:
Step 501, receiving target Fair DSL data of an interface to be generated, which is sent by a server.
In the embodiment of the application, the target FairDSL data is generated by the server side by adopting the data processing method provided by the embodiment of the application. The server may encapsulate the target Fair DSL data into a DSL dictionary (DSLMap) and send the DSL dictionary including the target Fair DSL data to the client at a set time. After receiving the DSL dictionary, the client analyzes the DSL dictionary to obtain target Fair DSL data. And analyzing the target Fair DSL data to generate an interface. The setting time may be an interface update time triggered by the developer. For example, for an interface of an application, the update timing of the interface is the version update timing of the application. The server may add the target FairDSL data to the installation package corresponding to the application, and send the installation package to the client. When the client receives trigger display operation of a user for an interface to be generated, target Fair DSL data are obtained, and the target Fair DSL data are analyzed to generate the interface. Or the set opportunity may be a reception opportunity for the server to receive an interface display request for an interface to be generated. That is, the server may send the target Fair DSL data to the client after receiving the interface display request for the interface to be generated sent by the client.
Step 502, parsing the target Fair DSL data to generate an interface.
In the embodiment of the application, the client can respond to the trigger display operation of the user for the interface to be generated to acquire the target Fair DSL data sent by the server end received by the client. The target Fair DSL data is parsed to generate an interface. The generating modes of the target Fair DSL data are different, and the corresponding analyzing modes of the target Fair DSL data are also different. The embodiment of the application respectively describes the corresponding target Fair DSL data analysis modes under the three target Fair DSL data generation implementation modes.
A first alternative implementation. As shown in fig. 6, the target fairdsl data includes first mapping data. The process of the client parsing the target Fair DSL data to generate an interface may include:
in step 601, the client extracts first mapping data from the target Fair DSL data, and deletes the first mapping data from the target Fair DSL data to obtain interface Fair DSL data. The interface Fair DSL data comprises a target component identifier corresponding to the target component in the interface to be generated.
Alternatively, the first mapping data may be added to the set location when added to the interface Fair DSL data. For example, the first or last bit. The client may extract the first mapping data from the set location in the target fairdsl data and delete the first mapping data from the target fairdsl data to obtain the interface fairdsl data. To avoid repeated parsing of the target fairdsl data corresponding to the target component.
For example, the client stores a loader (loader. Dart), a decoder (decoder. Dart), and a runner (loader. Dart). The client receives the DSL dictionary including the target Fair DSL data sent by the server. The DSL dictionary may be loaded by a loader driver. And transmits the loaded DSL dictionary to a decoder. The decoder extracts a method dictionary (first mapping data) from the DSL dictionary and deletes the method dictionary from the DSL dictionary. And transmitting the extracted method dictionary and DSL fields after deleting the method dictionary to a runner. The operator decodes the DSL dictionary and recursively and line by line obtains interface Fair DSL data.
Step 602, the client parses the interface Fair DSL data.
In the embodiment of the application, the interface Fair DSL data can be invoked line by line through a runtime mechanism of Flutter coding language Dart so as to analyze the interface Fair DSL data.
Wherein the interface Fair DSL data includes a target component identification of the target component. When the interface Fair DSL data is invoked line by line, whether the invoking object exists in the first mapping data or not can be judged, namely whether the invoking object is a target component identifier or not is judged.
If so, it is indicated that the interface Fair DSL data does not include the specific Fair DSL data that needs to be invoked. The specific Fair DSL data is component Fair DSL data corresponding to the target component identification in the first mapping data. If not, the interface Fair DSL data includes the specific Fair DSL data to be invoked. And continuing to call the interface Fair DSL data line by line.
Optionally, in the case that the object of the target component is a function, the client may determine whether the called function name exists in a key field of each key-value pair included in the first mapping data. If yes, go to step 603, if not, continue to call the interface Fair DSL data line by line. In an alternative implementation, the client may call the interface Fair DSL data line by line using a function.
In step 603, when the parsed component identifier exists in the first mapping data, the client extracts component fairdsl data corresponding to the component identifier from the first mapping data, and parses the component FairDSL data corresponding to the component identifier.
In the embodiment of the application, the client can call the target Fair DSL data corresponding to the target component extracted from the first mapping data line by line.
In step 604, the client uses Flutter an engine to draw an interface based on the interface FairDSL data and the analysis result of the component Fair DSL data corresponding to the component identifier in the first mapping data.
In the embodiment of the application, the client draws the interface by adopting Flutter engine based on the interface Fair DSL data and the calling result of the component Fair DSL data corresponding to the component identification in the first mapping data. Thereby completing the parsing of the DSL dictionary including the method dictionary to the rendering.
A second alternative implementation. The target FairDSL data includes second mapping data. The process by which the client parses the target Fair DSL data to generate the interface is substantially the same as in the first alternative implementation. The difference is that the process of extracting the first mapping data from the target FairDSL data by the client in step 601 includes extracting the corresponding first mapping data from the target fairdsl data based on the method dictionary identification in the second mapping data. In this way, the method dictionary identification and the first mapping data are mapped to the target Fair DSL data, so that the client side can conveniently extract the first mapping data from the target Fair DSL data based on the method dictionary identification, and the data extraction efficiency is improved.
In a third alternative implementation, the client may directly parse the target Fair DSL data to generate the interface. The process of parsing the target FairDSL data may refer to the aforementioned step 602, which is not described in detail in the embodiment of the present application.
In summary, according to the data processing method provided by the embodiment of the present application, the target fairdsl data of the interface to be generated, which is sent by the server side, is obtained by parsing, so as to generate the interface. The server side converts Flutter source code data corresponding to the interface to be generated into DSL data of specific language in the initial Fair field through Fair. Component Fair DSL data corresponding to the target component and interface Fair DSL data corresponding to the specific method function are extracted from the initial FairDSL data. And adding the component Fair DSL data corresponding to the target component into the interface Fair DSL data to generate target Fair DSL data. In the technical scheme, flutter source code data comprise first source code data and second source code data. The first source code data is Flutter source code data corresponding to a target component in the interface to be generated. The second source code data is Flutter source code data written into a specific method function, and the second source code data comprises a call statement for the first source code data. By calling the component Fair DSL data corresponding to the target component in the interface Fair DSL data, the complete interface can be generated by Fair based on Flutter source code data corresponding to the target component which is independently packaged and Flutter source code data of a specific method function. Compared with the technology, all Flutter source code data corresponding to all interfaces to be generated, including all components of the interfaces, are not required to be written into the specific method function, so that the complexity of codes in the specific method function is reduced, the readability of the codes in the specific method function is improved, and the maintenance cost is reduced.
The data processing method according to the embodiment of the present application may be applied to the data processing system shown in fig. 1. The method comprises the following steps:
In step 701, the server converts Flutter source code data corresponding to the interface to be generated into DSL data of the specific language in the initial Fair field through Fair. The Flutter source code data comprise first source code data and second source code data, wherein the first source code data are Flutter source code data corresponding to a target component in an interface to be generated, the second source code data are Flutter source code data written into a specific method function, and the second source code data comprise calling sentences for the first source code data.
In step 702, the server side extracts component fairdsl data corresponding to the target component and interface fairdsl data corresponding to the specific method function from the initial fairdsl data. The interface Fair DSL data includes a target component identifier corresponding to the target component.
In step 703, the server adds component fairdsl data corresponding to the target component to the interface fairdsl data, so as to generate target fairdsl data.
In step 704, the server sends the target Fair DSL data to the client.
The explanation and implementation of steps 701 to 704 may refer to the explanation and implementation of steps 201 to 204 in sequence, which is not repeated in the embodiment of the present invention.
Step 705, the client parses the target Fair DSL data to generate an interface.
The explanation and implementation of step 705 may refer to the explanation and implementation of step 502, which is not described in detail in the embodiments of the present invention.
In summary, in the data processing method provided by the embodiment of the present application, the Flutter source code data corresponding to the interface to be generated is converted into the DSL data of the specific language in the initial Fair domain by Fair. Component Fair DSL data corresponding to the target component and interface Fair DSL data corresponding to the specific method function are extracted from the initial Fair DSL data. And adding the component Fair DSL data corresponding to the target component into the interface Fair DSL data to generate target Fair DSL data. And sending the target Fair DSL data to the client, so that the client analyzes the target Fair DSL data and generates an interface. In the technical scheme, flutter source code data comprise first source code data and second source code data. The first source code data is Flutter source code data corresponding to a target component in the interface to be generated. The second source code data is Flutter source code data written into a specific method function, and the second source code data comprises a call statement for the first source code data. By calling the component Fair DSL data corresponding to the target component in the interface Fair DSL data, the complete interface can be generated by Fair based on Flutter source code data corresponding to the target component which is independently packaged and Flutter source code data of a specific method function. Compared with the technology, all Flutter source code data corresponding to all interfaces to be generated, including all components of the interfaces, are not required to be written into the specific method function, so that the complexity of codes in the specific method function is reduced, the readability of the codes in the specific method function is improved, and the maintenance cost is reduced.
And since it is not necessary to write all code to the same specific method function. Therefore, flutter source code data corresponding to different components in the interface can be developed by different personnel. And finally, the code is modularly developed by calling the interface Fair DSL data, so that the design thought of a developer is more met, the interface design experience of the developer is improved, and the development efficiency is improved.
Referring to fig. 7, a block diagram of a data processing apparatus according to an embodiment of the present application is shown. As shown in fig. 7, the data processing apparatus 800 includes a generation module 801, an extraction module 802, an addition module 803, and a transmission module 804.
The generating module 801 is configured to convert Flutter source code data corresponding to an interface to be generated into DSL data of a specific language in an initial fairfield by using a fairway, where the Flutter source code data includes first source code data and second source code data, the first source code data is Flutter source code data corresponding to a target component in the interface to be generated, the second source code data is Flutter source code data written into a specific method function, and the second source code data includes a call statement for the first source code data;
An extracting module 802, configured to extract, from initial Fair DSL data, component Fair DSL data corresponding to a target component, and interface Fair DSL data corresponding to a specific method function, where the interface Fair DSL data includes a target component identifier corresponding to the target component;
an adding module 803, configured to add component fairdsl data corresponding to the target component to the interface fairdsl data, and generate target fairdsl data;
A sending module 804, configured to send the target fairdsl data to the client, so that the client parses the target fairdsl data to generate an interface.
Optionally, the adding module 803 is further configured to:
And adding first mapping data to the interface Fair DSL data to obtain target Fair DSL data, wherein the first mapping data comprises a target component identifier and associated stored component Fair DSL data corresponding to the target component.
Optionally, the adding module 803 is further configured to:
Generating second mapping data, wherein the second mapping data comprises a method dictionary identifier and associated stored first mapping data, and the method dictionary identifier is used for indicating Fair DSL data in the first mapping data to support calling;
and adding second mapping data to the interface Fair DSL data to obtain target Fair DSL data.
Optionally, the data format of the first mapping data and/or the second mapping data is a dictionary format.
Optionally, the extracting module 802 is further configured to:
converting the initial Fair DSL data into abstract syntax tree AST data;
extracting component data corresponding to a target component under a component tag node in AST, and generating component Fair DSL data corresponding to a target component identifier based on the component data;
And extracting target data except component data corresponding to the target component under each node in the AST, and generating interface Fair DSL data based on the target data.
Optionally, the object of the target component is a function, the component identifier of the target component is a function name, the type of the component tag node comprises a function statement and/or a device statement, and the component identifier of the target component does not comprise the function name of the specific device function when the component tag node is a device statement type.
In summary, the data processing device provided by the embodiment of the present application converts Flutter source code data corresponding to the interface to be generated into DSL data of specific language in the initial Fair domain through Fair. Component Fair DSL data corresponding to the target component and interface Fair DSL data corresponding to the specific method function are extracted from the initial Fair DSL data. And adding the component Fair DSL data corresponding to the target component into the interface Fair DSL data to generate target Fair DSL data. And sending the target Fair DSL data to the client, so that the client analyzes the target Fair DSL data and generates an interface. In the technical scheme, flutter source code data comprise first source code data and second source code data. The first source code data is Flutter source code data corresponding to a target component in the interface to be generated. The second source code data is Flutter source code data written into a specific method function, and the second source code data comprises a call statement for the first source code data. By calling the component Fair DSL data corresponding to the target component in the interface Fair DSL data, the complete interface can be generated by Fair based on Flutter source code data corresponding to the target component which is independently packaged and Flutter source code data of a specific method function. Compared with the technology, all Flutter source code data corresponding to all interfaces to be generated, including all components of the interfaces, are not required to be written into the specific method function, so that the complexity of codes in the specific method function is reduced, the readability of the codes in the specific method function is improved, and the maintenance cost is reduced.
Referring to fig. 8, a block diagram of a data processing apparatus according to an embodiment of the present application is shown. As shown in fig. 8, the data processing apparatus 900 includes a receiving module 901 and an analyzing module 902.
The receiving module 901 is configured to receive target fairdsl data of an interface to be generated, where the target fairdsl data is sent by a server side, and the target fairdsl data is generated by the server side by using any one of the data processing methods provided by the embodiments of the present application;
A parsing module 902, configured to parse the target fairdsl data to generate an interface.
Optionally, the parsing module 902 is further configured to:
Extracting first mapping data from target Fair DSL data, and deleting the first mapping data from the target Fair DSL data to obtain interface Fair DSL data, wherein the interface Fair DSL data comprises target component identifications corresponding to target components in an interface to be generated;
analyzing interface Fair DSL data;
Extracting component Fair DSL data corresponding to the component identification from the first mapping data under the condition that the component identification obtained by analysis exists in the first mapping data, and analyzing the component Fair DSL data corresponding to the component identification;
And drawing an interface based on the interface Fair DSL data and the analysis result of the component Fair DSL data corresponding to the component identifier by adopting a Flutter engine.
Optionally, the parsing module 902 is further configured to extract corresponding first mapping data from the target fairdsl data based on the method dictionary identifier in the second mapping relationship.
In summary, the data processing device provided by the embodiment of the present application analyzes the target fairdsl data to generate the interface by receiving the target fairdsl data of the interface to be generated, which is sent by the server, so as to generate the interface. The server side converts Flutter source code data corresponding to the interface to be generated into DSL data of specific language in the initial Fair field through Fair. Component Fair DSL data corresponding to the target component and interface Fair DSL data corresponding to the specific method function are extracted from the initial Fair DSL data. And adding the component Fair DSL data corresponding to the target component into the interface Fair DSL data to generate target Fair DSL data. In the technical scheme, flutter source code data comprise first source code data and second source code data. The first source code data is Flutter source code data corresponding to a target component in the interface to be generated. The second source code data is Flutter source code data written into a specific method function, and the second source code data comprises a call statement for the first source code data. By calling the component Fair DSL data corresponding to the target component in the interface Fair DSL data, the complete interface can be generated by Fair based on Flutter source code data corresponding to the target component which is independently packaged and Flutter source code data of a specific method function. Compared with the technology, all Flutter source code data corresponding to all interfaces to be generated, including all components of the interfaces, are not required to be written into the specific method function, so that the complexity of codes in the specific method function is reduced, the readability of the codes in the specific method function is improved, and the maintenance cost is reduced.
The data processing device provided by the embodiment of the application is provided with the corresponding functional module for executing the data processing method, can execute any data processing method provided by the embodiment of the application, and can achieve the same beneficial effects.
In still another embodiment of the present application, an electronic device is provided, where the electronic device may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the processor implements each process of the above-mentioned data processing method embodiment when executing the program, and the process can achieve the same technical effects, and for avoiding repetition, a description is omitted herein.
By way of example, as shown in FIG. 9, the electronic device may include a processor 1001, a storage device 1002, a display screen 1003 having a touch function, an input device 1004, an output device 1005, and a communication device 1006. The number of processors 1001 in the electronic device may be one or more, one processor 1001 being taken as an example in fig. 9. The processor 1001, storage 1002, display 1003, input 1004, output 1005, and communication 1006 of the electronic device may be connected by a bus or other means.
In yet another embodiment of the present application, a computer readable storage medium is provided, in which instructions are stored, which when run on a computer, cause the computer to perform the data processing method according to any of the above embodiments.
In a further embodiment of the present application, a computer program product comprising instructions which, when run on a computer, causes the computer to perform the data processing method according to any of the above embodiments is also provided.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or 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 solution. 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.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes various media capable of storing program codes such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.