CN114398023A - File generation method and page configuration method and device - Google Patents

File generation method and page configuration method and device Download PDF

Info

Publication number
CN114398023A
CN114398023A CN202210062987.4A CN202210062987A CN114398023A CN 114398023 A CN114398023 A CN 114398023A CN 202210062987 A CN202210062987 A CN 202210062987A CN 114398023 A CN114398023 A CN 114398023A
Authority
CN
China
Prior art keywords
target
file
class
java class
page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210062987.4A
Other languages
Chinese (zh)
Inventor
冯小明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202210062987.4A priority Critical patent/CN114398023A/en
Publication of CN114398023A publication Critical patent/CN114398023A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents
    • G06F40/143Markup, e.g. Standard Generalized Markup Language [SGML] or Document Type Definition [DTD]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure provides a method for generating a file, a method, a device, equipment, a storage medium and a program product for configuring a page, and relates to the technical field of computers, in particular to the technical field of clients. The method for generating the file comprises the following steps: determining a layout file and logic information of a page; generating a target Java class according to the layout file and the logic information; and generating a target executable file according to the target Java class. The method for configuring the page comprises the following steps: acquiring a target executable file corresponding to a target page; generating a class instance of the target Java class according to the target executable file; and configuring the layout and logic of the target page according to the class instance.

Description

File generation method and page configuration method and device
Technical Field
The present disclosure relates to the field of computer technology, and more particularly, to the field of client technology.
Background
In development work, page dynamic requirements of application programs are common. For example, during a festival, the operation activity corresponding to the festival needs to be brought online in the application, the operation activity is presented in the form of an activity page, and therefore the page of the application needs to be dynamically changed in order to show the activity page.
Disclosure of Invention
The disclosure provides a method for generating a file, a method for configuring a page, a device, equipment, a storage medium and a program product.
According to an aspect of the present disclosure, there is provided a method of generating a file, including: determining a layout file and logic information of a page; generating a target Java class according to the layout file and the logic information; and generating a target executable file according to the target Java class.
According to another aspect of the present disclosure, there is provided a method of configuring a page, including: acquiring a target executable file corresponding to a target page; generating a class instance of a target Java class according to the target executable file; configuring the layout and logic of the target page according to the class instance; wherein the target executable file is generated using the method according to an embodiment of the present disclosure.
According to another aspect of the present disclosure, there is provided an apparatus for generating a file, including: the determining module is used for determining the layout file and the logic information of the page; the first generation module is used for generating a target Java class according to the layout file and the logic information; and a second generation module for generating a target executable file according to the target Java class.
According to another aspect of the present disclosure, there is provided an apparatus for configuring a page, including: the acquisition module is used for acquiring a target executable file corresponding to a target page; a third generation module, configured to generate a class instance of the target Java class according to the target executable file; and a configuration module configured to configure layout and logic of the target page according to the class instance, wherein the target executable file is generated using the method according to the embodiments of the present disclosure.
Another aspect of the present disclosure provides an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the embodiments of the present disclosure.
According to another aspect of the disclosed embodiments, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method shown in the disclosed embodiments.
According to another aspect of the embodiments of the present disclosure, there is provided a computer program product comprising computer programs/instructions, characterized in that the computer programs/instructions, when executed by a processor, implement the steps of the method shown in the embodiments of the present disclosure.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 schematically illustrates an exemplary system architecture to which the method of generating a file, the method of configuring a page, may be applied, according to an embodiment of the disclosure;
FIG. 2 schematically shows a flow diagram of a method of generating a file according to an embodiment of the present disclosure;
FIG. 3 schematically shows a flow diagram of a method of generating a target Java class according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow diagram of a method of generating a target executable file according to an embodiment of the disclosure;
FIG. 5 schematically shows a flow diagram of a method of generating a target Java class according to an embodiment of the present disclosure;
FIG. 6 schematically illustrates a flow diagram of a method of generating a target executable file according to an embodiment of the disclosure;
FIG. 7 schematically illustrates a flow diagram of a method of obtaining a target executable corresponding to a target page, in accordance with an embodiment of the present disclosure;
FIG. 8 schematically illustrates a flow chart of a method of generating a class instance of a target Java class according to an embodiment of the present disclosure;
FIG. 9 is a schematic diagram illustrating a method of generating a file and a method of configuring a page according to another embodiment of the present disclosure;
FIG. 10 schematically illustrates a block diagram of an apparatus for generating a file according to an embodiment of the present disclosure;
FIG. 11 schematically illustrates a block diagram of an apparatus for configuring a page according to an embodiment of the present disclosure; and
FIG. 12 schematically shows a block diagram of an example electronic device that may be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
An exemplary system architecture for the methods and apparatus provided by the present disclosure will be described below in conjunction with fig. 1.
Fig. 1 schematically illustrates an exemplary system architecture 100 to which the method of generating a file, the method of configuring a page, may be applied, according to an embodiment of the disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, a network 103, and a server 104. The network 103 serves as a medium for providing communication links between the terminal devices 101, 102 and the server 104. Network 103 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102 to interact with the server 104 over the network 103 to receive or send messages or the like. The terminal devices 101, 102 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 101, 102 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 104 may be a server that provides various services, such as a background management server that provides support for applications used by users with the terminal devices 101, 102. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (for example, a page, information, or data obtained or generated according to the user request) to the terminal device.
The Server 104 may be a cloud Server, which is also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service extensibility in a conventional physical host and a VPS service (Virtual Private Server, or VPS for short). The server 104 may also be a server of a distributed system or a server incorporating a blockchain.
According to the embodiment of the disclosure, a developer of an application program can obtain a layout file and logic information by writing a code for realizing page re-layout and a code for realizing page business logic through the terminal device 101. A target Java class (class) may then be generated based on the layout file and the logic information. Then, a target executable file is generated according to the target Java class, and the executable file is uploaded to the server 104.
According to other embodiments of the disclosure, a developer may also generate a target executable file through server 104. The method for generating the target executable file may refer to the above, and is not described herein again.
According to the embodiment of the disclosure, the user can utilize the target page of the application program triggered by the terminal device 102. When triggered for a target page, terminal device 102 may retrieve a target executable corresponding to the target page from server 104. And then generating a class instance of the target Java class according to the target executable file. The layout and logic of the target page is then configured according to the class instance. And then displaying the configured target page.
In the related art, when a program needs to display a certain page, a corresponding layout file is analyzed. The parsing of the layout file is inefficient because it requires two steps, namely loading the layout file into the memory and generating Java classes by reflection.
According to the embodiment of the disclosure, the layout file and the logic information of the page are converted into the Java class, and the Java class is packaged to generate the executable file, so that when the page is displayed, the class instance of the Java class is generated according to the executable file, and then the class instance is added to the root layout of the page to display the page, thereby improving the efficiency.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The method for generating a file provided by the present disclosure will be described below with reference to fig. 2.
FIG. 2 schematically shows a flow diagram of a method of generating a file according to an embodiment of the disclosure.
As shown in fig. 2, the method 200 of generating a file includes determining a layout file and logic information of a page in operation S210.
Then, in operation S220, a target Java class is generated according to the layout file and the logic information.
In operation S230, a target executable file is generated according to the target Java class.
According to the embodiment of the disclosure, the layout file and the logic information of the page are converted into a Java class, and the Java class is packaged to generate the executable file. Therefore, when the page is displayed, the class instance of the Java class is generated only according to the executable file, then the layout and logic of the target page are configured according to the class instance, the configuration of the page can be completed, and the layout file does not need to be analyzed, so that the efficiency is high.
According to embodiments of the present disclosure, the executable file may comprise, for example, a dex file.
According to an embodiment of the present disclosure, the format of the layout file may include, for example, XML (Extensible Markup Language).
According to an embodiment of the present disclosure, the layout file may include attributes such as the type of the page control, the identification of the page control, and the style of the page control, for example. The page control may include, for example, a view component.
The method for generating the target Java class shown above is further explained with reference to FIG. 3.
FIG. 3 schematically shows a flow diagram of a method of generating a target Java class according to an embodiment of the present disclosure.
As shown in fig. 3, the method 320 of generating a target Java class includes determining a first Java class according to the properties of the outermost view component in the layout file in operation S321.
Then, in operation S322, a second Java class is determined according to the attribute of each of the other view components in the layout file except the outermost view component.
In operation S323, the second Java class is added to the first Java class according to the construction method of the first Java class, resulting in a third Java class.
In operation S324, the logic information is added to the third Java class, resulting in a target Java class.
Illustratively, in this embodiment, the layout file may include properties of a plurality of view components, wherein the plurality of view components have a nested relationship therebetween.
According to an embodiment of the present disclosure, one Java class, i.e., a first Java class, may be defined for an outermost view component among the plurality of view components. The first Java class is then set according to the properties of the view component in the layout file.
In addition, one Java class, i.e., the second Java class, may be defined for each of the plurality of view components except for the outermost view component. The second Java class is then set according to the properties of the view component in the layout file.
And then, adding a second Java class to the first Java class according to the nesting relation between the view components by using the construction method of the first Java class. For example, the view component B is nested in the view component a, and the Java class corresponding to the view component B is added to the Java class corresponding to the view component a.
The method of generating the target executable file shown above is further explained below with reference to fig. 4.
FIG. 4 schematically shows a flow diagram of a method of generating a target executable file according to an embodiment of the disclosure.
As shown in fig. 4, the method 430 of generating a target executable file includes compiling a target Java class into a class file in operation S431.
According to an embodiment of the present disclosure, the target Java class may be compiled into a class file (class file), for example, by a javac tool.
Then, in operation S432, the class file is compiled into a target executable file.
According to an embodiment of the present disclosure, the target executable file may comprise, for example, a dex file. In this embodiment, the class file may be compiled into the target executable file, for example, by a dx tool.
According to another embodiment of the present disclosure, a class name may also be set for the target Java class to distinguish. The method for generating the target Java class described above is further explained with reference to FIG. 5.
FIG. 5 schematically shows a flow diagram of a method of generating a target Java class according to an embodiment of the present disclosure.
As shown in fig. 5, the method 500 of generating a target Java class includes acquiring a class name of an Activity (Activity) of the target Java class in operation S510.
In operation S520, a class name of the target Java class is set according to the active class name and the version identifier of the target Java class.
According to embodiments of the present disclosure, the version identification may be used to identify the version of the target page. The version identification may include, but is not limited to, numbers, letters, symbols, and any combination between numbers, letters, and symbols.
According to the embodiment of the present disclosure, for example, the version identifier may be used as a prefix or a suffix, and combined with the active class name to obtain the class name of the target Java class. For example, if the class name of the Activity in which the target Java class is located is userlity, and the version identifier of the target Java class is Layout5, it may be determined that the class name of the target Java class is userlavitylayout 5.
The method of configuring the page provided by the present disclosure will be described below with reference to fig. 6.
FIG. 6 schematically shows a flow diagram of a method of generating a target executable file according to an embodiment of the disclosure.
As shown in fig. 6, the method 600 of generating a target executable file includes acquiring a target executable file corresponding to a target page in operation S610.
Then, in operation S620, a class instance of the target Java class is generated according to the target executable file.
In operation S630, the layout and logic of the target page are configured according to the class instance.
According to an embodiment of the present disclosure, the target executable file may be generated, for example, by the method of generating a file shown in the embodiment of the present disclosure.
According to the embodiment of the disclosure, the class instance of the Java class is generated according to the executable file, then the layout and the logic of the target page are configured according to the class instance, and the layout file does not need to be analyzed, so that the efficiency is high.
The method for obtaining the target executable file corresponding to the target page shown above is further explained with reference to fig. 7.
Fig. 7 schematically shows a flowchart of a method of obtaining a target executable corresponding to a target page according to an embodiment of the present disclosure.
As shown in fig. 7, the method 710 of acquiring a target executable file corresponding to a target page includes determining whether the target executable file is stored in a local memory in operation S711.
In the case where the target executable file is stored in the local storage, operation S712 is performed. In the case where the target executable file is not stored in the local storage, operations S713 to S714 are performed.
In operation S712, the target executable file is read from the local storage.
In operation S713, a storage address of the target executable file in the server is acquired.
In operation S714, the target executable file is downloaded from the server and stored to the local storage according to the storage address.
According to an embodiment of the present disclosure, for example, a class name of a target Java class from a server may be obtained. And then determining whether the target executable file is stored in the local storage according to the class name.
According to the embodiment of the disclosure, if the target executable file is stored in the local storage, it indicates that the layout of the target page in the current server is not updated, so that the target page can be configured according to the target executable file in the local storage. If the target executable file is not stored in the local memory, the layout of the target page is updated in the server, so that the updated target executable file can be downloaded from the server, and then the target page is configured according to the target executable file.
FIG. 8 schematically illustrates a flow chart of a method of generating a class instance of a target Java class according to an embodiment of the present disclosure.
As shown in fig. 8, the method 820 of generating a class instance of a target Java class includes loading a target executable file in operation S821.
In operation S822, a build method object corresponding to the target Java class in the target executable file is determined.
In operation S823, a class instance of the target Java class is generated according to the build method object.
According to embodiments of the present disclosure, a class instance may be added to a root layout of a target page, for example, to configure the layout and logic of the target page.
According to embodiments of the present disclosure, the generated instances of the Java class may be generated by reflection. For example, an instance of BaseDexClassLoader in the system may be created, loading the executable file in local storage into memory. And then, a loadClass method in the BaseDexClassLoader instance can be called to obtain the Class instance corresponding to the Java Class. The parameter of the loadClass method is a full path character string of the Java class, and the full path character string indicates the path of the Java class in the executable file. Then, the required construction method object can be obtained through the Class instance, and the Class instance of the Java Class is generated through the construction method object. Next, the class instance of the Java class can be set to the root layout of the page by the setContentView method.
The method for generating a file and the method for configuring a page shown above are further described with reference to fig. 9 in conjunction with specific embodiments. Those skilled in the art will appreciate that the following example embodiments are only for the understanding of the present disclosure, and the present disclosure is not limited thereto.
Fig. 9 schematically shows a schematic diagram of a method of generating a file and a method of configuring a page according to another embodiment of the present disclosure.
In fig. 9, it is shown that the developer can modify the logic information corresponding to the layout file and the page as required. The layout file may be in an XML format, for example. A Java class may then be defined, inheriting from the outermost View component in the layout file, and setting it to the Java class according to the properties declared in its layout file. Attributes may include, for example, width, height, inside and outside margins, font, background, and the like.
Next, the Java class may be named according to the class name of the Activity in which the Java class is located. For example, the class name of the Activity where the Java class is located is userlaity, and the Java class may be named as userlaitylayout, but since the Android application program uniquely distinguishes one class according to the full path of the class in operation, the Java class name generated corresponding to the page modified by the dynamic requirement every time is different from the previous time. Based on this, in this embodiment, a self-added numeric suffix may be added after the class name of the Java class for distinction, for example, the class name of the Java class after the current update may be usernativylayout 5, and after the next update, the class name may be modified to usernativylayout 6.
In addition, other non-outermost layer View components in the layout file are converted into corresponding Java classes, and instances of the Java classes are created. And setting the attribute declared in the layout file to the instance, and then adding the instance into the Java class corresponding to the outermost layer View component according to the construction method of the Java class corresponding to the outermost layer View component.
And extracting logic in the page Activity to obtain logic information, and adding the logic information to the generated Java class. Setting logical operations related to view components in the Java class, such as setting properties for text entities textview, can be realized by adding logical information to the generated Java class.
And packaging the generated Java class into a dex file, namely a target executable file by using a Java tool and a dx tool. And then uploading the generated dex file to a server, and recording the mapping relation between the dex file and the generated class full path name and the located page of the Java in the server.
When the program runs, responding to the display of a user trigger page, if the page is a page which can be dynamically displayed, inquiring the latest dex file url and the full path character string of the Java class corresponding to the current page from the server every time the page is entered.
And inquiring whether the local memory has downloaded the dex file or not, wherein the result shows that the current page is unchanged, and the existing dex file in the local memory can be directly used. The path of the dex file in local storage is denoted dexPath.
And if the file is not downloaded, downloading according to a dex file url returned by the server, storing the file in a local memory at a storage position corresponding to the application program, and recording a path as dexPath.
An instance of the generated Java class is generated by reflection. For example, an instance of basedexcsloader in the system is created, and the dex file with the path being dexPath in the above step is loaded into the memory. And then, calling a loadClass method in the BaseClassLoader instance, wherein the parameters are the full path character string of the Java Class generated in the step one, and acquiring the Class instance corresponding to the Java Class. And then obtaining a required construction method object through the Class instance, and generating an instance of the Java Class, namely a Class instance, through the construction method object. And setting the generated instance of the Java class into the root layout of the page through a setContentView method, so that a new page style and logic can be displayed.
FIG. 10 schematically shows a block diagram of an apparatus for generating a file according to an embodiment of the present disclosure.
As shown in fig. 10, the apparatus 1000 for generating a file includes a determining module 1010, a first generating module 1020, and a second generating module 1030.
A determining module 1010 for determining a layout file and logic information of the page.
A first generating module 1020, configured to generate a target Java class according to the layout file and the logic information.
And a second generating module 1030, configured to generate a target executable file according to the target Java class.
FIG. 11 schematically shows a block diagram of an apparatus for configuring a page according to an embodiment of the disclosure.
As shown in fig. 11, the apparatus 1100 for configuring a page includes an obtaining module 1110, a third generating module 1120, and a configuring module 1130.
An obtaining module 1110, configured to obtain a target executable file corresponding to a target page.
A third generating module 1120, configured to generate a class instance of the target Java class according to the target executable file.
A configuration module 1130 for configuring the layout and logic of the target page according to the class instance,
wherein the target executable file is generated using the method shown in accordance with an embodiment of the present disclosure.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the related data all meet the regulations of related laws and regulations and do not violate the customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
Fig. 12 schematically illustrates a block diagram of an example electronic device 1200 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 12, the apparatus 1200 includes a computing unit 1201 which can perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)1202 or a computer program loaded from a storage unit 1208 into a Random Access Memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the device 1200 may also be stored. The computing unit 1201, the ROM 1202, and the RAM 1203 are connected to each other by a bus 1204. An input/output (I/O) interface 1205 is also connected to bus 1204.
Various components in the device 1200 are connected to the I/O interface 1205 including: an input unit 1206 such as a keyboard, a mouse, or the like; an output unit 1207 such as various types of displays, speakers, and the like; a storage unit 1208, such as a magnetic disk, optical disk, or the like; and a communication unit 1209 such as a network card, modem, wireless communication transceiver, etc. The communication unit 1209 allows the device 1200 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 1201 may be a variety of general purpose and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The computing unit 1201 executes the respective methods and processes described above, such as a method of generating a file, a method of configuring a page, and the like. For example, in some embodiments, the method of generating a file, the method of configuring a page, and the like may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 1208. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 1200 via the ROM 1202 and/or the communication unit 1209. When the computer program is loaded into the RAM 1203 and executed by the computing unit 1201, one or more steps of the above-described method of generating a file, method of configuring a page, and the like may be performed. Alternatively, in other embodiments, the computing unit 1201 may be configured by any other suitable means (e.g., by means of firmware) to perform the method of generating a file, the method of configuring a page.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (16)

1. A method of generating a file, comprising:
determining a layout file and logic information of a page;
generating a target Java class according to the layout file and the logic information; and
and generating a target executable file according to the target Java class.
2. The method of claim 1, wherein the layout file includes properties of a plurality of view components, wherein the plurality of view components have a nested relationship therebetween; generating a target Java class according to the layout file and the logic information, wherein the generating comprises:
determining a first Java class according to the attribute of the outmost view component in the layout file;
determining a second Java class according to the attribute of each view component in other view components except the view component at the outermost layer in the layout file;
adding the second Java class into the first Java class according to the construction method of the first Java class to obtain a third Java class; and
and adding the logic information to the third Java class to obtain the target Java class.
3. The method of claim 1, further comprising:
acquiring the class name of the activity of the target Java class; and
and setting the class name of the target Java class according to the active class name and the version identifier of the target Java class.
4. The method of claim 1, wherein generating a target executable file from a target Java class comprises:
compiling the target Java class into a class file; and
compiling the class file into the target executable file.
5. The method of any of claims 1-4, wherein the executable file comprises: a dex file.
6. The method of any of claims 1-4, wherein the format of the layout file comprises extensible markup language (XML).
7. A method of configuring a page, comprising:
acquiring a target executable file corresponding to a target page;
generating a class instance of a target Java class according to the target executable file; and
configuring the layout and logic of the target page according to the class instance;
wherein the target executable file is generated using the method according to one of claims 1-6.
8. The method of claim 7, wherein the obtaining a target executable corresponding to a target page comprises:
reading the target executable file from a local memory in the case that the target executable file is stored in the local memory; and
and under the condition that the target executable file is not stored in the local memory, acquiring the storage address of the target executable file in the server, downloading the target executable file from the server according to the storage address, and storing the target executable file in the local memory.
9. The method of claim 8, further comprising:
acquiring a class name of the target Java class from a server; and
and determining whether the target executable file is stored in a local memory or not according to the class name.
10. The method of claim 7, wherein said generating a class instance of a target Java class from said target executable file comprises:
loading the target executable file;
determining a construction method object corresponding to the target Java class in the target executable file; and
and generating the class instance of the target Java class according to the construction method object.
11. The method of claim 7, wherein said configuring layout and logic of said target page according to said class instance comprises:
adding the class instance to a root layout of the target page to configure the layout and logic of the target page.
12. An apparatus for generating a file, comprising:
the determining module is used for determining the layout file and the logic information of the page;
the first generation module is used for generating a target Java class according to the layout file and the logic information; and
and the second generation module is used for generating a target executable file according to the target Java class.
13. An apparatus to configure a page, comprising:
the acquisition module is used for acquiring a target executable file corresponding to a target page;
a third generation module, configured to generate a class instance of the target Java class according to the target executable file; and
a configuration module for configuring the layout and logic of the target page according to the class instance,
wherein the target executable file is generated using the method according to one of claims 1-6.
14. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.
15. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-11.
16. A computer program product comprising computer program/instructions, characterized in that the computer program/instructions, when executed by a processor, implement the steps of the method according to any of claims 1-11.
CN202210062987.4A 2022-01-19 2022-01-19 File generation method and page configuration method and device Pending CN114398023A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210062987.4A CN114398023A (en) 2022-01-19 2022-01-19 File generation method and page configuration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210062987.4A CN114398023A (en) 2022-01-19 2022-01-19 File generation method and page configuration method and device

Publications (1)

Publication Number Publication Date
CN114398023A true CN114398023A (en) 2022-04-26

Family

ID=81230866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210062987.4A Pending CN114398023A (en) 2022-01-19 2022-01-19 File generation method and page configuration method and device

Country Status (1)

Country Link
CN (1) CN114398023A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115373683A (en) * 2022-08-22 2022-11-22 北京字跳网络技术有限公司 Page display method, source code compiling method and related equipment
CN116127922A (en) * 2023-04-19 2023-05-16 北京路浩知识产权集团有限公司 Intellectual property file processing method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115373683A (en) * 2022-08-22 2022-11-22 北京字跳网络技术有限公司 Page display method, source code compiling method and related equipment
CN116127922A (en) * 2023-04-19 2023-05-16 北京路浩知识产权集团有限公司 Intellectual property file processing method and device
CN116127922B (en) * 2023-04-19 2023-07-04 北京路浩知识产权集团有限公司 Intellectual property file processing method and device

Similar Documents

Publication Publication Date Title
CN113010827B (en) Page rendering method and device, electronic equipment and storage medium
CN114398023A (en) File generation method and page configuration method and device
CN111125057B (en) Method and device for processing service request and computer system
CN112506854A (en) Method, device, equipment and medium for storing page template file and generating page
CN115309470A (en) Method, device and equipment for loading widgets and storage medium
CN114490126A (en) Page processing method and device, electronic equipment and storage medium
CN114443076A (en) Mirror image construction method, device, equipment and storage medium
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN112947916B (en) Method, apparatus, device and storage medium for implementing online canvas
CN112784588B (en) Method, device, equipment and storage medium for labeling text
CN112926008B (en) Method, device, electronic equipment and storage medium for generating form page
CN112948018A (en) Dynamic library loading method, device, equipment and medium for small program
WO2023169193A1 (en) Method and device for generating smart contract
CN113342450B (en) Page processing method, device, electronic equipment and computer readable medium
CN113138760B (en) Page generation method and device, electronic equipment and medium
CN115658248A (en) Task scheduling method and device, electronic equipment and storage medium
CN113656041A (en) Data processing method, device, equipment and storage medium
CN114138358A (en) Application program starting optimization method, device, equipment and storage medium
CN113656533A (en) Tree control processing method and device and electronic equipment
CN116431108B (en) Object type processing method and device, electronic equipment and storage medium
CN112560462B (en) Event extraction service generation method, device, server and medium
CN113760356B (en) Differential configuration method, device, equipment and medium of program product
CN117608732A (en) Web application dynamic rendering device, method, equipment and medium
CN113642295A (en) Page layout method, page layout device and computer program product
CN114936338A (en) Page loading method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination