CN105718289B - Component relation establishing method and equipment - Google Patents

Component relation establishing method and equipment Download PDF

Info

Publication number
CN105718289B
CN105718289B CN201610042009.8A CN201610042009A CN105718289B CN 105718289 B CN105718289 B CN 105718289B CN 201610042009 A CN201610042009 A CN 201610042009A CN 105718289 B CN105718289 B CN 105718289B
Authority
CN
China
Prior art keywords
component
annotation
target application
file
project
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.)
Active
Application number
CN201610042009.8A
Other languages
Chinese (zh)
Other versions
CN105718289A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610042009.8A priority Critical patent/CN105718289B/en
Publication of CN105718289A publication Critical patent/CN105718289A/en
Application granted granted Critical
Publication of CN105718289B publication Critical patent/CN105718289B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • G06F9/44526Plug-ins; Add-ons
    • 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/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a component relation establishing method and equipment thereof, wherein the method comprises the following steps: acquiring a component carrying a component annotation in a class file of a target application project; analyzing the component annotation to acquire the component identification and layout position of the component contained in the component annotation; and generating a component relation file of the target application project according to the component identification and the layout position. By adopting the invention, the component relation file related to the component can be automatically generated, the coupling degree between the component and the interface framework is reduced, the management difficulty of the component is reduced, and the expansibility of the component is improved.

Description

Component relation establishing method and equipment
Technical Field
The invention relates to the technical field of computers, in particular to a component relation establishing method and equipment.
Background
With the continuous development and improvement of computer technology, the terminal applications developed for terminals such as mobile phones and tablet computers are increasing day by day, and various requirements of people in daily life are met.
In the process of developing an application project, an interface framework of the application and components required in the interface framework are often required to be established, and because a component relationship exists between the component and the interface framework, that is, the component needs to determine which specific position under which interface framework is loaded, and the interface framework needs to determine which components need to be laid out. The existing component relationship establishment method is to maintain a component relationship file, which describes an interface frame, all components under the interface frame, and layout positions of the components, and load the components in a reflective loading manner. However, in the above manner in which the component relationship file describes the component relationship between the component and the interface frame, a developer needs to manually maintain the component relationship file, and meanwhile, since the component relationship file needs to describe the interface frame and the component at the same time, the coupling degree between the component and the interface frame is high, and the management and the expansion of the component are inconvenient.
Disclosure of Invention
The embodiment of the invention provides a component relationship establishing method and equipment thereof, which can automatically generate a component relationship file related to a component, reduce the coupling degree between the component and an interface frame, reduce the management difficulty of the component and improve the expansibility of the component.
A first aspect of an embodiment of the present invention provides a method for establishing a component relationship, where the method may include:
acquiring a component carrying a component annotation in a class file of a target application project;
analyzing the component annotation to acquire the component identification and layout position of the component contained in the component annotation;
and generating a component relation file of the target application project according to the component identification and the layout position.
A second aspect of an embodiment of the present invention provides an apparatus for establishing a component relationship, where the apparatus includes:
the component acquisition unit is used for acquiring a component carrying a component annotation in a class file of a target application project;
the annotation parsing unit is used for parsing the component annotation to acquire the component identification and the layout position of the component contained in the component annotation;
and the relation file generating unit is used for generating the component relation file of the target application item according to the component identification and the layout position.
In the embodiment of the invention, the component carrying the component annotation is obtained in the class file of the target application item, the component annotation is analyzed to obtain the component identifier and the layout position of the component contained in the component annotation, and finally the component relation file of the target application item is generated according to the component identifier and the layout position. The component relation file is generated based on the component annotation, so that the component relation file related to the component is automatically generated, the maintenance of the component relation file is not needed, the component annotation contains the component identification and the layout position of the component, the direct component relation with the interface frame is not needed, the layout position of the component is independently described by the component relation file, the coupling degree between the component and the interface frame is reduced, the management difficulty of the component is reduced, and the expansibility of the component is further improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a component relationship establishing method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of another component relationship establishing method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a component relationship establishing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another component relationship establishing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a relationship file generating unit according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of still another component relationship establishing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments 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.
The component relationship establishing method provided by the embodiment of the invention can be applied to a scene of generating a component relationship file in a target application project, such as: the method comprises the steps that a component relation establishing device obtains a component carrying a component annotation in a class file of a target application item, the component relation establishing device analyzes the component annotation to obtain a component identifier and a layout position of the component contained in the component annotation, and the component relation establishing device generates a scene and the like of the component relation file of the target application item according to the component identifier and the layout position. The component relation file is generated based on the component annotation, so that the component relation file related to the component is automatically generated, the maintenance of the component relation file is not needed, the component annotation contains the component identification and the layout position of the component, the direct component relation with the interface frame is not needed, the layout position of the component is independently described by the component relation file, the coupling degree between the component and the interface frame is reduced, the management difficulty of the component is reduced, and the expansibility of the component is further improved.
The component relationship establishing device related to the embodiment of the present invention may include: terminal devices such as a tablet computer, a smart phone, a notebook computer, a palm computer, a personal computer, and a Mobile Internet Device (MID) having functions of compiling and running application items, or codes in the terminal devices may be compiled and run applications; the annotation is a markup language, can be displayed in source code in a syntax of a special format, can be used for modifying classes, methods, variables, parameters, packages and the like, can be integrated in a compiled class file, and can take effect when the code runs, and specifically defines the component identification of the component and the layout position of the component in the interface framework; the component relationship file describes, in particular, a layout position of one or more components in the target application project based on component annotations for the components.
A method for establishing a component relationship according to an embodiment of the present invention will be described in detail below with reference to fig. 1 and 2.
Referring to fig. 1, a flow diagram of a component relationship establishing method is provided in the embodiment of the present invention. As shown in fig. 1, the method of the embodiment of the present invention may include the following steps S101 to S103.
S101, acquiring a component carrying a component annotation in a class file of a target application project;
specifically, the component relationship establishing device may obtain a component carrying a component annotation in a class file of the target application item, where it is understood that the class file may be one or more class files, the component may be one or more components, each component may be represented by a set of codes, the component annotation may be placed at a specified position in the set of codes, and the component relationship establishing device may traverse the class file and obtain the component carrying the component annotation in the class file after the traversal.
S102, analyzing the component annotation to obtain the component identification and layout position of the component contained in the component annotation;
specifically, the component relationship establishing device may parse the component annotation, and obtain a component identifier and a layout position of the component included in the component annotation after parsing, where the component identifier is used to indicate a component type and a component name of a component corresponding to the component, the component identifier may specifically include a component serial number (Identity, ID), a component name, and the like, and the layout position is used to indicate a specific output display position of the component corresponding to the component under the interface frame, and specifically may include a name and a position identifier of the interface frame, and the like.
S103, generating a component relation file of the target application project according to the component identification and the layout position;
specifically, when the component relation establishing device acquires the component identifier and the layout position, a component relationship file for the target application project may be generated based on the component identification and the layout position and, further, the component relationship establishing device may obtain a component type corresponding to the component identifier, where the component type may include a functional plug-in and a User Interface (UI) plug-in, the functional plug-ins may be represented as initialization plug-ins required when running the target application item, the UI plug-in may represent a business plug-in required to be exposed for the target application project, and the component relationship establishing device may encapsulate the component identifier and the layout position as dependency relationship information of the component, and generate a component relationship file including the component type and the dependency relationship information.
In the embodiment of the invention, the component carrying the component annotation is obtained in the class file of the target application item, the component annotation is analyzed to obtain the component identifier and the layout position of the component contained in the component annotation, and finally the component relation file of the target application item is generated according to the component identifier and the layout position. The component relation file is generated based on the component annotation, so that the component relation file related to the component is automatically generated, the maintenance of the component relation file is not needed, the component annotation contains the component identification and the layout position of the component, the direct component relation with the interface frame is not needed, the layout position of the component is independently described by the component relation file, the coupling degree between the component and the interface frame is reduced, the management difficulty of the component is reduced, and the expansibility of the component is further improved.
Referring to fig. 2, a flow chart of another component relationship establishing method according to an embodiment of the present invention is shown. As shown in fig. 2, the method of the embodiment of the present invention may include the following steps S201 to S208.
S201, compiling a project script of a target application project to generate a class file corresponding to the project script;
specifically, the class file may be a file generated by compiling a project script of a target application project, the component relationship establishing device may compile the project script of the target application project in advance, and generate a class file corresponding to the project script and a library depending on the target application project after the compilation, where the library depending on the class file may be an open source library provided by a third party, a development information library developed by a developer for the target application project, and the like.
S202, acquiring a component carrying a component annotation in a class file of a target application project;
specifically, the component relationship establishing device may obtain a component carrying a component annotation in a class file of a target application item, where it may be understood that the class file may be one or more class files, the component may be one or more components, each component may be represented by a set of codes, the component annotation may be placed at a specified position in the set of codes, and the component relationship establishing device may traverse the class file and obtain the component carrying the component annotation in the class file after the traversal.
S203, analyzing the component annotation to obtain the component identification and layout position of the component contained in the component annotation;
specifically, the component relationship establishing device may parse the component annotation, and obtain a component identifier and a layout position of the component included in the component annotation after parsing, where the component identifier is used to indicate a component type and a component name of a component corresponding to the component identifier, the component identifier may specifically include a component ID, a component name, and the like, and the layout position is used to indicate a specific output display position of the component corresponding to the component under the interface frame, and may specifically include a name and a position identifier of the interface frame, and the like.
S204, acquiring the component type corresponding to the component identifier, and packaging the component identifier and the layout position as dependency relationship information of the component;
s205, generating a component relation file containing the component type and the dependency relation information;
specifically, the component relationship establishing device may obtain a component type corresponding to the component identifier, where the component type may include a functional plug-in and a UI plug-in, where the functional plug-in may be represented as an initialization plug-in required when the target application item is run, and the UI plug-in may be represented as a service plug-in required to be displayed by the target application item, and preferably, the component relationship establishing device may determine the component type of the component according to a component ID of the component, for example: if the component ID is "0", the component is a functional plug-in; and if the component ID is other numbers than 0, the component is a UI plug-in and the like. The component relationship establishing device may encapsulate the component identifier and the layout position as dependency relationship information of the component, and generate a component relationship file including the component type and the dependency relationship information, where a file type of the component relationship file is preferably an Extensible Markup Language (XML) file.
It should be noted that the component relationship file may be generated during compiling of the target application item or during running of the target application item, and in order to balance compiling efficiency and running efficiency, the component relationship file is preferably generated during compiling of the target application item.
S206, when the project script of the target application project is operated, acquiring the component type and the dependency relationship information contained in the component relationship file;
s207, loading the component according to the component type and the dependency relationship information;
specifically, when the component relationship establishing device runs the project script of the target application project, the component relationship establishing device may obtain the component type and the dependency relationship information included in the component relationship file, and load the component according to the component type and the dependency relationship information, preferably, if the component type indicates that the component is a functional plug-in, the component relationship establishing device may obtain the component indicated by the component identifier, and load the component based on the layout position; if the component type indicates that the component is a UI plug-in, the component relationship establishing device may obtain the component indicated by the component identifier after detecting that all the components whose component types are functional plug-ins are loaded, and load the component based on the layout position.
S208, when the abnormal operation of the project script of the target application project is detected, judging whether the loading processing of the component is finished, if so, reloading the component according to the component type and the dependency relationship information;
specifically, when the component relationship establishing device detects that the project script of the target application project is abnormally operated, the component relationship establishing device may determine whether the loading processing of the component is completed, and if the loading processing of the component is completed, the component relationship establishing device may perform the reloading processing on the component according to the component type and the dependency information, where a process of the reloading processing may be the same as a process of the loading processing, and is not described herein again.
In the embodiment of the invention, the component carrying the component annotation is obtained in the class file of the target application item, the component annotation is analyzed to obtain the component identifier and the layout position of the component contained in the component annotation, and finally the component relation file of the target application item is generated according to the component identifier and the layout position. The component relation file is generated based on the component annotation, so that the component relation file related to the component is automatically generated, the maintenance of the component relation file is not needed, the component annotation contains the component identifier and the layout position of the component, the direct component relation with the interface frame is not needed, the layout position of the component is independently described by the component relation file, the coupling degree between the component and the interface frame is reduced, the management difficulty of the component is reduced, and the expansibility of the component is further improved; by generating the component relationship file during compiling and reading the file and loading the component during running, the compiling efficiency and the running efficiency are effectively balanced.
The component relationship establishing apparatus provided by the embodiment of the present invention will be described in detail below with reference to fig. 3 to 5. It should be noted that, the component relationship establishing apparatus shown in fig. 3-5 is used for executing the method of the embodiment shown in fig. 1 and fig. 2 of the present invention, for convenience of description, only the portion related to the embodiment of the present invention is shown, and details of the specific technology are not disclosed, please refer to the embodiment shown in fig. 1 and fig. 2 of the present invention.
Referring to fig. 3, a schematic structural diagram of a component relationship establishing apparatus is provided in an embodiment of the present invention. As shown in fig. 3, the component relationship establishing apparatus 1 according to the embodiment of the present invention may include: a component acquisition unit 11, an annotation parsing unit 12 and a relationship file generation unit 13.
The component obtaining unit 11 is configured to obtain a component carrying a component annotation in a class file of a target application project;
in a specific implementation, the component obtaining unit 11 may obtain a component carrying a component annotation in a class file of a target application item, and it may be understood that the class file may be one or more class files, the component may be one or more components, each component may be represented by a set of codes, the component annotation may be placed at a specified position in the set of codes, and the component obtaining unit 11 may traverse the class file and obtain the component carrying the component annotation in the class file after the traversal.
An annotation parsing unit 12, configured to parse the component annotation to obtain a component identifier and a layout position of the component included in the component annotation;
in a specific implementation, the annotation parsing unit 12 may parse the component annotation, and obtain a component identifier and a layout position of the component included in the component annotation after parsing, where the component identifier is used to indicate a component type and a component name of a component corresponding to the component, the component identifier may specifically include a component ID and a component name, and the layout position is used to indicate a specific output display position of the component corresponding to the component under the interface frame, and specifically may include a name and a position identifier of the interface frame.
A relationship file generating unit 13, configured to generate a component relationship file of the target application item according to the component identifier and the layout position;
in a specific implementation, when the annotation parsing unit 12 obtains the component identifier and the layout position, the relationship file generating unit 13 may generate a component relationship file of the target application item according to the component identifier and the layout position, and further, the relationship file generating unit 13 may obtain a component type corresponding to the component identifier, where the component type may include a functional plug-in and a UI plug-in, the functional plug-ins may be represented as initialization plug-ins required when running the target application item, the UI plug-in may represent a service plug-in required to be exposed by the target application item, and the relationship file generating unit 13 may encapsulate the component identifier and the layout position as dependency information of the component, and generate a component relationship file including the component type and the dependency information.
In the embodiment of the invention, the component carrying the component annotation is obtained in the class file of the target application item, the component annotation is analyzed to obtain the component identifier and the layout position of the component contained in the component annotation, and finally the component relation file of the target application item is generated according to the component identifier and the layout position. The component relation file is generated based on the component annotation, so that the component relation file related to the component is automatically generated, the maintenance of the component relation file is not needed, the component annotation contains the component identification and the layout position of the component, the direct component relation with the interface frame is not needed, the layout position of the component is independently described by the component relation file, the coupling degree between the component and the interface frame is reduced, the management difficulty of the component is reduced, and the expansibility of the component is further improved.
Referring to fig. 4, a schematic structural diagram of another component relationship establishing apparatus is provided in the embodiment of the present invention. As shown in fig. 4, the component relationship establishing apparatus 1 according to the embodiment of the present invention may include: the system comprises a component acquisition unit 11, an annotation analysis unit 12, a relationship file generation unit 13, a class file generation unit 14, a data acquisition unit 15, a component loading unit 16 and a component reloading unit 17.
The class file generating unit 14 is configured to compile a project script of a target application project to generate a class file corresponding to the project script;
in a specific implementation, the class file may be a file generated by compiling a project script of a target application project, the class file generating unit 14 may compile the project script of the target application project in advance, and generate a class file corresponding to the project script and a library depending on the target application project after the compilation, where the library depending on the class file may be an open source library provided by a third party, a development information library developed by a developer for the target application project, and the like.
The component obtaining unit 11 is configured to obtain a component carrying a component annotation in a class file of a target application project;
in a specific implementation, the component obtaining unit 11 may obtain a component carrying a component annotation in a class file of a target application item, and it may be understood that the class file may be one or more class files, the component may be one or more components, each component may be represented by a set of codes, the component annotation may be placed at a specified position in the set of codes, and the component obtaining unit 11 may traverse the class file and obtain the component carrying the component annotation in the class file after the traversal.
An annotation parsing unit 12, configured to parse the component annotation to obtain a component identifier and a layout position of the component included in the component annotation;
in a specific implementation, the annotation parsing unit 12 may parse the component annotation, and obtain a component identifier and a layout position of the component included in the component annotation after parsing, where the component identifier is used to indicate a component type and a component name of a component corresponding to the component, the component identifier may specifically include a component ID and a component name, and the layout position is used to indicate a specific output display position of the component corresponding to the component under the interface frame, and specifically may include a name and a position identifier of the interface frame.
A relationship file generating unit 13, configured to generate a component relationship file of the target application item according to the component identifier and the layout position;
in a specific implementation, when the annotation parsing unit 12 obtains the component identifier and the layout position, the relationship file generating unit 13 may generate a component relationship file of the target application item according to the component identifier and the layout position, and further, the relationship file generating unit 13 may obtain a component type corresponding to the component identifier, where the component type may include a functional plug-in and a UI plug-in, the functional plug-ins may be represented as initialization plug-ins required when running the target application item, the UI plug-in may represent a service plug-in required to be exposed by the target application item, and the relationship file generating unit 13 may encapsulate the component identifier and the layout position as dependency information of the component, and generate a component relationship file including the component type and the dependency information.
Specifically, please refer to fig. 5, which provides a schematic structural diagram of the relationship file generating unit according to an embodiment of the present invention. As shown in fig. 5, the relationship file generating unit 13 may include:
an information packaging subunit 131, configured to obtain a component type corresponding to the component identifier, and package the component identifier and the layout position as dependency relationship information of the component;
a relationship file generating subunit 132, configured to generate a component relationship file including the component type and the dependency relationship information;
in a specific implementation, the information packaging subunit 131 may obtain a component type corresponding to the component identifier, where the component type may include a functional plug-in and a UI plug-in, where the functional plug-in may be represented as an initialization plug-in required when the target application item is run, and the UI plug-in may be represented as a service plug-in required to be displayed by the target application item, and preferably, the information packaging subunit 131 may determine the component type of the component according to a component ID of the component, for example: if the component ID is "0", the component is a functional plug-in; and if the component ID is other numbers than 0, the component is a UI plug-in and the like. The information packaging subunit 131 may package the component identifier and the layout position as dependency relationship information of the component, and the relationship file generating subunit 132 generates a component relationship file including the component type and the dependency relationship information, where the file type of the component relationship file is preferably an XML file.
It should be noted that the component relationship file may be generated during compiling of the target application item or during running of the target application item, and in order to balance compiling efficiency and running efficiency, the component relationship file is preferably generated during compiling of the target application item.
A data obtaining unit 15, configured to obtain the component type and the dependency relationship information included in the component relationship file when running a project script of the target application project;
the component loading unit 16 is configured to load the component according to the component type and according to the dependency relationship information;
in a specific implementation, when the component relationship establishing device 1 runs the project script of the target application project, the data obtaining unit 15 may obtain the component type and the dependency relationship information included in the component relationship file, and the component loading unit 16 loads the component according to the component type and the dependency relationship information, preferably, if the component type indicates that the component is a functional plug-in, the component loading unit 16 may obtain the component indicated by the component identifier and load the component based on the layout position; if the component type indicates that the component is a UI plug-in, the component loading unit 16 may obtain the component indicated by the component identifier after detecting that all the component loading processes of which the component type is a functional plug-in are completed, and load the component based on the layout position.
A component reloading unit 17, configured to, when detecting that the project script of the target application project is abnormally operated, determine whether loading processing of the component is completed, and if yes, reload the component according to the component type and the dependency information;
in a specific implementation, when the component relationship establishing device 1 detects that the project script of the target application project is abnormally operated, the component reloading unit 17 may determine whether the loading processing of the component is completed, and if the loading processing of the component is completed, the component reloading unit 17 may reload the component according to the component type and the dependency relationship information, where a process of the reloading may be the same as a process of the loading processing, and is not described herein again.
In the embodiment of the invention, the component carrying the component annotation is obtained in the class file of the target application item, the component annotation is analyzed to obtain the component identifier and the layout position of the component contained in the component annotation, and finally the component relation file of the target application item is generated according to the component identifier and the layout position. The component relation file is generated based on the component annotation, so that the component relation file related to the component is automatically generated, the maintenance of the component relation file is not needed, the component annotation contains the component identifier and the layout position of the component, the direct component relation with the interface frame is not needed, the layout position of the component is independently described by the component relation file, the coupling degree between the component and the interface frame is reduced, the management difficulty of the component is reduced, and the expansibility of the component is further improved; by generating the component relationship file during compiling and reading the file and loading the component during running, the compiling efficiency and the running efficiency are effectively balanced.
Referring to fig. 6, a schematic structural diagram of another component relationship establishing apparatus according to an embodiment of the present invention is provided. As shown in fig. 6, the component relationship establishing apparatus 1000 may include: at least one processor 1001, such as a CPU, at least one network interface 1004, a user interface 1003, memory 1005, at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display) and a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a standard wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 6, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a relationship establishment application program.
In the component relationship establishing apparatus 1000 shown in fig. 6, the user interface 1003 is mainly used to provide an input interface for a user, and acquire data input by the user; and the processor 1001 may be configured to invoke the relationship establishment application stored in the memory 1005, and specifically perform the following operations:
acquiring a component carrying a component annotation in a class file of a target application project;
analyzing the component annotation to acquire the component identification and layout position of the component contained in the component annotation;
and generating a component relation file of the target application project according to the component identification and the layout position.
In one embodiment, before executing the step of obtaining the component carrying the component annotation in the class file of the target application item, the processor 1001 further executes the following operations:
compiling a project script of a target application project to generate a class file corresponding to the project script;
when the processor 1001 acquires a component carrying a component annotation in a class file of a target application item, the following operations are specifically performed:
and traversing the class file, and acquiring the component carrying the component annotation in the class file after traversing.
In an embodiment, when the processor 1001 executes the generation of the component relationship file of the target application item according to the component identifier and the layout position, the following operation is specifically executed:
acquiring a component type corresponding to the component identifier, and packaging the component identifier and the layout position as dependency relationship information of the component, wherein the component type comprises at least one of a functional plug-in and a UI plug-in;
and generating a component relation file containing the component type and the dependency relation information.
In one embodiment, the processor 1001 further performs the following operations:
when the project script of the target application project is operated, acquiring the component type and the dependency relationship information contained in the component relationship file;
and loading the component according to the component type and the dependency relationship information.
In an embodiment, when the processor 1001 executes the loading processing on the component according to the component type and the dependency relationship information, specifically execute the following operations:
if the component type indicates that the component is a functional plug-in, acquiring the component indicated by the component identification, and loading the component based on the layout position; alternatively, the first and second electrodes may be,
if the component type indicates that the component is a UI plug-in, after all the components of which the component types are functional plug-ins are detected to be loaded, the component indicated by the component identification is obtained, and the component is loaded based on the layout position.
In one embodiment, the processor 1001 further performs the following operations:
and when detecting that the project script of the target application project is abnormally operated, judging whether the loading processing of the component is finished, if so, reloading the component according to the component type and the dependency relationship information.
In the embodiment of the invention, the component carrying the component annotation is obtained in the class file of the target application item, the component annotation is analyzed to obtain the component identifier and the layout position of the component contained in the component annotation, and finally the component relation file of the target application item is generated according to the component identifier and the layout position. The component relation file is generated based on the component annotation, so that the component relation file related to the component is automatically generated, the maintenance of the component relation file is not needed, the component annotation contains the component identifier and the layout position of the component, the direct component relation with the interface frame is not needed, the layout position of the component is independently described by the component relation file, the coupling degree between the component and the interface frame is reduced, the management difficulty of the component is reduced, and the expansibility of the component is further improved; by generating the component relationship file during compiling and reading the file and loading the component during running, the compiling efficiency and the running efficiency are effectively balanced.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

Claims (12)

1. A method for establishing component relationships, comprising:
when a project script of a target application project is operated, acquiring a component carrying a component annotation in a class file of the target application project;
analyzing the component annotation to acquire the component identification and layout position of the component contained in the component annotation; the layout position is an output display position of the component under the interface frame;
acquiring a component type corresponding to the component identifier, and packaging the component identifier and the layout position as dependency relationship information of the component, wherein the component type comprises at least one of a functional plug-in and a user interface UI plug-in; the component type is used to determine a loading order of the components;
and generating a component relation file containing the component type and the dependency relation information.
2. The method of claim 1, wherein before obtaining the component carrying the component annotation in the class file of the target application item, further comprising:
compiling a project script of a target application project to generate a class file corresponding to the project script;
acquiring the component carrying the component annotation in the class file of the target application project, wherein the method comprises the following steps:
and traversing the class file, and acquiring the component carrying the component annotation in the class file after traversing.
3. The method of claim 1, further comprising:
when the project script of the target application project is operated, acquiring the component type and the dependency relationship information contained in the component relationship file;
and loading the component according to the component type and the dependency relationship information.
4. The method according to claim 3, wherein the loading the component according to the component type and according to the dependency information comprises:
if the component type indicates that the component is a functional plug-in, acquiring the component indicated by the component identification, and loading the component based on the layout position; alternatively, the first and second electrodes may be,
if the component type indicates that the component is a UI plug-in, after all the components of which the component types are functional plug-ins are detected to be loaded, the component indicated by the component identification is obtained, and the component is loaded based on the layout position.
5. The method of claim 1, further comprising:
and when detecting that the project script of the target application project is abnormally operated, judging whether the loading processing of the component is finished, if so, reloading the component according to the component type and the dependency relationship information.
6. A component relationship establishment apparatus, comprising:
the component acquisition unit is used for acquiring a component carrying a component annotation in a class file of a target application project when the project script of the target application project is operated;
the annotation parsing unit is used for parsing the component annotation to acquire the component identification and the layout position of the component contained in the component annotation; the layout position is an output display position of the component under the interface frame;
the information packaging subunit is used for acquiring a component type corresponding to the component identifier and packaging the component identifier and the layout position as dependency relationship information of the component, wherein the component type comprises at least one of a functional plug-in and a user interface UI plug-in; the component type is used to determine a loading order of the components;
and the relation file generating subunit is used for generating a component relation file containing the component type and the dependency relation information.
7. The apparatus of claim 6, further comprising:
the class file generation unit is used for compiling a project script of a target application project to generate a class file corresponding to the project script;
the component obtaining unit is specifically configured to traverse the class file, and obtain a component carrying a component annotation in the class file after the traversal.
8. The apparatus of claim 6, further comprising:
a data obtaining unit, configured to obtain the component type and the dependency relationship information included in the component relationship file when running a project script of the target application project;
and the component loading unit is used for loading the component according to the component type and the dependency relationship information.
9. The device according to claim 8, wherein the component loading unit is specifically configured to, if the component type indicates that the component is a functional plug-in, obtain the component indicated by the component identifier, and load the component based on the layout position; alternatively, the first and second electrodes may be,
if the component type indicates that the component is a UI plug-in, after all the components of which the component types are functional plug-ins are detected to be loaded, the component indicated by the component identification is obtained, and the component is loaded based on the layout position.
10. The apparatus of claim 6, further comprising:
and the component reloading unit is used for judging whether the loading processing of the component is finished or not when the abnormal operation of the project script of the target application project is detected, and if so, reloading the component according to the component type and the dependency relationship information.
11. A mobile terminal, characterized in that it comprises a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to carry out the steps of the method according to any one of claims 1-5.
12. A computer storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the method of any one of claims 1-5.
CN201610042009.8A 2016-01-21 2016-01-21 Component relation establishing method and equipment Active CN105718289B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610042009.8A CN105718289B (en) 2016-01-21 2016-01-21 Component relation establishing method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610042009.8A CN105718289B (en) 2016-01-21 2016-01-21 Component relation establishing method and equipment

Publications (2)

Publication Number Publication Date
CN105718289A CN105718289A (en) 2016-06-29
CN105718289B true CN105718289B (en) 2020-12-29

Family

ID=56154992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610042009.8A Active CN105718289B (en) 2016-01-21 2016-01-21 Component relation establishing method and equipment

Country Status (1)

Country Link
CN (1) CN105718289B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106371850A (en) * 2016-09-19 2017-02-01 上海葡萄纬度科技有限公司 Method for establishing customizable desktop widget
CN106502541B (en) * 2016-11-03 2019-08-27 贵阳朗玛信息技术股份有限公司 A kind of operating method and device of Android interface
CN107229477B (en) * 2017-06-09 2019-10-08 华东师范大学 A kind of component interactive relationship modeling method based on co-development system
CN107256308B (en) * 2017-06-09 2019-10-08 华东师范大学 A kind of component interactive relationship modeling system based on co-development system
CN107391218A (en) * 2017-07-07 2017-11-24 北京小米移动软件有限公司 Compilation Method and device, electronic equipment and computer-readable recording medium
CN108762745B (en) * 2018-05-25 2022-01-21 中国光大银行股份有限公司 Service script generation method and device
CN109582303B (en) * 2018-10-31 2024-05-03 平安科技(深圳)有限公司 General component calling method, device, computer equipment and storage medium
CN109558139A (en) * 2018-11-21 2019-04-02 北京城市网邻信息技术有限公司 Marker method, device, computer equipment and the storage medium of component dependencies
CN111324333B (en) * 2018-12-17 2022-08-30 中移(杭州)信息技术有限公司 Software development method and device based on componentization
CN109656558B (en) * 2018-12-19 2022-04-19 四川虹美智能科技有限公司 Method and device for generating UI plug-in
CN112214219B (en) * 2019-06-24 2023-11-10 腾讯科技(深圳)有限公司 Component processing method and device, server and storage medium
CN112860232A (en) * 2019-11-28 2021-05-28 杭州萤石软件有限公司 Component implementation method and device
CN112579061A (en) * 2020-12-17 2021-03-30 青岛以萨数据技术有限公司 Method, device, system and storage medium for data transmission between android components
CN112769706B (en) * 2020-12-24 2023-03-24 平安银行股份有限公司 Componentized routing method and system
CN112965940B (en) * 2021-03-04 2024-05-28 中国邮政储蓄银行股份有限公司 Project file display method and device, electronic equipment and processor

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1816562A1 (en) * 2006-02-03 2007-08-08 Research In Motion Limited System and method for extending a component-based application platform with custom services
WO2007022110A3 (en) * 2005-08-12 2007-09-27 Symyx Technologies Inc Event-based library process design
CN101477461A (en) * 2009-02-10 2009-07-08 腾讯科技(深圳)有限公司 Dynamic generation apparatus and method for application program interface
CN101771762A (en) * 2009-01-06 2010-07-07 北京邮电大学 Method and system for dynamically loading services in service system
CN102549548A (en) * 2009-10-09 2012-07-04 微软公司 Location-based service middleware
CN103164197A (en) * 2011-12-14 2013-06-19 中兴通讯股份有限公司 User interface (UI) distribution self-adaption method, mobile device and distribution generating device
WO2014159943A3 (en) * 2013-03-14 2015-03-26 Bitvore Corp. Dynamically loaded plugin architecture
CN104899015A (en) * 2014-03-07 2015-09-09 上海高达星软件系统有限公司 Service component management system and method thereof

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7293254B2 (en) * 2003-09-18 2007-11-06 Microsoft Corporation Extensibility application programming interface and framework for meta-model objects
CN100549958C (en) * 2007-10-11 2009-10-14 金蝶软件(中国)有限公司 A kind of class file stowage and system
CN102637130A (en) * 2012-03-15 2012-08-15 北京神州数码思特奇信息技术股份有限公司 Method and device for building web projects
US20140337277A1 (en) * 2013-05-09 2014-11-13 Rockwell Automation Technologies, Inc. Industrial device and system attestation in a cloud platform

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007022110A3 (en) * 2005-08-12 2007-09-27 Symyx Technologies Inc Event-based library process design
EP1816562A1 (en) * 2006-02-03 2007-08-08 Research In Motion Limited System and method for extending a component-based application platform with custom services
CN101771762A (en) * 2009-01-06 2010-07-07 北京邮电大学 Method and system for dynamically loading services in service system
CN101477461A (en) * 2009-02-10 2009-07-08 腾讯科技(深圳)有限公司 Dynamic generation apparatus and method for application program interface
CN102549548A (en) * 2009-10-09 2012-07-04 微软公司 Location-based service middleware
CN103164197A (en) * 2011-12-14 2013-06-19 中兴通讯股份有限公司 User interface (UI) distribution self-adaption method, mobile device and distribution generating device
WO2014159943A3 (en) * 2013-03-14 2015-03-26 Bitvore Corp. Dynamically loaded plugin architecture
CN104899015A (en) * 2014-03-07 2015-09-09 上海高达星软件系统有限公司 Service component management system and method thereof

Also Published As

Publication number Publication date
CN105718289A (en) 2016-06-29

Similar Documents

Publication Publication Date Title
CN105718289B (en) Component relation establishing method and equipment
US8549490B2 (en) Static code analysis for packaged application customization
CN111240684B (en) Cutting method and device of JS codes, medium and electronic equipment
CN108845839B (en) Application page loading method and device and computer readable storage medium
CN105718313A (en) Application operation method and device
CN108762767B (en) Application publishing method, device and computer readable storage medium
CN110895471A (en) Installation package generation method, device, medium and electronic equipment
CN111367510A (en) Android function module development method and device
CN111694613A (en) Decoupling method between application program modules, electronic device and storage medium
KR101117165B1 (en) Web platform unit for mobile terminal connectioned web-application program in heterogeneous operating system
CN112835568A (en) Project construction method and device
CN115543440A (en) Method for migrating android project to android-like system, electronic equipment and storage medium
CN111782239B (en) Method, device and storage medium for software packaging and source code version information acquisition
CN111488144A (en) Data processing method and equipment
CN111158777A (en) Component calling method and device and computer readable storage medium
CN110826074A (en) Application vulnerability detection method and device and computer readable storage medium
CN113138768B (en) Application package generation method and device, electronic equipment and readable storage medium
Martinez et al. Migrating c/c++ software to mobile platforms in the adm context
CN115328543A (en) System, equipment and storage medium for realizing small program cross-platform
CN111427770B (en) Resource testing method and related equipment
CN107092601B (en) Resource file construction method, resource file application method and device
CN113760360A (en) File generation method, device, equipment and storage medium
CN112596751A (en) Compiling method, terminal, server and storage medium of application program installation package
CN108345461B (en) Application updating method and device and computer readable storage medium
CN117093286B (en) Plug-in generation method, device, equipment and computer readable storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant