CN106648569A - Target serialization achieving method and device - Google Patents

Target serialization achieving method and device Download PDF

Info

Publication number
CN106648569A
CN106648569A CN201510735570.XA CN201510735570A CN106648569A CN 106648569 A CN106648569 A CN 106648569A CN 201510735570 A CN201510735570 A CN 201510735570A CN 106648569 A CN106648569 A CN 106648569A
Authority
CN
China
Prior art keywords
target
serialized
class
database
serializing
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
Application number
CN201510735570.XA
Other languages
Chinese (zh)
Other versions
CN106648569B (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 CN201510735570.XA priority Critical patent/CN106648569B/en
Publication of CN106648569A publication Critical patent/CN106648569A/en
Application granted granted Critical
Publication of CN106648569B publication Critical patent/CN106648569B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a target serialization achieving method and device. The method comprises the following steps that a part to be serialized in a target is automatically acquired; the part to be serialized in the target is analyzed, and an analysis result is obtained and stored; the target is serialized according to the analysis result and converted into a packing serialization packer; the packing serialization packer is called, and the target is subjected to serialization reading and writing through a reflecting mechanism. According to the target serialization achieving method and device, the part to be serialized in the target is automatically acquired, analysis is carried out to obtain the analysis result, the target is serialized according to the analysis result and converted into the packing serialization packer, serialization reading and writing are carried out by calling the packing serialization packer and the reflecting mechanism, manual coding is not needed, and development efficiency is improved; manual copying and pasting are not needed, introduction defects are avoided, the engineering code quantity and the function quantity are reduced, and the space is reduced.

Description

Target sequence implementation method and device
Technical field
The present invention relates to computer application field, more particularly to a kind of target sequence implementation method and device.
Background technology
Object serialization technology is the technology that object data is converted to another kind of perdurable data form, conversion Data mode afterwards must be susceptible to be stored on external agency, or network easy to use is transmitted.In order to The object that data after storing and transmitting are become again again in internal memory, such conversion must be reversible 's.Target sequence technology introduces the abstract of object in the transmission and storing process of data so that this Individual process is more directly perceived, using convenient, therefore, target sequence technology is in OO software system Used in system widely.
Due to the popularity that target sequence technology is used, many computational languages all in speech level, by mark The mode in quasi- storehouse, there is provided the function support of target sequence, such as java language.In android system, The read-write of target sequence code all has been manually done, for example, often increase an object newly, passes through in database Need to write a serializing code manually, but big flow function and a large amount of codes repeat, and replicate viscous by manual Patch, its development efficiency is low, and manual duplication is pasted, and is readily incorporated defect.
The content of the invention
Based on this, it is necessary to paste code for replicating by hand during traditional target sequence, cause out Send out efficiency low and be readily incorporated the problem of defect, there is provided a kind of target sequence implementation method, it is possible to increase open Send out efficiency and avoid introducing defect.
Further it is provided that a kind of target sequence realizes device, it is possible to increase development efficiency and avoid introduce defect.
A kind of target sequence implementation method, comprises the following steps:
Automatically part to be serialized in target is obtained;
Parsing is carried out to part to be serialized in the target and obtains analysis result, and preserve the parsing knot Really;
The target is serialized according to the analysis result, is converted to packing serializing wrapper;
The packing serializing wrapper is called, serializing read-write is carried out to the target by reflex mechanism.
A kind of target sequence realizes device, including:
Acquisition module, for obtaining part to be serialized in target automatically;
Parsing module, for carrying out parsing to part to be serialized in the target analysis result is obtained, and Preserve the analysis result;
Modular converter, for serializing to the target according to the analysis result, is converted to packing sequence Rowization wrapper;
Calling module, for calling the packing serializing wrapper, is entered by reflex mechanism to the target Row serializing read-write.
Above-mentioned target sequence implementation method and device, by will automatically obtain part to be serialized in target, Carry out parsing and obtain analysis result, target is serialized according to analysis result, be converted to packing serializing Wrapper, carries out serializing read-write, it is not necessary to manually by calling packing serializing wrapper and reflex mechanism Coding, improves development efficiency, and be not required to replicate manually and paste, it is to avoid introducing defect, and is converted to and beats Packet sequence wrapper, reduces engineering size of code and function amount, reduces space.
Description of the drawings
Fig. 1 is the internal structure schematic diagram of terminal in one embodiment;
Fig. 2 is the internal structure schematic diagram of background server in one embodiment;
Fig. 3 is the flow chart of target sequence implementation method in one embodiment;
Fig. 4 is the flow chart that class serializes implementation method in one embodiment;
Fig. 5 is the flow chart of database sequence implementation method in one embodiment;
Fig. 6 is the structured flowchart that target sequence realizes device in one embodiment;
Fig. 7 is the structured flowchart that target sequence realizes device in another embodiment;
Fig. 8 is the structured flowchart that target sequence realizes device in another embodiment;
Fig. 9 is the structured flowchart that target sequence realizes device in another embodiment;
Figure 10 is the structured flowchart that target sequence realizes device in another embodiment.
Specific embodiment
In order that the objects, technical solutions and advantages of the present invention become more apparent, below in conjunction with accompanying drawing and reality Example is applied, the present invention will be described in further detail.It should be appreciated that specific embodiment described herein is only Only to explain the present invention, it is not intended to limit the present invention.
It is appreciated that term " first " used in the present invention, " second " etc. can be used to herein describe Various elements, but these elements should not be limited by these terms.These terms be only used for by first element with it is another One element is distinguished.For example, without departing from the scope of the invention, can be by the first client End is referred to as the second client, and similarly, the second client can be referred to as into the first client.First client With the second client both client, but it is not same client.
Fig. 1 is the internal structure schematic diagram of terminal in one embodiment.As shown in figure 1, the terminal includes passing through Processor, storage medium, internal memory, network interface, display screen, loudspeaker and input that system bus connects Device.Wherein, the storage medium of terminal is stored with operating system, also realizes filling including a kind of target sequenceization Put, the target sequence realizes device for realizing a kind of target sequence implementation method.The processor is used for There is provided and calculate and control ability, support the operation of whole terminal.The mesh in storage medium is saved as in terminal Mark serializing realizes that the operation of device provides environment, and network interface is used to carry out network service with server, such as Send data that request of data is returned to server, the reception server etc..Wherein, target may include class and/or Database.Class can be the class of serializing in need in java class.The display screen of terminal can be liquid crystal display Screen or electric ink display screen etc., input unit can be the touch layer that covers on display screen, or Button, trace ball or Trackpad, or external keyboard, Trackpad or the mouse arranged in terminal enclosure Mark etc..The terminal can be mobile phone, panel computer or personal digital assistant.Those skilled in the art can be with Understand, the structure illustrated in Fig. 1, only the block diagram of the part-structure related to application scheme, not structure The restriction of the terminal that application scheme is applied thereon in pairs, specific terminal can be included than shown in figure More or less of part, or some parts are combined, or arrange with different parts.
Fig. 2 is the internal structure schematic diagram of background server in one embodiment.As shown in Fig. 2 the backstage clothes Business device includes processor, storage medium, internal memory and the network interface connected by system bus.Wherein, should Be stored with operating system, database and target sequence of the storage medium of server realizes device, in database Be stored with target sequence data, the target sequence realize device for realize be applied to server one kind Target sequence implementation method.The processor of the server is used to provide calculating and control ability, supports whole The operation of server.The target sequence saved as in storage medium in the server realizes that the operation of device is carried For environment.The network interface of the server is used to communicate by network connection with outside terminal according to this, such as Receiving terminal send request of data and to terminal returned data etc..Server can be with independent server Or multiple server groups into server cluster realizing.It will be understood by those skilled in the art that in Fig. 2 The structure for illustrating, only the block diagram of the part-structure related to application scheme, is not constituted to the application The restriction of the server that scheme is applied thereon, specific server can include it is more more than shown in figure or Less part, or some parts are combined, or arrange with different parts.
Fig. 3 is the flow chart of target sequence implementation method in one embodiment.As shown in figure 3, a kind of mesh Mark serializing implementation method, comprises the following steps:
Step 302, obtains part to be serialized in target automatically.
Specifically, obtaining part to be serialized in target can obtain or add note by string matching mode Solution mark, inquires annotation tag acquisition, but not limited to this.
In one embodiment, step 302 includes:From target search with book character string match into Member, using the member for matching as part to be serialized.
Specifically, book character string can set as needed, such as %# ,s &%, * & etc., not limited to this.
If target includes class, the member matched with the first book character string is searched from class, will be matched Member as part to be serialized in class.
Wherein, the first book character string can set as needed, such as %# ,s &%, * & etc., not limited to this.
If target includes database, the member matched with the second book character string is searched from database, Using the member for matching as part to be serialized in class.
Wherein, the second book character string can set as needed, such as %# ,s &%, * & etc., not limited to this. And first book character string it is different from the second book character string.Needs can quickly be found by string matching The part of serializing, it is not necessary to extra to increase mark.
Step 304, parsing is carried out to part to be serialized in target and obtains analysis result, and preserves the parsing As a result.
Specifically, target may include in class and database one or two.If target includes class, parse As a result category information, mainly type information of class members etc. are included.If target includes database, parse As a result data table information etc. in database is included.Analysis result is stored in memory cache, for follow-up tune With using.
Step 306, serializes according to the analysis result to the target, is converted to packing serializing wrapper.
Specifically, target is converted to into ParcelWrapper classes, i.e. packing serializing wrapper, to automatic sequence The packaging of the part of rowization.The fundamental type that conversion is supported includes String (character string type), SmartParcel (automatic sequence type), Parcelable classes (android system type), ArrayList (tabular array classes Type), Map (data structure) etc..
Step 308, calls the packing serializing wrapper, and serializing reading is carried out to the target by reflex mechanism Write.
Specifically, ParcelWrapper is called, sequence is carried out to target by reflex mechanism according to analysis result Change read-write.Reflex mechanism is the ability that Java systems are provided.Reflex mechanism refers to Java in running status, For any one class, all properties and method of this class can be known, for any one object, Its any one method and attribute, the information and dynamic call object of this dynamic access can be called The function of method be referred to as the reflex mechanism of Java language.
Java reflex mechanisms mainly provide following functions:Operationally judge the class belonging to any one object; Operationally construct the object of any one class;Operationally judge the member variable that any one class has And method;The method for operationally calling any one object;Generate dynamic proxy.
Above-mentioned target sequence implementation method, by will automatically obtain part to be serialized in target, is carried out Parsing obtains analysis result, and target is serialized according to analysis result, is converted to packing serializing packaging Device, carries out serializing read-write, it is not necessary to hand-coding by calling packing serializing wrapper and reflex mechanism, Improve development efficiency, and be not required to replicate manually and paste, it is to avoid introducing defect, and be converted to packing sequence Change wrapper, reduce engineering size of code and function amount, reduce space.
In one embodiment, above-mentioned target sequence implementation method also includes:To waiting to serialize in the target Member addition annotation tag.Annotation tag can be predefined mark, for representing target in need sequence The member of rowization.When target has multiple, annotation tag that each target is adopted is different, each target and its Annotation tag correspondence.
Part to be serialized includes in the automatic acquisition target:Obtaining record in the target has annotation tag Part is used as part to be serialized in the target.By adding annotation tag, fast and easy finds correspondence Part to be serialized, and be not required to repeat write code and function, reduce data volume.
Fig. 4 is the flow chart that class serializes implementation method in one embodiment.As shown in figure 4, target is class, One species serializes implementation method, comprises the following steps:
Step 402, to member to be serialized in class the first annotation tag is added.
Specifically, the first annotation tag sets as needed, such as@NeedParcel or@n or #m, no It is limited to this.
For example, the code for adding after annotation tag in class is as follows:
It is above-mentioned to add the first annotation tag@NeedParcel in the member of class, demonstrate the need for serializing.
Step 404, obtaining record in such has the part of the first annotation tag as portion to be serialized in class Point.
Specifically, identify the part with the first annotation tag as part to be serialized in class.
Step 406, parsing is carried out to part to be serialized in class and obtains analysis result, and preserves the parsing knot Really.
Specifically, analysis result includes category information, mainly type information of class members etc..
Step 408, serializes according to the analysis result to class, is converted to packing serializing wrapper.
Specifically, class is converted to into ParcelWrapper classes, i.e. packing serializing wrapper, to automatic sequence The packaging of the part of change.The fundamental type that conversion is supported includes String (character string type), SmartParcel (automatic sequence type), Parcelable classes (android system type), ArrayList (tabular array classes Type), Map (data structure) etc..
SmartParcelable interfaces are the interface for being serialized class, it is not necessary to realize any function, pass through SmartParcelable interfaces can obtain the member for realizing serializing in class.
Step 410, calls the packing serializing wrapper, and serializing read-write is carried out to such by reflex mechanism.
Specifically, ParcelWrapper is called, sequence is carried out to target by reflex mechanism according to analysis result Change read-write.
Above-mentioned class serializes implementation method, by the way that member to be serialized in class is added into the first annotation tag, Part to be serialized in class is got according to the first annotation tag, parsing is carried out and is obtained analysis result, according to Analysis result is serialized to class, is converted to packing serializing wrapper, by calling packing serializing bag Dress device and reflex mechanism carry out serializing read-write, it is not necessary to hand-coding, improve development efficiency, and are not required to Replicate manually and paste, it is to avoid introducing defect, and be converted to packing serializing wrapper, reduce engineering generation Code amount and function amount, reduce space.
Fig. 5 is the flow chart of database sequence implementation method in one embodiment.As shown in figure 5, target For database, a kind of database sequence implementation method, comprise the following steps:
Step 502, to member to be serialized in database the second annotation tag is added.
Specifically, the second annotation tag sets as needed, such as@DbValue or@t or #p, is not limited to This.When target has multiple, the annotation tag that each target is adopted is different.
For example, in original DbcacheData interfaces, manually implemented following four function is needed:
*Interface that must be implemented and provided as a public CREATOR
*field that provides some static access of your cache data.
@Public
public static interface DbCreator<T extends DbCacheable>{
@public
public Structure[]structure();
@public
public String[]sortorder();
@public
public T createFromCursor(Cursor cursor);
@public
public int version();
}
It is as follows that mark@DbValue post codes are explained in addition second:
Class that help Auto write or read the Dbdata;
Version control of this data, define a static int field named VERSION_INT, like;
Private static final int VERSION_INT=8;// database version number
Sort order of this data, define a static String filed named ORDER_STR, like;
Simple example:
Public class AppInfo extends AutoDbData{
Private static final int VERSION_INT=8;// database version number
//@DbValue(true)means this Colum should be UNIQUE
//default is false;
@DbValue(true)
public int appid;
@DbValue(true)
public String appname;
@DbValue(true)
public String iconUrl;
@DbValue(true)
public String downloadUrl;
@DbValue(true)
public String summary;
@DbValue(true)
public int isRecommend;
@DbValue(true)
public String packageName;
@DbValue(true)
public String h5_url;// touch screen application address
@DbValue(true)
public String recommendComment;// recommend details
@DbValue(true)
public int maskAppType;
// local
Public int appType=AppType.OTHER_APPLICATION;
Public long installTime=0;
Public int cancelable=0;
Public AppInfo(){
}
Additionally, true can be also set to annotation tag, represent unique in tables of data.
Step 504, obtaining record in the database has the part of the second annotation tag as to be serialized in class Part.
Specifically, identify the part with the second annotation tag as part to be serialized in class.
Step 506, parsing is carried out to part to be serialized in database and obtains analysis result, and preserves the solution Analysis result.
Specifically, analysis result includes data table information etc. in database.
Step 508, serializes according to the analysis result to database, is converted to packing serializing wrapper.
Specifically, database is converted to into ParcelWrapper classes, i.e. packing serializing wrapper, to automatic The packaging of the part of serializing.Conversion support fundamental type include String (character string type), SmartParcel (automatic sequence type), Parcelable classes (android system type), ArrayList (tabular array type), Map (data structure) etc..
SmartParcelable interfaces are the interface for being serialized class, it is not necessary to realize any function, pass through SmartParcelable interfaces can obtain the member for realizing serializing in class.
Step 510, calls the packing serializing wrapper, and the database is serialized by reflex mechanism Read-write.
Specifically, ParcelWrapper is called, sequence is carried out to database by reflex mechanism according to analysis result Rowization are read and write.
Above-mentioned database sequence implementation method, by the way that member to be serialized in database is added into the second note Solution mark, according to the second annotation tag part to be serialized in database is got, and is carried out parsing and is solved Analysis result, serializes according to analysis result to database, is converted to packing serializing wrapper, passes through Call packing serializing wrapper and reflex mechanism to carry out serializing read-write, it is not necessary to hand-coding, improve Development efficiency, and be not required to replicate manually and paste, it is to avoid introducing defect, and be converted to packing serializing packaging Device, reduces engineering size of code and function amount, reduces space.
In one embodiment, in above-mentioned database sequence implementation method, also include:Deposit in database Tables of data version number is contained, and the quiescent value of the tables of data version number is set.
Specifically, static final int VERSION_INT=8 write in tables of data version number;Packet version is set Number quiescent value, when each version number updates, version number increases by 1 automatically.
Further, in above-mentioned database sequence implementation method, also include:The tables of data is ranked up, And the quiescent value of sortord is set.
Specifically, by writing " static final String ORDER_STR=Columns.FEED_PRIORITY +"DESC,"+Columns.PUBLISH_DATE+"DESC";" quiescent value, arrange sortord, It is ranked up according to sortord.By arranging quiescent value, it is not necessary to generating function, can be read by reflecting Get information.Tables of data is ranked up as needed automatically in database.
In other embodiments, above-mentioned target sequence implementation method can carry out sequence to class and database simultaneously Change, according to annotation tag, then member is added in member is added in class the first annotation tag and database Plus the second annotation tag it is different, to distinguish.
Above-mentioned target sequence implementation method is applied to be reduced about in instant communication application program space More than 200 class, reduces by more than 900 function.Without manual write sequence class again in exploitation, exploitation effect is improved Rate.Operational efficiency:Automated execution takes and is divided into two steps, class parsing (parse which field needs read-write, Field type etc.) and reading and writing data, class parsing is time-consuming more, and the result to parsing is cached, and only first Secondary using then parses one time.Time-consuming 2ms of the total read-write of general data class or so.Additionally, to read and write density compared with Greatly, or the more class of number of times, also support, using manually writing, to improve execution efficiency.Centre in class is right As object pool can be used, reduce scrappy object and occur.
Fig. 6 is the structured flowchart that target sequence realizes device in one embodiment.As shown in fig. 6, a kind of Target sequence realizes device, including acquisition module 610, parsing module 620, modular converter 630 and calls Module 640.Wherein:
Acquisition module 610 is used to obtain part to be serialized in target automatically.
Specifically, part to be serialized in the acquisition of acquisition module 610 target can be by string matching mode Annotation tag is obtained or added, annotation tag acquisition is inquired.
In one embodiment, acquisition module 610 is additionally operable to be searched and book character string phase from the target The member for matching somebody with somebody, the member that this is matched is used as part to be serialized.
Specifically, book character string can set as needed, such as %# ,s &%, * & etc., not limited to this.
If target include class, acquisition module 610 searches from class and the first book character string match into Member, using the member for matching as part to be serialized in class.
Wherein, the first book character string can set as needed, such as %# ,s &%, * & etc., not limited to this.
If target includes database, acquisition module 610 is searched and the second book character string phase from database The member of matching, using the member for matching as part to be serialized in class.
Wherein, the second book character string can set as needed, such as %# ,s &%, * & etc., not limited to this. And first book character string it is different from the second book character string.Needs can quickly be found by string matching The part of serializing, it is not necessary to extra to increase mark.
Parsing module 620 obtains analysis result for carrying out parsing to part to be serialized in the target, And preserve the analysis result.
Specifically, target may include in class and database one or two.If target includes class, parse As a result category information, mainly type information of class members etc. are included.If target includes database, parse As a result data table information etc. in database is included.Analysis result is stored in memory cache, for follow-up tune With using.
Modular converter 630 is used to serialize the class according to the analysis result, is converted to packing sequence Change wrapper.
Specifically, target is converted to into ParcelWrapper classes, i.e. packing serializing wrapper, to automatic sequence The packaging of the part of rowization.The fundamental type that conversion is supported includes String (character string type), SmartParcel (automatic sequence type), Parcelable classes (android system type), ArrayList (tabular array classes Type), Map (data structure) etc..
Calling module 640 is used to call the packing serializing wrapper, and the class is entered by reflex mechanism Row serializing read-write.
Specifically, ParcelWrapper is called, sequence is carried out to target by reflex mechanism according to analysis result Change read-write.Reflex mechanism is the ability that Java systems are provided.
Above-mentioned target sequence realizes device, by will automatically obtain part to be serialized in target, carries out Parsing obtains analysis result, and target is serialized according to analysis result, is converted to packing serializing packaging Device, carries out serializing read-write, it is not necessary to hand-coding by calling packing serializing wrapper and reflex mechanism, Improve development efficiency, and be not required to replicate manually and paste, it is to avoid introducing defect, and be converted to packing sequence Change wrapper, reduce engineering size of code and function amount, reduce space.
Fig. 7 is the structured flowchart that target sequence realizes device in another embodiment.As shown in fig. 7, one Plant target sequence and realize device, except including acquisition module 610, parsing module 620, modular converter 630 With calling module 640, also including labeling module 650.Wherein:
Labeling module 650 is used for member's addition annotation tag to be serialized in the target.
Annotation tag can be predefined mark, for representing target in need serialize member.Target When having multiple, the annotation tag that each target is adopted is different, and each target is corresponding with its annotation tag.
Acquisition module 610 is additionally operable to obtain record in the target has the part of annotation tag as treating in the target The part of serializing.By adding annotation tag, fast and easy finds corresponding part to be serialized, And be not required to repeat to write code and function, reduce data volume.
Fig. 8 is the structured flowchart that target sequence realizes device in another embodiment.As shown in figure 8, mesh Mark include class, a kind of target sequence realizes device, except include acquisition module 610, parsing module 620, Modular converter 630 and calling module 640, also including the first mark module 660.Wherein:
First mark module 660 is used to add the first annotation tag to member to be serialized in such.
Specifically, the first annotation tag sets as needed, such as@NeedParcel or@n or #m, no It is limited to this.
Acquisition module 610 be additionally operable to obtain such in record have the first annotation tag part treat as in such The part of serializing.
Parsing module 620 is additionally operable to carry out parsing to part to be serialized in class to obtain analysis result, and protects Deposit the analysis result.Specifically, analysis result includes category information, mainly type information of class members etc..
Modular converter 630 is additionally operable to serialize class according to the analysis result, is converted to packing serializing Wrapper.SmartParcelable interfaces are the interface for being serialized class, it is not necessary to realize any function, pass through SmartParcelable interfaces can obtain the member for realizing serializing in class.
Calling module 640 is additionally operable to call the packing serializing wrapper, and such is carried out by reflex mechanism Serializing read-write.
Specifically, ParcelWrapper is called, sequence is carried out to target by reflex mechanism according to analysis result Change read-write.
Device is realized in above-mentioned class serializing, by the way that member to be serialized in class is added into the first annotation tag, Part to be serialized in class is got according to the first annotation tag, parsing is carried out and is obtained analysis result, according to Analysis result is serialized to class, is converted to packing serializing wrapper, by calling packing serializing bag Dress device and reflex mechanism carry out serializing read-write, it is not necessary to hand-coding, improve development efficiency, and are not required to Replicate manually and paste, it is to avoid introducing defect, and be converted to packing serializing wrapper, reduce engineering generation Code amount and function amount, reduce space.
Fig. 9 is the structured flowchart that target sequence realizes device in another embodiment.As shown in figure 9, mesh Mark includes database, and a kind of target sequence realizes device, except including acquisition module 610, parsing module 620th, modular converter 630 and calling module 640, also including the second mark module 670.Wherein:
Second mark module 670 is used to add the second annotation tag to database members.
Specifically, the second annotation tag sets as needed, such as@DbValue or@t or #p, is not limited to This.When target has multiple, the annotation tag that each target is adopted is different.
Acquisition module 610 is additionally operable to obtain and the part for having the second annotation tag is recorded in the database as data Part to be serialized in storehouse.
Parsing module 620 is additionally operable to carry out parsing to part to be serialized in database to obtain analysis result, And preserve the analysis result.Specifically, analysis result includes data table information etc. in database.
Modular converter 630 is additionally operable to serialize database according to the analysis result, is converted to packing sequence Rowization wrapper.
Calling module 640 is additionally operable to call the packing serializing wrapper, by reflex mechanism to the database Carry out serializing read-write.
Specifically, ParcelWrapper is called, sequence is carried out to database by reflex mechanism according to analysis result Rowization are read and write.
Above-mentioned database sequence realizes device, by the way that member to be serialized in database is added into the second note Solution mark, according to the second annotation tag part to be serialized in database is got, and is carried out parsing and is solved Analysis result, serializes according to analysis result to database, is converted to packing serializing wrapper, passes through Call packing serializing wrapper and reflex mechanism to carry out serializing read-write, it is not necessary to hand-coding, improve Development efficiency, and be not required to replicate manually and paste, it is to avoid introducing defect, and be converted to packing serializing packaging Device, reduces engineering size of code and function amount, reduces space.
Figure 10 is the structured flowchart that target sequence realizes device in another embodiment.As shown in Figure 10, Target includes database, and a kind of target sequence realizes device, except including acquisition module 610, parsing module 620th, modular converter 630, calling module 640, the second mark module 670, also include the and of memory module 680 Order module 690.
Memory module 680 is used for the tables of data version number that is stored with the database, and arranges the tables of data The quiescent value of version number.
Specifically, static final int VERSION_INT=8 write in tables of data version number;Packet version is set Number quiescent value, when each version number updates, version number increases by 1 automatically.
Order module 690 is used to be ranked up the tables of data, and arranges the quiescent value of sortord.
By arranging quiescent value, it is not necessary to generating function, information can be read by reflection.
In other embodiments, above-mentioned target sequence realizes device, it may include acquisition module 610, parsing mould Block 620, modular converter 630, calling module 640, the first mark module 660, the second mark module 670, Any possible combination, will not be described here in memory module 680 and order module 690.
One of ordinary skill in the art will appreciate that all or part of flow process in above-described embodiment method is realized, Computer program be can be by instruct the hardware of correlation to complete, it is non-easy that described program can be stored in one In the property lost computer read/write memory medium, the program is upon execution, it may include such as the enforcement of above-mentioned each method The flow process of example.Wherein, described storage medium can be magnetic disc, CD, read-only memory (Read-Only Memory, ROM) etc..
Embodiment described above only expresses the several embodiments of the present invention, and its description is more concrete and detailed, But therefore can not be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for this area Those of ordinary skill for, without departing from the inventive concept of the premise, can also make it is some deformation and Improve, these belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be with appended Claim is defined.

Claims (12)

1. a kind of target sequence implementation method, comprises the following steps:
Automatically part to be serialized in target is obtained;
Parsing is carried out to part to be serialized in the target and obtains analysis result, and preserve the parsing knot Really;
The target is serialized according to the analysis result, is converted to packing serializing wrapper;
The packing serializing wrapper is called, serializing read-write is carried out to the target by reflex mechanism.
2. method according to claim 1, it is characterised in that treat sequence in the automatic acquisition target The step of part of change, includes:
The member matched with book character string is searched from the target, using the member for matching as Part to be serialized.
3. method according to claim 1, it is characterised in that methods described also includes:
To member's addition annotation tag to be serialized in the target;
Include the step of part to be serialized in the automatic acquisition target:
Obtaining record in the target has the part of annotation tag as part to be serialized in the target.
4. method according to claim 3, it is characterised in that the target includes class, methods described Also include:
First annotation tag is added to member to be serialized in the class;
Obtaining record in the class has the part of the first annotation tag as part to be serialized in the class.
5. the method according to claim 3 or 4, it is characterised in that the target includes database, Methods described also includes:
Second annotation tag is added to database members;
Include the step of part to be serialized in the automatic acquisition target:
Obtaining in the database record has the part of the second annotation tag as waiting to serialize in the database Part.
6. method according to claim 5, it is characterised in that methods described also includes:
The tables of data that is stored with the database version number, and the quiescent value of the tables of data version number is set;
The tables of data is ranked up, and the quiescent value of sortord is set.
7. a kind of target sequence realizes device, it is characterised in that include:
Acquisition module, for obtaining part to be serialized in target automatically;
Parsing module, for carrying out parsing to part to be serialized in the target analysis result is obtained, and Preserve the analysis result;
Modular converter, for serializing to the target according to the analysis result, is converted to packing sequence Rowization wrapper;
Calling module, for calling the packing serializing wrapper, is entered by reflex mechanism to the target Row serializing read-write.
8. device according to claim 7, it is characterised in that the acquisition module is additionally operable to from described The member matched with book character string is searched in target, using the member for matching as to be serialized Part.
9. device according to claim 7, it is characterised in that described device also includes:
Labeling module, for member's addition annotation tag to be serialized in the target;
The acquisition module is additionally operable to obtain and the part for having annotation tag is recorded in the target as the target In part to be serialized.
10. device according to claim 7, it is characterised in that the target includes class, the dress Putting also includes:
First mark module, for adding the first annotation tag to member to be serialized in the class;
The acquisition module is additionally operable to obtain and the part for having the first annotation tag is recorded in the class as the class In part to be serialized.
11. devices according to claim 9 or 10, it is characterised in that the target includes database, Described device also includes:
Second mark module, for adding the second annotation tag to database members;
The acquisition module is additionally operable to obtain and the part for having the second annotation tag is recorded in the database as institute State part to be serialized in database.
12. devices according to claim 11, it is characterised in that described device also includes:
Memory module, for the tables of data version number that is stored with the database, and arranges the tables of data The quiescent value of version number;
Order module, for being ranked up to the tables of data, and arranges the quiescent value of sortord.
CN201510735570.XA 2015-11-02 2015-11-02 Target serialization realization method and device Active CN106648569B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510735570.XA CN106648569B (en) 2015-11-02 2015-11-02 Target serialization realization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510735570.XA CN106648569B (en) 2015-11-02 2015-11-02 Target serialization realization method and device

Publications (2)

Publication Number Publication Date
CN106648569A true CN106648569A (en) 2017-05-10
CN106648569B CN106648569B (en) 2021-04-20

Family

ID=58809842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510735570.XA Active CN106648569B (en) 2015-11-02 2015-11-02 Target serialization realization method and device

Country Status (1)

Country Link
CN (1) CN106648569B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107450922A (en) * 2017-07-27 2017-12-08 武汉斗鱼网络科技有限公司 Method, storage medium, equipment and the system that barrage event is registered automatically in Android
CN108401008A (en) * 2018-01-12 2018-08-14 深圳壹账通智能科技有限公司 The method and system of equipment simultaneously operating
CN109857742A (en) * 2019-01-18 2019-06-07 烽火通信科技股份有限公司 A kind of big data virtual tables fast display method and system
CN111931200A (en) * 2020-07-13 2020-11-13 车智互联(北京)科技有限公司 Data serialization method, mobile terminal and readable storage medium
CN112130837A (en) * 2020-09-25 2020-12-25 腾讯科技(深圳)有限公司 Code processing method and device and storage medium
WO2023124425A1 (en) * 2021-12-30 2023-07-06 深圳市兆珑科技有限公司 Data processing method and apparatus, electronic device, and storage medium

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1296698A (en) * 1998-02-20 2001-05-23 汤姆森特许公司 System for forming, partitioning and processing program guides
CN1755721A (en) * 2004-10-01 2006-04-05 微软公司 Componentized and extensible workflow model
CN101082866A (en) * 2007-06-13 2007-12-05 北京北大方正电子有限公司 Serializing storage of objects and recovering system and method thereof
CN101807168A (en) * 2010-03-15 2010-08-18 北京航空航天大学 Testing environment of digital terminal for supporting edition compatibility and building method thereof
CN101826112A (en) * 2010-05-05 2010-09-08 山东中创软件工程股份有限公司 Method, device and system for storing and reading list data
CN102495757A (en) * 2011-11-15 2012-06-13 深圳市融创天下科技股份有限公司 Optimization method applicable to JAVA remote invocation object transfer and device
CN102523128A (en) * 2011-12-31 2012-06-27 浙江万朋网络技术有限公司 Data synchronism method in remote data transmission
CN102750186A (en) * 2011-04-19 2012-10-24 腾讯科技(深圳)有限公司 Method and system for realizing data transmission between processes
CN103488519A (en) * 2013-09-27 2014-01-01 上海野火网络科技有限公司 Implement method of interactive scripting language interpreter
CN103902698A (en) * 2014-03-31 2014-07-02 北京车商汇软件有限公司 Data storage system and data storage method
CN104360865A (en) * 2014-11-28 2015-02-18 中国建设银行股份有限公司 Serialization method, deserialization method and related equipment
CN104486396A (en) * 2014-12-10 2015-04-01 中国电信集团系统集成有限责任公司 Cross-platform network data transmission method
CN104731654A (en) * 2015-04-03 2015-06-24 南京大学 Migration reconstruction and support system for android applications
US20150227562A1 (en) * 2014-02-12 2015-08-13 Kabushiki Kaisha Toshiba Database device
CN104881461A (en) * 2015-05-22 2015-09-02 国云科技股份有限公司 Rapid data storage method
CN104883292A (en) * 2015-04-16 2015-09-02 江苏中威科技软件系统有限公司 Method and system for realizing message roaming at different terminals

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1296698A (en) * 1998-02-20 2001-05-23 汤姆森特许公司 System for forming, partitioning and processing program guides
CN1755721A (en) * 2004-10-01 2006-04-05 微软公司 Componentized and extensible workflow model
CN101082866A (en) * 2007-06-13 2007-12-05 北京北大方正电子有限公司 Serializing storage of objects and recovering system and method thereof
CN101807168A (en) * 2010-03-15 2010-08-18 北京航空航天大学 Testing environment of digital terminal for supporting edition compatibility and building method thereof
CN101826112A (en) * 2010-05-05 2010-09-08 山东中创软件工程股份有限公司 Method, device and system for storing and reading list data
CN102750186A (en) * 2011-04-19 2012-10-24 腾讯科技(深圳)有限公司 Method and system for realizing data transmission between processes
CN102495757A (en) * 2011-11-15 2012-06-13 深圳市融创天下科技股份有限公司 Optimization method applicable to JAVA remote invocation object transfer and device
CN102523128A (en) * 2011-12-31 2012-06-27 浙江万朋网络技术有限公司 Data synchronism method in remote data transmission
CN103488519A (en) * 2013-09-27 2014-01-01 上海野火网络科技有限公司 Implement method of interactive scripting language interpreter
US20150227562A1 (en) * 2014-02-12 2015-08-13 Kabushiki Kaisha Toshiba Database device
CN103902698A (en) * 2014-03-31 2014-07-02 北京车商汇软件有限公司 Data storage system and data storage method
CN104360865A (en) * 2014-11-28 2015-02-18 中国建设银行股份有限公司 Serialization method, deserialization method and related equipment
CN104486396A (en) * 2014-12-10 2015-04-01 中国电信集团系统集成有限责任公司 Cross-platform network data transmission method
CN104731654A (en) * 2015-04-03 2015-06-24 南京大学 Migration reconstruction and support system for android applications
CN104883292A (en) * 2015-04-16 2015-09-02 江苏中威科技软件系统有限公司 Method and system for realizing message roaming at different terminals
CN104881461A (en) * 2015-05-22 2015-09-02 国云科技股份有限公司 Rapid data storage method

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107450922A (en) * 2017-07-27 2017-12-08 武汉斗鱼网络科技有限公司 Method, storage medium, equipment and the system that barrage event is registered automatically in Android
WO2019019683A1 (en) * 2017-07-27 2019-01-31 武汉斗鱼网络科技有限公司 Method for automatically registering bullet screen event in android, storage medium, device and system
CN107450922B (en) * 2017-07-27 2020-01-03 武汉斗鱼网络科技有限公司 Method, storage medium, device and system for automatically registering popup events in android
CN108401008A (en) * 2018-01-12 2018-08-14 深圳壹账通智能科技有限公司 The method and system of equipment simultaneously operating
CN108401008B (en) * 2018-01-12 2021-05-07 深圳壹账通智能科技有限公司 Method and system for synchronous operation of equipment
CN109857742A (en) * 2019-01-18 2019-06-07 烽火通信科技股份有限公司 A kind of big data virtual tables fast display method and system
CN109857742B (en) * 2019-01-18 2021-03-02 烽火通信科技股份有限公司 Big data virtual table rapid display method and system
CN111931200A (en) * 2020-07-13 2020-11-13 车智互联(北京)科技有限公司 Data serialization method, mobile terminal and readable storage medium
CN111931200B (en) * 2020-07-13 2024-02-23 车智互联(北京)科技有限公司 Data serialization method, mobile terminal and readable storage medium
CN112130837A (en) * 2020-09-25 2020-12-25 腾讯科技(深圳)有限公司 Code processing method and device and storage medium
WO2023124425A1 (en) * 2021-12-30 2023-07-06 深圳市兆珑科技有限公司 Data processing method and apparatus, electronic device, and storage medium

Also Published As

Publication number Publication date
CN106648569B (en) 2021-04-20

Similar Documents

Publication Publication Date Title
CN106648569A (en) Target serialization achieving method and device
US9977770B2 (en) Conversion of a presentation to Darwin Information Typing Architecture (DITA)
CN104375808B (en) interface display method and device
CN104881275A (en) Electronic spreadsheet generating method and device
CN109558128A (en) Json data analysis method, device and computer readable storage medium
CN113126990B (en) Page development method, device, equipment and storage medium
CN107301137A (en) RSET interface realizing methods and device and electronic equipment and computer-readable recording medium
CN101965561A (en) Declarative support for asynchronous methods
CN109614088B (en) Form component generation method and device
CN111159040A (en) Test data generation method, device, equipment and storage medium
CN106502707B (en) Code generation method and device
CN109669678A (en) Template engine integration method, device, electronic equipment and storage medium
CN104461893A (en) Data processing method and data processing device
CN102184112B (en) Method and device for upgrading widget
CN115167941A (en) Front-end component processing method, device, terminal and storage medium
CN104361094A (en) Storage method and device for file in search result, and browser client
CN113626016A (en) Front-end and back-end separated reusable component based on Vue + Element UI + Koa2
CN104063229A (en) Digital family middleware system
CN116595284B (en) Webpage system operation method, device, equipment, storage medium and program
CN112930529B (en) Generating software artifacts from conceptual data models
CN112732254B (en) Webpage development method, webpage development device, computer equipment and storage medium
CN110175116B (en) Test date switching method, device and system
CN115981650A (en) Website building method and device, electronic equipment and storage medium
CN107562424A (en) A kind of Webpage display process, client and server
CN116720494A (en) Table generation method, system, electronic equipment and storage medium

Legal Events

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