Disclosure of Invention
The embodiment of the invention provides a list creation method and device, which are beneficial to reducing the workload of developers and improving the list generation efficiency.
According to an aspect of the present invention, there is provided a list creation method including:
acquiring a configuration file, and constructing a plurality of unit structures, wherein each unit structure is provided with a keyword corresponding to data sorting information of the configuration file;
determining data and component information corresponding to each keyword in main data of a configuration file, correspondingly storing the data and the component information into each unit structure, and generating a data dictionary from a plurality of unit structures;
and calling a corresponding first component according to the component information to render the data of each unit structure in the data dictionary to obtain a target list.
Preferably, the data sorting information is data rank information of the configuration file.
Preferably, the data row and column information is the number of the nodes to which the data is located in the configuration file and the number of the lines to which the data is located in the number of the nodes.
Preferably, in the main data of the configuration file, determining data and component information corresponding to each keyword, and storing the data and the component information into each unit structure, and then generating a data dictionary for a plurality of unit structures specifically includes:
and determining data and component information corresponding to each keyword in main data of the configuration file, correspondingly storing the data and the component information into each unit structure, and generating a data dictionary for the plurality of unit structures according to the sequence of the keywords.
Preferably, the invoking a corresponding component according to the component information to render the data of each unit structure in the data dictionary to obtain a target list further includes:
and calling a second component to render the additional data of the configuration file on the basis of the target list to obtain a processed target list.
Preferably, the list creating method provided by the present invention further includes:
and after data updating information is acquired, updating the text data in the configuration file, and correspondingly updating the data of each unit structure in the data dictionary.
Preferably, the configuration file is in json format or plist format.
According to another aspect of the present invention, there is provided a list creation apparatus including:
the device comprises a construction unit, a data sorting unit and a data processing unit, wherein the construction unit is used for acquiring a configuration file and constructing a plurality of unit structures, and each unit structure is provided with a keyword corresponding to data sorting information of the configuration file;
the generating unit is used for determining data and component information corresponding to each keyword in main body data of the configuration file, correspondingly storing the data and the component information into each unit structure, and then generating a data dictionary from a plurality of unit structures;
and the rendering unit is used for calling a corresponding first component according to the component information to render the data of each unit structure in the data dictionary to obtain a target list.
According to another aspect of the invention, there is provided an electronic device comprising a processor and a memory having stored thereon computer program instructions which, when executed by the processor, implement the list creation method as described above.
According to another aspect of the present invention, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the list creation method as described above.
According to the technical scheme, the embodiment of the invention has the following advantages:
the invention provides a list creation method and a device, wherein the method comprises the following steps: acquiring a configuration file, and constructing a plurality of unit structures, wherein each unit structure is provided with a keyword corresponding to data sorting information of the configuration file; determining data and component information corresponding to each keyword in main data of the configuration file, correspondingly storing the data and the component information into each unit structure, and generating a data dictionary from a plurality of unit structures; and calling the corresponding first component according to the component information to render the data of each unit structure in the data dictionary to obtain a target list. According to the method, each unit structure is created in a data dictionary mode, each unit structure is identified by the keywords and can correspond to the data in the configuration file, and due to the fact that corresponding component information is stored in each unit structure, when the data in the data dictionary is rendered, the corresponding components can be automatically obtained according to the component information for rendering, developers do not need to manually develop the components, and the workload of the developers is reduced.
Detailed Description
The embodiment of the invention provides a list creation method and device, which are beneficial to reducing the workload of developers and improving the list generation efficiency.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, an embodiment of a list creating method according to the present invention includes:
101. acquiring a configuration file, and constructing a plurality of unit structures, wherein each unit structure is provided with a keyword corresponding to data sorting information of the configuration file;
in this embodiment, the cell structure (CellStruct) is a class, which is a part of the data dictionary in the present invention, and each cell structure has an independent keyword, and the keyword corresponds to the data sorting information on the configuration file, so that the corresponding cell structure can be found by the keyword.
102. Determining data and component information corresponding to each keyword in main data of the configuration file, correspondingly storing the data and the component information into each unit structure, and generating a data dictionary from a plurality of unit structures;
the configuration file generally contains main data and additional data, for example, the configuration file contains friend circle list data, the state, head portrait, name and the like of each column of users of a friend circle are main data, and the background, drawings and the like of the friend circle are additional data.
After the unit structures are created, the main data is usually presented in a row form in the configuration file, and the keywords contain position sequencing information of the corresponding data in the configuration file, so that each unit structure can correspond to part of the main data, the whole main data is divided into a plurality of parts, the parts are stored in each unit structure one by one, and then all the unit structures are superposed to generate the data dictionary.
It should be noted that, after each cell structure determines corresponding data according to the keyword, since the types and features of the data stored in each cell structure may be different, the cell components (cells) required for rendering the data in each cell structure are also different, so that the present invention may store the corresponding component information into each cell structure according to the data types and features corresponding to each cell structure while determining the data stored in each cell structure.
103. And calling the corresponding first component according to the component information to render the data of each unit structure in the data dictionary to obtain a target list.
Because the unit structure is pre-stored with the component information, when the list needs to be generated, the corresponding first component (namely, the unit component) can be called according to the component information to render the data of each unit structure in the data dictionary, so as to obtain the target list. It should be noted that, in the embodiment of the present invention, various unit components are pre-stored, and corresponding component information is extracted, so that the corresponding component can be called according to the component information, and a developer does not need to re-develop the component due to different types and characteristics of configuration file data in a development process, thereby reducing a worker and improving efficiency.
According to the method, each unit structure is created in a data dictionary mode, each unit structure is identified by the keywords and can correspond to the data in the configuration file, and due to the fact that corresponding component information is stored in each unit structure, when the data in the data dictionary is rendered, the corresponding components can be automatically obtained according to the component information for rendering, developers do not need to manually develop the components, and the workload of the developers is reduced.
In order to describe the embodiment of the list creating method more specifically, the following provides another embodiment of the list creating method, and referring to fig. 2, the another embodiment of the list creating method provided by the present invention includes:
201. acquiring a configuration file, and constructing a plurality of unit structures, wherein each unit structure is provided with a keyword corresponding to data sorting information of the configuration file;
in this embodiment, the cell structure (CellStruct) is a class, which is a part of the data dictionary in the present invention, and each cell structure has an independent keyword, and the keyword corresponds to the data sorting information on the configuration file, so that the corresponding cell structure can be found by the keyword.
In this embodiment, the data sorting information is data rank information of the configuration file. Specifically, the data row and column information is the number of bytes to which the data is located in the configuration file and the number of rows to which the data is located in the number of bytes to which the data belongs, and for example, the keyword corresponding to a certain unit structure may be section1_ row1, which means that the data in the unit structure is the first row of the first part in the configuration file.
In this embodiment, the configuration file may be in json format or plist format, and the stored data corresponds to the target list.
202. Determining data and component information corresponding to each keyword in main data of the configuration file, correspondingly storing the data and the component information into each unit structure, and generating a data dictionary for the plurality of unit structures according to the sequence of the keywords;
the configuration file generally contains main data and additional data, for example, the configuration file contains friend circle list data, the state, head portrait, name and the like of each column of users of a friend circle are main data, and the background, drawings and the like of the friend circle are additional data.
After the unit structures are created, the main data are usually presented in a row form in the configuration file, and the keywords contain position sequencing information of the corresponding data in the configuration file, so that each unit structure can correspond to part of the main data, the whole main data is divided into a plurality of parts, the parts are stored in each unit structure one by one, and then all the unit structures are overlapped according to the sequence of the keywords to generate the data dictionary.
It should be noted that, after each cell structure determines corresponding data according to the keyword, since the types and features of the data stored in each cell structure may be different, the cell components (cells) required for rendering the data in each cell structure are also different, so that the present invention may store the corresponding component information into each cell structure according to the data types and features corresponding to each cell structure while determining the data stored in each cell structure. If the data stored in the unit structure A is the data containing the user head portrait, the characters and the name, the corresponding first component is a, and then the component information stored in the unit mechanism A corresponds to the component a, if the data stored in the unit structure B not only contains the user head portrait, the characters and the name, but also contains the jump link, the corresponding first component is B, and then the component information stored in the unit structure B corresponds to the component B.
203. Calling a corresponding first component according to the component information to render the data of each unit structure in the data dictionary to obtain a target list;
because the unit structure is pre-stored with the component information, when the list needs to be generated, the corresponding first component (namely, the unit component) can be called according to the component information to render the data of each unit structure in the data dictionary, so as to obtain the target list.
204. And on the basis of the target list, calling a second component to render the additional data of the configuration file to obtain a processed target list.
Because the configuration file also contains additional data, such as additional attributes of the friend circle, such as whether to go up or down, whether to set a background picture, set a title, and the like, on the basis of the target list (such as the friend circle state of each user), the second component (also belonging to one part of the above unit components) is called to render the polarity of the additional data, and a processed target list, such as a complete friend circle list, can be obtained.
Further, a list creating method provided by the present invention further includes:
and after the data updating information is acquired, updating the text data in the configuration file, and correspondingly updating the data of each unit structure in the data dictionary. It can be understood that the data in each unit structure can be updated correspondingly according to the needs of the user, so that the content displayed in the final list is also updated correspondingly.
According to the method, each unit structure is created in a data dictionary mode, each unit structure is identified by the keywords and can correspond to the data in the configuration file, and due to the fact that corresponding component information is stored in each unit structure, when the data in the data dictionary is rendered, the corresponding components can be automatically obtained according to the component information for rendering, developers do not need to manually develop the components, and the workload of the developers is reduced.
In the above, a detailed description is made on a list creating method provided by the present invention, and a structure and a connection relationship of a list creating apparatus provided by the present invention are described below, referring to fig. 3, an embodiment of a list creating apparatus provided by the present invention includes:
according to another aspect of the present invention, there is provided a list creation apparatus including:
a constructing unit 301, configured to obtain a configuration file, and construct a plurality of unit structures, where each unit structure has a keyword corresponding to data sorting information of the configuration file;
a generating unit 302, configured to determine, in the main data of the configuration file, data and component information corresponding to each keyword, store the data and the component information into each unit structure, and generate a data dictionary from a plurality of unit structures;
and the rendering unit 303 is configured to call a corresponding first component according to the component information to render the data of each unit structure in the data dictionary, so as to obtain a target list.
Furthermore, the data sorting information is data row and column information of the configuration file.
Furthermore, the data row and column information is the number of the nodes where the data is located in the configuration file and the number of the rows where the data is located in the number of the nodes.
Furthermore, the generating unit is further configured to determine, in the main data of the configuration file, data and component information corresponding to each keyword, store the data and the component information into each unit structure, and generate a data dictionary for the plurality of unit structures according to the order of the keywords.
Further, a list creating apparatus provided by the present invention further includes:
and the processing unit is used for calling the second component to render the additional data of the configuration file on the basis of the target list to obtain a processed target list.
Further, a list creating apparatus provided by the present invention further includes:
and the updating unit is used for updating the text data in the configuration file after acquiring the data updating information and correspondingly updating the data of each unit structure in the data dictionary.
Further, the configuration file is in json format or plist format.
The invention also relates to an electronic device comprising a processor and a memory, the memory having stored thereon computer program instructions which, when executed by the processor, implement the list creation method as described above.
The invention also relates to a computer-readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the list creation method as described above.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.