CN113076091A - View layer assembly replacing method and device - Google Patents
View layer assembly replacing method and device Download PDFInfo
- Publication number
- CN113076091A CN113076091A CN202110628293.8A CN202110628293A CN113076091A CN 113076091 A CN113076091 A CN 113076091A CN 202110628293 A CN202110628293 A CN 202110628293A CN 113076091 A CN113076091 A CN 113076091A
- Authority
- CN
- China
- Prior art keywords
- producer
- unique key
- component
- assembly
- matching
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
Abstract
The invention relates to a method and a device for replacing a view layer assembly, which comprise the following steps: storing the assembly into a preset queue by adopting a unique key when the assembly is defined based on a control reversal technology, and generating a corresponding producer; acquiring a producer condition generated by a producer, and storing the producer condition into a producer condition queue; acquiring consumer conditions of consumers, and putting the consumer conditions into a producer condition queue for matching; and if the matching is passed, replacing the corresponding assembly of the corresponding producer with the target assembly corresponding to the consumer based on the corresponding unique key of the corresponding producer. The invention has the beneficial effects that: the problem of cyclic dependence is solved, so that modular component replacement is realized, and the replacement of the components is more convenient.
Description
Technical Field
The invention belongs to the technical field of software development, and particularly relates to a method and a device for replacing a view layer assembly.
Background
Currently, in a mainstream front-end development mode, a view layer component has component-level cyclic dependence. And incremental on-demand replacement is difficult to achieve during the development of a large number of components. I.e., upgrading and expanding existing front-end items in a non-intrusive manner. The existing general method adopts some modes of modifying original codes and recompiling to realize upgrading. This approach is not friendly to incremental development, and it is easy to make the source code too bulky and very unfavorable for modular partitioning of projects.
Disclosure of Invention
In order to solve the problems of huge codes and inconvenience in modular replacement in the prior art, the invention provides a method and a device for replacing a view layer assembly, which have the characteristics of avoiding cyclic dependence, facilitating modular replacement of modules and the like.
According to the embodiment of the invention, the method for replacing the view layer component comprises the following steps:
storing the assembly into a preset queue by adopting a unique key when the assembly is defined based on a control reversal technology, and generating a corresponding producer;
acquiring a producer condition generated by the producer, and storing the producer condition into a producer condition queue;
acquiring consumer conditions of consumers, and putting the consumer conditions into the producer condition queue for matching;
and if the matching is passed, replacing the corresponding component of the corresponding producer with the target component corresponding to the consumer based on the corresponding unique key of the corresponding producer.
Further, the view layer component replacing method further includes: and sending the unique key of the producer to a unique key management center for management.
Further, the view layer component replacing method further includes: and if the producer has a lower component, sending the context of the lower component to the unique key management center for fuzzy matching so as to obtain a unique key of the lower component.
Further, the view layer component replacing method further includes: and if the matching is passed to obtain the unique key of the lower-level assembly, replacing the lower-level assembly with the target assembly.
Further, the context includes: view type, field type, read-write status, and component name.
According to a specific embodiment of the present invention, a device for replacing a viewing layer assembly is provided, which includes:
the producer module is used for adopting a unique key to store the unique key into a preset queue when the component is defined based on a control reversal technology and generating a corresponding producer;
the condition module is used for acquiring the producer condition generated by the producer and storing the producer condition into a producer condition queue; and
the replacing module is used for acquiring consumer conditions of consumers and putting the consumer conditions into the producer condition queue for matching;
and if the matching is passed, replacing the corresponding component of the corresponding producer with the target component corresponding to the consumer based on the corresponding unique key of the corresponding producer.
Further, the system also comprises a unique key management center which is used for managing the unique key of the producer.
Further, the system comprises a matching module for sending the context of the subordinate component to the unique key management center for fuzzy matching to obtain the unique key of the subordinate component.
The invention has the beneficial effects that: the unique keys and the production conditions of the producer are respectively stored, the corresponding producer conditions are matched based on the conditions of the consumer, and the corresponding assemblies are replaced by the assemblies of the consumer through the corresponding unique keys after the matching is successful.
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 flow diagram of a view layer component replacement method provided in accordance with an exemplary embodiment;
FIG. 2 is another flow diagram of a view layer component replacement method provided in accordance with an exemplary embodiment;
FIG. 3 is a schematic diagram of a viewing layer assembly replacement apparatus provided in accordance with an exemplary embodiment;
FIG. 4 is a schematic diagram of a unique key technique provided in accordance with an exemplary embodiment;
FIG. 5 is a diagram of pre-replacement effects provided in accordance with an exemplary embodiment;
fig. 6 is a diagram of post-replacement effects provided in accordance with an exemplary embodiment.
Reference numerals
1-producer module; 2-a condition module; 3-a replacement module; 4-unique key management center; 5-matching module.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
Referring to fig. 1, an embodiment of the present invention provides a method for replacing a view layer component, which specifically includes:
101. storing the assembly into a preset queue by adopting a unique key when the assembly is defined based on a control reversal technology, and generating a corresponding producer;
when a component is defined, it is stored in a certain queue, i.e. the producer, using the unique key. The known unique key is used to pull an instance or class factory from the queue when the consumer needs to consume. Because the producer has been transformed to the implicit subclass- > base class when it is stored in the queue, the consumer is actually a strong dependency on the base class, not on the subclass. Solves the problem of cyclic dependence
102. Acquiring a producer condition generated by a producer, and storing the producer condition into a producer condition queue;
103. acquiring consumer conditions of consumers, and putting the consumer conditions into a producer condition queue for matching;
the use of a control reversal mechanism if desired requires the agreement of a unique key between the consumer and the producer. The static unique key is mainly used for a determined producer, and in actual development, a plurality of pseudo-dynamic unique keys are realized by using a plurality of methods such as configuration and the like to change the type of the runtime instance. And selecting the unique key of the producer by fuzzy matching of the consumer with the existing production conditions in the consuming process to realize the dynamic unique key in the runtime.
104. And if the matching is passed, replacing the corresponding assembly of the corresponding producer with the target assembly corresponding to the consumer based on the corresponding unique key of the corresponding producer.
Therefore, the unique keys and the production conditions of the producer are respectively stored, the corresponding producer conditions are matched based on the conditions of the consumer, and the corresponding assemblies are replaced by the assemblies of the consumer through the corresponding unique keys after the matching is successful.
It should be noted that a module that generates data in the field of software development is called a producer, and a module that processes data is called a consumer.
As a possible implementation manner of the above embodiment, referring to fig. 4, each producer registers a producer condition and generates a globally unique key α in a specific implementation. When the consumption behavior is generated, the consumer puts the condition of the consumer into the condition queue of the producer for matching, and when the matching is passed, the unique key alpha can be obtained. So that the replacement of the corresponding component is made based on the unique key alpha.
Referring to fig. 2, in another embodiment of the present invention, a method for replacing a view layer component specifically includes:
201. storing the assembly into a preset queue by adopting a unique key when the assembly is defined based on a control reversal technology, and generating a corresponding producer;
202. acquiring a producer condition generated by a producer, and storing the producer condition into a producer condition queue;
203. acquiring consumer conditions of consumers, and putting the consumer conditions into a producer condition queue for matching;
204. if the matching is passed, replacing the corresponding assembly of the corresponding producer with the target assembly corresponding to the consumer based on the corresponding unique key of the corresponding producer
205. And sending the unique key of the producer to a unique key management center for management.
206. And if the producer has the lower component, sending the context of the lower component to the unique key management center for fuzzy matching so as to obtain the unique key of the lower component.
207. And if the matching is passed to obtain the unique key of the lower-level assembly, replacing the lower-level assembly with the target assembly.
Specifically, the context includes: view type, field type, read-write status, and component name. For any component, when the lower component exists in the component, the component transmits the context of the lower component needing to be rendered into a unique key management center for fuzzy matching, and the unique key of the lower component is obtained and used for obtaining the lower component instance. Referring to fig. 5 and 6, the tree structure of the original component includes a form, a detail and an attribute, where the form includes basic information, the basic information includes a user, an action and a role, and the action includes cancellation and submission; the particulars include the warehouse.
For any component, when the lower component exists in the component, the component transmits the context of the lower component needing to be rendered into a unique key management center for fuzzy matching, and the unique key of the lower component is obtained and used for obtaining the lower component instance. Wherein a context is a series of attributes mutually agreed between the producer and consumer components, for example, when trying to select a field component, the existing component is matched by using 4 attributes of view type, field type (data type), read-write state and component name. For example, the registration condition of the submission component is view type: a form; content area: basic information; name: and submitting, and further because the registration condition of the submitting component meets the rendering condition of the alpha component and the registration time is later than alpha, naturally replacing the component tree with the submitting component with the arc-shaped four corners during re-rendering.
Based on the same design idea, referring to fig. 3, an embodiment of the present invention further provides a view-layer component replacing apparatus, configured to execute a computer program including the view-layer component replacing method described in the foregoing embodiment, where the apparatus includes:
the producer module 1 is used for storing the assembly into a preset queue by adopting a unique key when the assembly is defined based on a control reversal technology and generating a corresponding producer;
the condition module 2 is used for acquiring the producer conditions generated by the producer and storing the producer conditions into a producer condition queue; and
the replacing module 3 is used for acquiring consumer conditions of consumers and putting the consumer conditions into a producer condition queue for matching;
and if the matching is passed, replacing the corresponding assembly of the corresponding producer with the target assembly corresponding to the consumer based on the corresponding unique key of the corresponding producer.
A unique key management center 4 is also included for managing the unique keys of the producers.
The system further comprises a matching module 5, which is used for sending the context of the subordinate component to a unique key management center for fuzzy matching so as to obtain the unique key of the subordinate component.
The view layer component replacing device provided by the embodiment of the invention can execute the view layer component replacing method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the executing method.
The method and the device for replacing the view layer component provided by the embodiment of the invention have the advantages that the implicit conversion from the subclass to the base class is already carried out on the producer when the producer is stored in the queue process, so that the consumer actually depends on the base class strongly instead of the subclass strongly, the problem of cyclic dependence is solved, the modularized component replacement is realized, and the component replacement is more convenient.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
What has been described above includes examples of one or more embodiments. It is, of course, not possible to describe every conceivable combination of components or methodologies for purposes of describing the aforementioned embodiments, but one of ordinary skill in the art may recognize that many further combinations and permutations of various embodiments are possible. Accordingly, the embodiments described herein are intended to embrace all such alterations, modifications and variations that fall within the scope of the appended claims. Furthermore, to the extent that the term "includes" is used in either the detailed description or the claims, such term is intended to be inclusive in a manner similar to the term "comprising" as "comprising" is interpreted when employed as a transitional word in a claim. Furthermore, any use of the term "or" in the specification of the claims is intended to mean a "non-exclusive or".
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
Claims (8)
1. A method for replacing a viewing layer component is characterized by comprising the following steps:
storing the assembly into a preset queue by adopting a unique key when the assembly is defined based on a control reversal technology, and generating a corresponding producer;
acquiring a producer condition generated by the producer, and storing the producer condition into a producer condition queue;
acquiring consumer conditions of consumers, and putting the consumer conditions into the producer condition queue for matching;
and if the matching is passed, replacing the corresponding component of the corresponding producer with the target component corresponding to the consumer based on the corresponding unique key of the corresponding producer.
2. The viewing layer assembly replacement method of claim 1, further comprising: and sending the unique key of the producer to a unique key management center for management.
3. The viewing layer assembly replacement method of claim 2, further comprising: and if the producer has a lower component, sending the context of the lower component to the unique key management center for fuzzy matching so as to obtain a unique key of the lower component.
4. The view layer component replacement method of claim 3, further comprising: and if the matching is passed to obtain the unique key of the lower-level assembly, replacing the lower-level assembly with the target assembly.
5. The view layer component replacement method of claim 3, wherein the context comprises: view type, field type, read-write status, and component name.
6. A look picture layer subassembly replacement device, characterized in that includes:
the producer module is used for adopting a unique key to store the unique key into a preset queue when the component is defined based on a control reversal technology and generating a corresponding producer;
the condition module is used for acquiring the producer condition generated by the producer and storing the producer condition into a producer condition queue; and
the replacing module is used for acquiring consumer conditions of consumers and putting the consumer conditions into the producer condition queue for matching;
and if the matching is passed, replacing the corresponding component of the corresponding producer with the target component corresponding to the consumer based on the corresponding unique key of the corresponding producer.
7. The viewing layer assembly replacement apparatus of claim 6, further comprising a unique key management center for managing unique keys of said producers.
8. The viewing layer component replacing apparatus according to claim 7, further comprising a matching module, configured to send a context of a lower component to the unique key management center for fuzzy matching to obtain a unique key of the lower component.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110628293.8A CN113076091B (en) | 2021-06-07 | 2021-06-07 | View layer assembly replacing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110628293.8A CN113076091B (en) | 2021-06-07 | 2021-06-07 | View layer assembly replacing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113076091A true CN113076091A (en) | 2021-07-06 |
CN113076091B CN113076091B (en) | 2021-09-14 |
Family
ID=76617161
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110628293.8A Active CN113076091B (en) | 2021-06-07 | 2021-06-07 | View layer assembly replacing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113076091B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103345427A (en) * | 2013-07-15 | 2013-10-09 | 四川公用信息产业有限责任公司 | View switching system and method based on Android message handling mechanism |
CN109213462A (en) * | 2018-08-07 | 2019-01-15 | 武汉斗鱼网络科技有限公司 | Android horizontal/vertical screen method of data synchronization, device, terminal and readable medium |
CN112199426A (en) * | 2020-09-24 | 2021-01-08 | 建信金融科技有限责任公司 | Interface call management method, device, server and medium under micro-service architecture |
CN112527528A (en) * | 2020-12-18 | 2021-03-19 | 平安科技(深圳)有限公司 | Data transmission method, device and storage medium based on message queue |
-
2021
- 2021-06-07 CN CN202110628293.8A patent/CN113076091B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103345427A (en) * | 2013-07-15 | 2013-10-09 | 四川公用信息产业有限责任公司 | View switching system and method based on Android message handling mechanism |
CN109213462A (en) * | 2018-08-07 | 2019-01-15 | 武汉斗鱼网络科技有限公司 | Android horizontal/vertical screen method of data synchronization, device, terminal and readable medium |
CN112199426A (en) * | 2020-09-24 | 2021-01-08 | 建信金融科技有限责任公司 | Interface call management method, device, server and medium under micro-service architecture |
CN112527528A (en) * | 2020-12-18 | 2021-03-19 | 平安科技(深圳)有限公司 | Data transmission method, device and storage medium based on message queue |
Also Published As
Publication number | Publication date |
---|---|
CN113076091B (en) | 2021-09-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Atkinson et al. | A flexible infrastructure for multilevel language engineering | |
US9146955B2 (en) | In-memory, columnar database multidimensional analytical view integration | |
US20070282885A1 (en) | Method and System For Application Interaction | |
US9594548B2 (en) | Dynamically updating templated applications | |
US20070005622A1 (en) | Method and apparatus for lazy construction of XML documents | |
US20080250059A1 (en) | Hierarchical inherited xml dom | |
US20120331010A1 (en) | Systems And Methods For Performing A Query On A Distributed Database | |
JP2005346722A (en) | Method and apparatus for generating form using form type | |
US20080010082A1 (en) | System and method for business process management | |
US20100299300A1 (en) | Runtime interpretation of declarative programs | |
US20070240099A1 (en) | Flexible attribute management in workflow processing systems | |
US10042616B2 (en) | Process contributions in a method architecture | |
CN101714078A (en) | Code generation method and device | |
EP2602756A1 (en) | Parallel processing of semantically grouped data in data warehouse environments | |
US9092303B2 (en) | Dictionary-based dependency determination | |
CN113076091B (en) | View layer assembly replacing method and device | |
Opdahl et al. | A taxonomy for real-world modelling concepts | |
US20080189313A1 (en) | Method and apparatus for managing system specifications | |
US7831629B2 (en) | Method for building data encapsulation layers for highly variable schema | |
US20090315900A1 (en) | Generic surface manager | |
US8825588B2 (en) | Rule correlation to rules input attributes according to disparate distribution analysis | |
US8126841B2 (en) | Storage and retrieval of variable data | |
CN112051987B (en) | Service data processing method, device and equipment, program generating method and device | |
CN112084168B (en) | Label preservation method, device and server | |
CN110825992B (en) | System theme replacement method based on smart city operation platform |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |