CN105279032A - Method and apparatus for synchronizing interface message and javaBean - Google Patents
Method and apparatus for synchronizing interface message and javaBean Download PDFInfo
- Publication number
- CN105279032A CN105279032A CN201510822784.0A CN201510822784A CN105279032A CN 105279032 A CN105279032 A CN 105279032A CN 201510822784 A CN201510822784 A CN 201510822784A CN 105279032 A CN105279032 A CN 105279032A
- Authority
- CN
- China
- Prior art keywords
- javabean
- message
- file
- content
- message file
- 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
Abstract
The invention discloses a method and apparatus for synchronizing an interface message and javaBean. The method comprises the following steps: obtaining parameter information comprising the format and the path of a message file, and reading the content of the message file; according to the format of the message file, scheduling a corresponding parsing method to parse the content of the read message file; and through the parsed message content, by use of a method for recursive call of splicing character strings, generating corresponding javaBean content, and writing the javeBean content into a newly generated java file. According to the invention, the message and the javaBean are organically integrated and a javaBean file can be automatically generated rapidly after the message is updated, such that errors easily caused by negligence due to manual checking are reduced, the communication cost between design personnel and development personnel is decreased, and the utility value is quite high.
Description
Technical field
The present invention relates to field of computer technology, particularly relate to method and the device of a kind of sync cap message and javaBean.
Background technology
Along with the develop rapidly of computer technology and software engineering, large-scale and complicated software systems more and more become the needs of socio-economic development.This brings huge challenge with regard to the design difficulty for software systems, and due to the complexity of software systems and the raising of workload, will inevitably cause the refinement more that personnel divide the work, the communication cost brought thus also constantly increases.
In present software development process, often occur that client passes to the various demands of demand personnel, and between final software product, occur the phenomenon of various difference.Trace it to its cause, exactly because the demand of client creates distortion in the process of personnel's decomposition and transmission from level to level.The codes implement of the original description of demand personnel, the architecture design of system analyst, developer, the most frequently used means are exactly according to demand, first generate a exploitation document, are then kept consistency by this part of exploitation document; But in the performance history of reality, because demand change, external constraint, system constraint, individual understand deeply etc. reason, may accomplish that a document can not change from the beginning to the end hardly, therefore upgrade document, again issue, reexamine code and just become a job loaded down with trivial details again consuming time.
Summary of the invention
The object of this invention is to provide method and the device of a kind of sync cap message and javaBean, object is to solve artificial nucleus to consuming time longer and easily occur the problem of missing error.
For solving the problems of the technologies described above, the invention provides a kind of method of sync cap message and javaBean, comprising:
Obtain and comprise the form of message file and the parameter information in path, the content of described message file is read;
According to the form of described message file, call the content of corresponding analytic method to the described message file read in and resolve;
By the message content parsed, adopt the method for recursive call splicing character string, generate corresponding javaBean content, described javaBean content is written in newly-generated java file.
Alternatively, also comprise:
Be spliced into the character string of xml or json according to the attribute of javaBean, write in newly-generated xml or json file; By the instrument of increasing income, javaBean serializing is become the message of corresponding form.
Alternatively, the described form according to described message file, calls the content of corresponding analytic method to the described message file read in and carries out parsing and comprise:
According to the form of described message file, be the java object that can obtain by label by the Context resolution of described message file, and the reading/writing method of label and content is provided.
Alternatively, the described message content by parsing, adopts the method for recursive call splicing character string, generates corresponding javaBean content and comprises:
Analyze the structure of described message file, generate the character string of corresponding title, and write in java file.
Present invention also offers the device of a kind of sync cap message and javaBean, comprising:
Message read module, comprising the form of message file and the parameter information in path for obtaining, reading the content of described message file;
Packet parsing module, for the form according to described message file, calls the content of corresponding analytic method to the described message file read in and resolves;
JavaBean generation module, for the message content by parsing, adopting the method for recursive call splicing character string, generating corresponding javaBean content, described javaBean content be written in newly-generated java file.
Alternatively, also comprise:
Message generation module, for being spliced into the character string of xml or json according to the attribute of javaBean, writes in newly-generated xml or json file; By the instrument of increasing income, javaBean serializing is become the message of corresponding form.
Alternatively, described packet parsing module specifically for:
According to the form of described message file, be the java object that can obtain by label by the Context resolution of described message file, and the reading/writing method of label and content is provided.
Alternatively, described javaBean generation module specifically for:
Analyze the structure of described message file, generate the character string of corresponding title, and write in java file.
The method of sync cap message provided by the present invention and javaBean and device, comprising the form of message file and the parameter information in path by obtaining, reading the content of message file; According to the form of message file, call the content of corresponding analytic method to the message file read in and resolve; By the message content parsed, adopt the method for recursive call splicing character string, generate corresponding javaBean content, javaBean content is written in newly-generated java file.The method of sync cap message provided by the present invention and javaBean and device, message and javaBean organic unity are got up, make message upgrade after can fast automatic generation javaBean file, decrease artificial nucleus to the missing error easily occurred, save the communication cost between designer and developer, specifically very high practical value.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of a kind of embodiment of the method for sync cap message provided by the present invention and javaBean;
Fig. 2 is the process flow diagram of the another kind of embodiment of the method for sync cap message provided by the present invention and javaBean;
The structured flowchart of the device of the sync cap message that Fig. 3 provides for the embodiment of the present invention and javaBean.
Embodiment
In order to make those skilled in the art person understand the present invention program better, below in conjunction with the drawings and specific embodiments, the present invention is described in further detail.Obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
As shown in Figure 1, the method comprises the process flow diagram of a kind of embodiment of the method for sync cap message provided by the present invention and javaBean:
Step S101: obtain and comprise the form of message file and the parameter information in path, the content of described message file is read;
Particularly, first according to the parameter imported into, form and the path of message file can be judged, then adopt the content of the mode of stream to message file to read.The mode of certain reading is not limited to the mode adopting stream, and other modes, do not limit at this.
Such as, when reading message content in the file from a txt form, need to obtain two parameters, one is the url of this file, i.e. path parameter; One is the content format parameter of this file.
Step S102: according to the form of described message file, calls the content of corresponding analytic method to the described message file read in and resolves;
For java, there are many Open Frameworks available at present, as the technology such as Dom4j, JDom, SAX and Pull can be used for the message of resolving xml form, jsonLib, fastJson, jackson, Gson etc. can be used to the message of resolving json form, it is all the Context resolution of message is become the java object that can obtain by label, and provides the reading/writing method of label and content.
Step S103: by the message content parsed, adopts the method for recursive call splicing character string, generates corresponding javaBean content, described javaBean content be written in newly-generated java file.
For JavaBean, mainly comprise class declaration, attribute declaration, get method, set method, all have set form; And json and xml has corresponding method, the value of key and value can be obtained, therefore can write a universal method, according to message text string generation javaBean.
The method of sync cap message provided by the present invention and javaBean, comprising the form of message file and the parameter information in path by obtaining, reading the content of message file; According to the form of message file, call the content of corresponding analytic method to the message file read in and resolve; By the message content parsed, adopt the method for recursive call splicing character string, generate corresponding javaBean content, javaBean content is written in newly-generated java file.The method of sync cap message provided by the present invention and javaBean, message and javaBean organic unity are got up, make message upgrade after can fast automatic generation javaBean file, decrease artificial nucleus to the missing error easily occurred, save the communication cost between designer and developer, specifically very high practical value.
As shown in Figure 2, compared with a upper embodiment, add the process being generated message by javaBean in the present embodiment, the method comprises the process flow diagram of the another kind of embodiment of the method for sync cap message provided by the present invention and javaBean further:
Step S201: the character string being spliced into xml or json according to the attribute of javaBean, writes in newly-generated xml or json file;
Step S202: the message by the instrument of increasing income, javaBean serializing being become corresponding form.Such as JSONObject.fromObject (), xstream.toXML () etc.
The present embodiment adopts automated method to be converted into by the message sample in requirement developing stage can for the java object of application, also the javaBean of code staff development can be made to be converted into the message of designer's needs, thus reduce code development personnel and check interface document and according to time of document preparation javaBean, when being also reflected in code fast and accurately after document has change, greatly reduce the communication cost between the personnel of designing and developing and code development personnel, and the consistance of interface document and actual code can be kept easily.
It is pointed out that the method for sync cap message provided by the present invention and javaBean, can be an independently jar bag, import to during use in java engineering.Can be a lib storehouse in C engineering, different according to its form of expression of difference of programming language, this all affect realization of the present invention yet.
The sync cap message provided the embodiment of the present invention below and the device of javaBean are introduced, and device and the above-described sync cap message of sync cap message described below and javaBean can mutual corresponding references with the method for javaBean.The structured flowchart of the device of the sync cap message that Fig. 3 provides for the embodiment of the present invention and javaBean, the device with reference to Fig. 3 sync cap message and javaBean can comprise:
Message read module 100, comprising the form of message file and the parameter information in path for obtaining, reading the content of described message file;
Packet parsing module 200, for the form according to described message file, calls the content of corresponding analytic method to the described message file read in and resolves;
JavaBean generation module 300, for the message content by parsing, adopting the method for recursive call splicing character string, generating corresponding javaBean content, described javaBean content be written in newly-generated java file.
As a kind of embodiment, the device of sync cap message provided by the present invention and javaBean can further include:
Message generation module 400, for being spliced into the character string of xml or json according to the attribute of javaBean, writes in newly-generated xml or json file; By the instrument of increasing income, javaBean serializing is become the message of corresponding form.
As a kind of embodiment, in the device of sync cap message provided by the present invention and javaBean packet parsing module 200 specifically for:
According to the form of described message file, be the java object that can obtain by label by the Context resolution of described message file, and the reading/writing method of label and content is provided.
As a kind of embodiment, in the device of sync cap message provided by the present invention and javaBean above-mentioned javaBean generation module 300 specifically for:
Analyze the structure of described message file, generate the character string of corresponding title, and write in java file.
To sum up, the method of sync cap message provided by the present invention and javaBean and device, solve in traditional performance history, the field name inconsistence problems that the carelessness of code development personnel docking port document causes, and designer is for the field variation reaction problem not in time of developer, and the contrast document of machinery when can reduce code development staff development javaBean strikes the work of code, for improving development efficiency, unified program norm, keeping significant in the unitarity of development teams and design team.
In this instructions, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiment, between each embodiment same or similar part mutually see.
To the above-mentioned explanation of the disclosed embodiments, professional and technical personnel in the field are realized or uses the present invention.To be apparent for those skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein can without departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.
Claims (8)
1. a method of sync cap message and javaBean, is characterized in that, comprising:
Obtain and comprise the form of message file and the parameter information in path, the content of described message file is read;
According to the form of described message file, call the content of corresponding analytic method to the described message file read in and resolve;
By the message content parsed, adopt the method for recursive call splicing character string, generate corresponding javaBean content, described javaBean content is written in newly-generated java file.
2. the method for sync cap message as claimed in claim 1 and javaBean, is characterized in that, also comprise:
Be spliced into the character string of xml or json according to the attribute of javaBean, write in newly-generated xml or json file; By the instrument of increasing income, javaBean serializing is become the message of corresponding form.
3. the method for sync cap message as claimed in claim 1 or 2 and javaBean, is characterized in that, the described form according to described message file, calls the content of corresponding analytic method to the described message file read in and carries out parsing and comprise:
According to the form of described message file, be the java object that can obtain by label by the Context resolution of described message file, and the reading/writing method of label and content is provided.
4. the method for sync cap message as claimed in claim 3 and javaBean, is characterized in that, the described message content by parsing, and adopts the method for recursive call splicing character string, generates corresponding javaBean content and comprises:
Analyze the structure of described message file, generate the character string of corresponding title, and write in java file.
5. a device of sync cap message and javaBean, is characterized in that, comprising:
Message read module, comprising the form of message file and the parameter information in path for obtaining, reading the content of described message file;
Packet parsing module, for the form according to described message file, calls the content of corresponding analytic method to the described message file read in and resolves;
JavaBean generation module, for the message content by parsing, adopting the method for recursive call splicing character string, generating corresponding javaBean content, described javaBean content be written in newly-generated java file.
6. the device of sync cap message as claimed in claim 5 and javaBean, is characterized in that, also comprise:
Message generation module, for being spliced into the character string of xml or json according to the attribute of javaBean, writes in newly-generated xml or json file; By the instrument of increasing income, javaBean serializing is become the message of corresponding form.
7. the sync cap message as described in claim 5 or 6 and the device of javaBean, is characterized in that, described packet parsing module specifically for:
According to the form of described message file, be the java object that can obtain by label by the Context resolution of described message file, and the reading/writing method of label and content is provided.
8. the device of sync cap message as claimed in claim 7 and javaBean, is characterized in that, described javaBean generation module specifically for:
Analyze the structure of described message file, generate the character string of corresponding title, and write in java file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510822784.0A CN105279032B (en) | 2015-11-24 | 2015-11-24 | A kind of method and device of sync cap message and javaBean |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510822784.0A CN105279032B (en) | 2015-11-24 | 2015-11-24 | A kind of method and device of sync cap message and javaBean |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105279032A true CN105279032A (en) | 2016-01-27 |
CN105279032B CN105279032B (en) | 2019-06-28 |
Family
ID=55148082
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510822784.0A Active CN105279032B (en) | 2015-11-24 | 2015-11-24 | A kind of method and device of sync cap message and javaBean |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105279032B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110554857A (en) * | 2018-05-30 | 2019-12-10 | 马上消费金融股份有限公司 | JavaBean generation method, device and system and readable storage medium |
CN110806973A (en) * | 2019-10-11 | 2020-02-18 | 苏宁云计算有限公司 | Automatic generation method and device of interface message |
CN115589440A (en) * | 2022-12-12 | 2023-01-10 | 北京沐融信息科技股份有限公司 | Message annotation configuration method, packet packing method and parsing method |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009105954A1 (en) * | 2008-02-29 | 2009-09-03 | 成都市华为赛门铁克科技有限公司 | Method, apparatus and system for analyzing logs of devices in real-time |
CN102377506A (en) * | 2010-08-12 | 2012-03-14 | 盛科网络(苏州)有限公司 | Test message processing system |
CN102624894A (en) * | 2012-03-09 | 2012-08-01 | 北京神州数码思特奇信息技术股份有限公司 | Method and system for depacketize and message analysis |
CN103078765A (en) * | 2012-12-28 | 2013-05-01 | 华为技术有限公司 | Test method and device of network element equipment performance |
CN104657123A (en) * | 2013-11-21 | 2015-05-27 | 航天信息股份有限公司 | Method for dynamically exporting files |
CN105049281A (en) * | 2015-06-25 | 2015-11-11 | 浪潮(北京)电子信息产业有限公司 | Message parsing method and equipment |
-
2015
- 2015-11-24 CN CN201510822784.0A patent/CN105279032B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009105954A1 (en) * | 2008-02-29 | 2009-09-03 | 成都市华为赛门铁克科技有限公司 | Method, apparatus and system for analyzing logs of devices in real-time |
CN102377506A (en) * | 2010-08-12 | 2012-03-14 | 盛科网络(苏州)有限公司 | Test message processing system |
CN102624894A (en) * | 2012-03-09 | 2012-08-01 | 北京神州数码思特奇信息技术股份有限公司 | Method and system for depacketize and message analysis |
CN103078765A (en) * | 2012-12-28 | 2013-05-01 | 华为技术有限公司 | Test method and device of network element equipment performance |
CN104657123A (en) * | 2013-11-21 | 2015-05-27 | 航天信息股份有限公司 | Method for dynamically exporting files |
CN105049281A (en) * | 2015-06-25 | 2015-11-11 | 浪潮(北京)电子信息产业有限公司 | Message parsing method and equipment |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110554857A (en) * | 2018-05-30 | 2019-12-10 | 马上消费金融股份有限公司 | JavaBean generation method, device and system and readable storage medium |
CN110554857B (en) * | 2018-05-30 | 2021-06-22 | 马上消费金融股份有限公司 | JavaBean generation method, device and system and readable storage medium |
CN110806973A (en) * | 2019-10-11 | 2020-02-18 | 苏宁云计算有限公司 | Automatic generation method and device of interface message |
CN115589440A (en) * | 2022-12-12 | 2023-01-10 | 北京沐融信息科技股份有限公司 | Message annotation configuration method, packet packing method and parsing method |
Also Published As
Publication number | Publication date |
---|---|
CN105279032B (en) | 2019-06-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8789015B2 (en) | Integrated application localization | |
US8856732B2 (en) | System and method for creating, managing, and reusing schema type definitions in services oriented architecture services, grouped in the form of libraries | |
US9442744B2 (en) | Multilingual build integration for compiled applications | |
US8473916B2 (en) | Method and system for providing a testing framework | |
CN104410667B (en) | Conversion method and system of a kind of XML message to JSON messages | |
CN100483419C (en) | Data format verification method and device | |
US20140282379A1 (en) | Computer-implemented method, system and computer program product for displaying a user interface component | |
US9594802B2 (en) | Graphical modeling of database query statements | |
US20060048107A1 (en) | Enhanced compiled representation of transformation formats | |
US20100088676A1 (en) | Comparing and merging structured documents syntactically and semantically | |
US9817811B2 (en) | Web server system, dictionary system, dictionary call method, screen control display method, and demonstration application generation method | |
CN105279032A (en) | Method and apparatus for synchronizing interface message and javaBean | |
CN111125064B (en) | Method and device for generating database schema definition statement | |
US10691434B2 (en) | System and method for converting a first programming language application to a second programming language application | |
US8607201B2 (en) | Augmenting visualization of a call stack | |
CN106033338A (en) | Method and device for importing and analyzing source code based on FOG data | |
US20140359258A1 (en) | Declarative Configuration Elements | |
CN102053839A (en) | Monitoring probe generating method and device | |
CN114968192A (en) | Project creation method and device, computer equipment and storage medium | |
CN113138767A (en) | Code language conversion method, device, electronic equipment and storage medium | |
CN106610838B (en) | Conversion method of multiple scripting languages | |
CN117291399B (en) | Visual chemical card data processing method and system based on XML | |
CN116755684B (en) | OAS Schema generation method, device, equipment and medium | |
CN111279350B (en) | System and method for providing globalization features in service management application interfaces | |
CN116991418A (en) | Code generation method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |