CN105279032B - A kind of method and device of sync cap message and javaBean - Google Patents
A kind of method and device of sync cap message and javaBean Download PDFInfo
- Publication number
- CN105279032B CN105279032B CN201510822784.0A CN201510822784A CN105279032B CN 105279032 B CN105279032 B CN 105279032B CN 201510822784 A CN201510822784 A CN 201510822784A CN 105279032 B CN105279032 B CN 105279032B
- Authority
- CN
- China
- Prior art keywords
- message
- javabean
- file
- content
- format
- 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
Links
- 235000006719 Cassia obtusifolia Nutrition 0.000 title claims abstract description 82
- 235000014552 Cassia tora Nutrition 0.000 title claims abstract description 82
- 244000201986 Cassia tora Species 0.000 title claims abstract description 82
- 238000000034 method Methods 0.000 title claims abstract description 52
- 238000004458 analytical method Methods 0.000 claims abstract description 11
- 238000004891 communication Methods 0.000 abstract description 4
- 238000011161 development Methods 0.000 description 11
- 238000013461 design Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Abstract
The invention discloses the method and devices of a kind of sync cap message and javaBean, this method comprises: obtaining the parameter information in the format comprising message file and path, are read out to the content of the message file;According to the format of the message file, corresponding analytic method is called to parse the content of the message file of reading;Corresponding javaBean content is generated using the method for recursive call splicing character string by the message content parsed, the javaBean content is written in newly-generated java file.The present invention gets up message and javaBean organic unity, so that message being capable of fast automatic generation javaBean file after updating, reduce artificial nucleus to the missing error being easy to appear, saves the communication cost between designer and developer, specific very high practical value.
Description
Technical field
The present invention relates to field of computer technology, a kind of method more particularly to sync cap message and javaBean and
Device.
Background technique
With the rapid development of computer technology and software technology, large-scale and complicated software systems are increasingly becomed
The needs of socio-economic development.This is just that the design difficulty of software systems brings huge challenge, due to the complexity of software systems
With the raising of workload, the more refinement of personnel's division of labor is inevitably resulted in, thus bring is linked up cost and is also continuously increased.
In present software development process, often there are the various demands that client passes to demand personnel, and it is final
Occurs the phenomenon that various disagreements between software product.To find out its cause, be exactly because client demand personnel from level to level decompose and
Deformation is produced during transmitting.The original description of demand personnel, the architecture design of system analyst, developer code
It realizes, most common means are exactly according to demand, first to generate a exploitation document, then keep one by this part of exploitation document
Cause property;However in actual development process, since demand change, external constraint, system limitation, individual understand deep etc. original
Cause, as a consequence it is hardly possible to accomplish that a document can not change from the beginning to the end, therefore update document, issue, reexamine again
Code just becomes a time-consuming and cumbersome work.
Summary of the invention
The object of the present invention is to provide the method and devices of a kind of sync cap message and javaBean, it is therefore intended that solves
The problem of artificial nucleus are to taking a long time and being easy to appear missing error.
In order to solve the above technical problems, the present invention provides the method for a kind of sync cap message and javaBean, comprising:
The parameter information for obtaining the format comprising message file and path, is read out the content of the message file;
According to the format of the message file, call corresponding analytic method to the content of the message file of reading into
Row parsing;
Corresponding javaBean is generated using the method for recursive call splicing character string by the message content parsed
The javaBean content is written in newly-generated java file by content.
Optionally, further includes:
It is spliced into the character string of xml or json according to the attribute of javaBean, newly-generated xml or json file is written
In;JavaBean is serialized into the message for corresponding to format by the tool of open source.
Optionally, the format according to the message file, calls corresponding analytic method to the message of reading
The content of file carries out parsing
It is java pairs for being obtained by label by the Context resolution of the message file according to the format of the message file
As, and the reading/writing method of label and content is provided.
Optionally, the message content by parsing is generated and is corresponded to using the method for recursive call splicing character string
JavaBean content include:
The structure of the message file is analyzed, the character string of corresponding title is generated, and is written in java file.
The present invention also provides the devices of a kind of sync cap message and javaBean, comprising:
Message read module includes the format of message file and the parameter information in path for obtaining, to the message text
The content of part is read out;
Packet parsing module calls corresponding analytic method to the institute of reading for the format according to the message file
The content for stating message file is parsed;
JavaBean generation module, for the message content by parsing, using the side of recursive call splicing character string
Method generates corresponding javaBean content, the javaBean content is written in newly-generated java file.
Optionally, further includes:
Message generation module is spliced into the character string of xml or json for the attribute according to javaBean, is written newly-generated
Xml or json file in;JavaBean is serialized into the message for corresponding to format by the tool of open source.
Optionally, the packet parsing module is specifically used for:
It is java pairs for being obtained by label by the Context resolution of the message file according to the format of the message file
As, and the reading/writing method of label and content is provided.
Optionally, the javaBean generation module is specifically used for:
The structure of the message file is analyzed, the character string of corresponding title is generated, and is written in java file.
The method and device of sync cap message and javaBean provided by the present invention includes message file by obtaining
Format and path parameter information, the content of message file is read out;According to the format of message file, call corresponding
Analytic method parses the content of the message file of reading;By the message content parsed, spliced using recursive call
The method of character string generates corresponding javaBean content, javaBean content is written in newly-generated java file.This
The method and device of sync cap message and javaBean provided by inventing, message and javaBean organic unity are got up,
So that message update after can fast automatic generations javaBean file, reduce artificial nucleus to be easy to appear carelessness mistake
Accidentally, the communication cost between designer and developer has been saved, specific very high practical value.
Detailed description of the invention
Fig. 1 is a kind of stream of specific embodiment of sync cap message provided by the present invention and the method for javaBean
Cheng Tu;
Fig. 2 is another specific embodiment of sync cap message provided by the present invention and the method for javaBean
Flow chart;
Fig. 3 is the structural block diagram of sync cap message provided in an embodiment of the present invention and the device of javaBean.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description
The present invention is described in further detail.Obviously, described embodiments are only a part of the embodiments of the present invention, rather than
Whole embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not making creative work premise
Under every other embodiment obtained, shall fall within the protection scope of the present invention.
A kind of flow chart of specific embodiment of the method for sync cap message and javaBean provided by the present invention
As shown in Figure 1, this method comprises:
Step S101: the parameter information in the format comprising message file and path is obtained, to the content of the message file
It is read out;
Specifically, first according to incoming parameter, it can be determined that the format of message file and path, then using stream
Mode is read out the content of message file.Certainly the mode read is not limited to by the way of stream, other modes,
It is not limited here.
For example, needing to obtain two parameters, one is this when reading message content in the file from a txt format
The url of a file, i.e. path parameter;One be this file content format parameter.
Step S102: according to the format of the message file, call corresponding analytic method to the message text of reading
The content of part is parsed;
By taking java as an example, available there are many Open Framework at present, such as Dom4j, JDom, SAX and Pull technology can
For parsing the message of xml format, jsonLib, fastJson, jackson, Gson etc. can be used to parse the report of json format
Text is by the Context resolution of message into the java object that can be obtained by label, and provides the reading/writing method of label and content.
Step S103: it is generated corresponding by the message content parsed using the method for recursive call splicing character string
The javaBean content is written in newly-generated java file by javaBean content.
By taking JavaBean as an example, includes mainly class declaration, attribute declaration, get method, set method, be all to have fixed format
's;And json and xml have corresponding method, can obtain the value of key and value, therefore can write a universal method, root
According to one javaBean of a message text string generation.
The method of sync cap message and javaBean provided by the present invention, by obtaining the format comprising message file
With the parameter information in path, the content of message file is read out;According to the format of message file, corresponding parsing side is called
Method parses the content of the message file of reading;By the message content parsed, using recursive call splicing character string
Method, generate corresponding javaBean content, javaBean content be written in newly-generated java file.Institute of the present invention
The method of the sync cap message and javaBean of offer, message and javaBean organic unity are got up, so that message updates
Later can fast automatic generation javaBean file, reduce artificial nucleus to the missing error being easy to appear, saved design
Communication cost between personnel and developer, specific very high practical value.
The process of another specific embodiment of the method for sync cap message and javaBean provided by the present invention
Figure increases the process that message is generated by javaBean, the party as shown in Fig. 2, compared with a upper embodiment in the present embodiment
Method further comprises:
Step S201: being spliced into the character string of xml or json according to the attribute of javaBean, be written newly-generated xml or
In json file;
Step S202: javaBean is serialized into the message for corresponding to format by the tool of open source.Such as
JSONObject.fromObject (), xstream.toXML () etc..
The present embodiment is converted the message sample of demand development phase to using the method for automation for developing and using
Java object can also make the javaBean of code staff development be converted into the message of designer's needs, open to reduce code
Hair personnel checked interface document and according to the times of document preparation javaBean, can also be fast and accurately after document has altered
Reflect in code, greatly reduces the communication cost between the personnel of designing and developing and code development personnel, and the guarantor that can be convenient
Hold the consistency of interface document and actual code.
It should be pointed out that the method for sync cap message and javaBean provided by the present invention, can be one solely
Vertical jar packet, when use, imported into java engineering.It can be the library lib in C engineering, according to programming language
Its different form of expression are also different, this does not influence realization of the invention.
The device of sync cap message provided in an embodiment of the present invention and javaBean is introduced below, is described below
Sync cap message and the device of javaBean and the method for above-described sync cap message and javaBean can be mutual
To should refer to.Fig. 3 is the structural block diagram of sync cap message provided in an embodiment of the present invention and the device of javaBean, referring to figure
The device of 3 sync cap messages and javaBean may include:
Message read module 100 includes the format of message file and the parameter information in path for obtaining, to the message
The content of file is read out;
Packet parsing module 200 calls corresponding analytic method to reading for the format according to the message file
The content of the message file is parsed;
JavaBean generation module 300, for the message content by parsing, using recursive call splicing character string
Method generates corresponding javaBean content, the javaBean content is written in newly-generated java file.
As a kind of specific embodiment, the device of sync cap message and javaBean provided by the present invention can be with
Further comprise:
Message generation module 400, the character string of xml or json are spliced into for the attribute according to javaBean, and write-in is new
In xml the or json file of generation;JavaBean is serialized into the message for corresponding to format by the tool of open source.
As a kind of specific embodiment, message in the device of sync cap message and javaBean provided by the present invention
Parsing module 200 is specifically used for:
It is java pairs for being obtained by label by the Context resolution of the message file according to the format of the message file
As, and the reading/writing method of label and content is provided.
It is above-mentioned in the device of sync cap message and javaBean provided by the present invention as a kind of specific embodiment
JavaBean generation module 300 is specifically used for:
The structure of the message file is analyzed, the character string of corresponding title is generated, and is written in java file.
To sum up, the method and device of sync cap message and javaBean provided by the present invention, solves traditional exploitation
In the process, field name inconsistence problems caused by carelessness of the code development personnel to interface document and designer for
The problem of field of developer changes reaction not in time, and it is mechanical when can reduce code development staff development javaBean
Control document strikes the labour of code, for improving development efficiency, unified program norm, the system for keeping development teams and design team
It is significant in one property.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with it is other
The difference of embodiment, same or similar part may refer to each other between each embodiment.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention.
Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest scope of cause.
Claims (6)
1. a kind of method of sync cap message and javaBean characterized by comprising
The parameter information for obtaining the format comprising message file and path, is read out the content of the message file;
According to the format of the message file, corresponding analytic method is called to solve the content of the message file of reading
Analysis;
Corresponding javaBean content is generated using the method for recursive call splicing character string by the message content parsed,
The javaBean content is written in newly-generated java file;
Further include:
It is spliced into the character string of xml or json according to the attribute of javaBean, is written in newly-generated xml or json file;It is logical
Cross message of the tool of open source by javaBean serializing at corresponding format.
2. the method for sync cap message and javaBean as described in claim 1, which is characterized in that described according to the report
The format of file, call corresponding analytic method to the content of the message file of reading carry out parsing include:
It is the java object that can be obtained by label by the Context resolution of the message file according to the format of the message file,
And provide the reading/writing method of label and content.
3. the method for sync cap message and javaBean as claimed in claim 2, which is characterized in that described by parsing
Message content, using the method for recursive call splicing character string, generating corresponding javaBean content includes:
The structure of the message file is analyzed, the character string of corresponding title is generated, and is written in java file.
4. a kind of device of sync cap message and javaBean characterized by comprising
Message read module includes the format of message file and the parameter information in path for obtaining, to the message file
Content is read out;
Packet parsing module calls corresponding analytic method to the report of reading for the format according to the message file
The content of file is parsed;
JavaBean generation module, it is raw using the method for recursive call splicing character string for the message content by parsing
At corresponding javaBean content, the javaBean content is written in newly-generated java file;
Further include:
Message generation module is spliced into the character string of xml or json for the attribute according to javaBean, is written newly-generated
In xml or json file;JavaBean is serialized into the message for corresponding to format by the tool of open source.
5. the device of sync cap message and javaBean as claimed in claim 4, which is characterized in that the packet parsing mould
Block is specifically used for:
It is the java object that can be obtained by label by the Context resolution of the message file according to the format of the message file,
And provide the reading/writing method of label and content.
6. the device of sync cap message and javaBean as claimed in claim 5, which is characterized in that the javaBean is raw
It is specifically used at module:
The structure of the message file is analyzed, the character string of corresponding title is generated, and is written 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 CN105279032A (en) | 2016-01-27 |
CN105279032B true 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) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
CN115589440B (en) * | 2022-12-12 | 2023-03-21 | 北京沐融信息科技股份有限公司 | Message annotation configuration method, packet packing method and parsing method |
Citations (5)
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 |
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 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102624894B (en) * | 2012-03-09 | 2014-10-22 | 北京思特奇信息技术股份有限公司 | Method and system for depacketize and message analysis |
-
2015
- 2015-11-24 CN CN201510822784.0A patent/CN105279032B/en active Active
Patent Citations (5)
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 |
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 |
Also Published As
Publication number | Publication date |
---|---|
CN105279032A (en) | 2016-01-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9594802B2 (en) | Graphical modeling of database query statements | |
CN110324169B (en) | Interface management method and device | |
CN108121542B (en) | MyBatis-based SQL statement configuration method and system | |
AU2014201573A1 (en) | Improved data integration tool | |
JP2020187733A (en) | Application programming interface documentation annotation | |
US8756407B2 (en) | Configuration rule prototyping tool | |
CN109522018A (en) | Page processing method, device and storage medium | |
CN111125064B (en) | Method and device for generating database schema definition statement | |
CN103268226A (en) | Test script file generation method and device | |
CN105279032B (en) | A kind of method and device of sync cap message and javaBean | |
US9367432B2 (en) | Testing system | |
CN109408247A (en) | Interaction data processing method and device | |
JP2007122135A (en) | Development support device, development support method and development support program | |
CN114036425A (en) | Page access method, client, server and system | |
CN111460241B (en) | Data query method and device, electronic equipment and storage medium | |
KR102226463B1 (en) | UI/UX solution providing server linked with process automation program, process automation method using the same, and computer program executing the same | |
CN104598570A (en) | Resource fetching method and device | |
CN113641700A (en) | Data processing method and device based on Spring boot frame | |
CN113434175A (en) | Data processing method, device, storage medium and equipment | |
CN109284488A (en) | Based on the method, apparatus and medium that modification front end table column data is locally stored | |
CN110019315A (en) | A kind of method and apparatus for the parsing of data blood relationship | |
US9038004B2 (en) | Automated integrated circuit design documentation | |
US20070092069A1 (en) | Method and system for testing enterprise applications | |
CN105786529B (en) | One type Managed Code calls the Parameters design of the labyrinth of C/C++ style function | |
CN111190587A (en) | Method and system for automatically generating engineering front-end code based on JDBC |
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 |