CN107451237A - Serializing and unserializing method, apparatus and equipment - Google Patents

Serializing and unserializing method, apparatus and equipment Download PDF

Info

Publication number
CN107451237A
CN107451237A CN201710619098.2A CN201710619098A CN107451237A CN 107451237 A CN107451237 A CN 107451237A CN 201710619098 A CN201710619098 A CN 201710619098A CN 107451237 A CN107451237 A CN 107451237A
Authority
CN
China
Prior art keywords
attribute
sequence number
parent
subclass
serialized
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
CN201710619098.2A
Other languages
Chinese (zh)
Other versions
CN107451237B (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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201710619098.2A priority Critical patent/CN107451237B/en
Publication of CN107451237A publication Critical patent/CN107451237A/en
Application granted granted Critical
Publication of CN107451237B publication Critical patent/CN107451237B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24568Data stream processing; Continuous queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This specification, which provides a kind of serializing and unserializing method, apparatus and equipment, this method, to be included:Metadata tag is configured for parent in advance, the metadata tag is used for the quantity for being designated as the reserved attribute sequence number of parent.During serializing, subclass corresponding to data object to be serialized first is obtained, the attribute based on the quantity and the attribute of data object indicated by the metadata tag of parent in subclass ranks, and determines the attribute sequence number of attribute;Also, read property value corresponding to attribute in data object;Then, the attribute sequence number and property value of the attribute are serialized, obtains serialized data.

Description

Serializing and unserializing method, apparatus and equipment
Technical field
This specification is related to field of computer technology, more particularly to serializing and unserializing method, apparatus and equipment.
Background technology
Serializing (serialization) and unserializing (deserialization) are the conventional skills of computer realm Art.Serialize for by the data message of object be converted into keeping form or can transformat serialized data, such as sequence Rowization data can be binary data stream, so as to the operation such as be preserved or transmitted to serialized data.Antitone sequence The inverse process of serializing is turned to, for serialized data to be converted to the data message of object.For the son of inheritance be present When the object of class is serialized, if the subclass for determining to use required for analysis protocol at serializing end and unserializing end Afterwards, the situation of parent extended attribute occurs, such as parent subsequently increases attribute, then subclass attribute coding sequence number can be caused to change. The class at both ends must be upgraded simultaneously by now serializing end and unserializing end, otherwise cause unserializing abnormal.
Given this, it is desirable to provide a kind of scheme for supporting parent extended attribute.
The content of the invention
To overcome problem present in correlation technique, present description provides serializing with unserializing method, apparatus and Equipment.
A kind of sequencing method, configures metadata tag to parent in advance, and the metadata tag is described for being designated as The quantity of the reserved attribute sequence number of parent, methods described include:
Subclass corresponding to data object to be serialized is obtained, the subclass is inherited in the parent;
The attribute of quantity and the data object indicated by metadata tag based on the parent is in the subclass In attribute ranking, determine the attribute sequence number of the attribute;
Read property value corresponding to attribute described in the data object;
The attribute sequence number and property value of the attribute are serialized, obtain serialized data.
Optionally, the attribute of the quantity indicated by the metadata tag based on the parent and the data object Attribute ranking in the subclass, the attribute sequence number of the attribute is determined, including:
The sequence number that attribute ranking of the attribute based on the data object in the subclass is obtained, with the parent Quantity indicated by metadata tag is added, and obtains the attribute sequence number of the attribute.
Optionally, it is described to be serialized the attribute sequence number and property value of the attribute, obtain serialized data, bag Include:
Key information using the attribute SEQ.XFER of the attribute as key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write into the data object by the order of the attribute sequence number Result data stream, serialized data of the result data stream as the data object.
Optionally, methods described also includes:
When the attribute sequence number and property value of the attribute are serialized, the attribute type of the attribute is also subjected to sequence Rowization.
Optionally, methods described also includes:
When the attribute sequence number and property value of the attribute are serialized, the length value of the property value is also subjected to sequence Rowization.
A kind of unserializing method, configures metadata tag to parent in advance, and the metadata tag is used to be designated as institute The quantity of the reserved attribute sequence number of parent is stated, methods described includes:
Obtain serialized data;
Subclass corresponding to the serialized data is obtained, the subclass is inherited in the parent;
The attribute ranking of attribute in quantity and the subclass indicated by metadata tag based on the parent, it is determined that The attribute sequence number of the attribute, obtain the mapping relations of the attribute and the attribute sequence number;
The serialized data is parsed, the attribute sequence number and attribute obtained according to the mapping relations and parsing It is worth and assignment is carried out to the attribute of data object to be reconstructed.
Optionally, in the quantity indicated by the metadata tag based on the parent and the subclass attribute category Property ranking, determine the attribute sequence number of the attribute, obtain the mapping relations of the attribute and the attribute sequence number, including:
The sequence number that attribute ranking based on attribute in the subclass is obtained, indicated by the metadata tag of the parent Quantity be added, obtain the attribute sequence number of the attribute.
One kind serializing device, configures metadata tag to parent in advance, and the metadata tag is described for being designated as The quantity of the reserved attribute sequence number of parent, described device include:
Class obtains module, and for obtaining subclass corresponding to data object to be serialized, the subclass is inherited in the father Class;
Sequence number determining module, for the quantity indicated by the metadata tag based on the parent and the data object Attribute ranking of the attribute in the subclass, determine the attribute sequence number of the attribute;
It is worth read module, for reading property value corresponding to attribute described in the data object;
Serialization module, for the attribute sequence number and property value of the attribute to be serialized, obtain serialized data.
Optionally, the sequence number determining module, is specifically used for:
The sequence number that attribute ranking of the attribute based on the data object in the subclass is obtained, with the parent Quantity indicated by metadata tag is added, and obtains the attribute sequence number of the attribute.
Optionally, the serialization module, is specifically used for:
Key information using the attribute SEQ.XFER of the attribute as key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write into the data object by the order of the attribute sequence number Result data stream, serialized data of the result data stream as the data object.
Optionally, the serialization module is additionally operable to:
When the attribute sequence number and property value of the attribute are serialized, the attribute type of the attribute is also subjected to sequence Rowization.
Optionally, the serialization module is additionally operable to:
When the attribute sequence number and property value of the attribute are serialized, the length value of the property value is also subjected to sequence Rowization.
A kind of unserializing device, configures metadata tag to parent in advance, and the metadata tag is used to be designated as institute The quantity of the reserved attribute sequence number of parent is stated, described device includes:
Data acquisition module, for obtaining serialized data;
Class obtains module, and for obtaining subclass corresponding to the serialized data, the subclass is inherited in the parent;
Relation obtains module, for belonging in the quantity indicated by the metadata tag based on the parent and the subclass Property attribute ranking, determine the attribute sequence number of the attribute, obtain the mapping relations of the attribute and the attribute sequence number;
Unserializing module, for the serialized data to be parsed, obtained according to the mapping relations and parsing The attribute sequence number and property value obtained carries out assignment to the attribute of data object to be reconstructed.
Optionally, the relation obtains module, is specifically used for:
The sequence number that attribute ranking based on attribute in the subclass is obtained, indicated by the metadata tag of the parent Quantity be added, obtain the attribute sequence number of the attribute.
A kind of computer equipment, including:
Processor;
For storing the memory of processor-executable instruction;
Wherein, metadata tag is configured to parent in advance, the metadata tag is used to be designated as what the parent was reserved The quantity of attribute sequence number, the processor are configured as:
Subclass corresponding to data object to be serialized is obtained, the subclass is inherited in the parent;
The attribute of quantity and the data object indicated by metadata tag based on the parent is in the subclass In attribute ranking, determine the attribute sequence number of the attribute;
Read property value corresponding to attribute described in the data object;
The attribute sequence number and property value of the attribute are serialized, obtain serialized data.
A kind of computer equipment, including:
Processor;
For storing the memory of processor-executable instruction;
Wherein, metadata tag is configured to parent in advance, the metadata tag is used to be designated as what the parent was reserved The quantity of attribute sequence number, the processor are configured as:
Obtain serialized data;
Subclass corresponding to the serialized data is obtained, the subclass is inherited in the parent;
The attribute ranking of attribute in quantity and the subclass indicated by metadata tag based on the parent, it is determined that The attribute sequence number of the attribute, obtain the mapping relations of the attribute and the attribute sequence number;
The serialized data is parsed, the attribute sequence number and attribute obtained according to the mapping relations and parsing It is worth and assignment is carried out to the attribute of data object to be reconstructed.
The technical scheme that the embodiment of this specification provides can include the following benefits:
Using this specification embodiment, metadata tag is configured for parent in advance, the metadata tag is used to be designated as father The quantity of the reserved attribute sequence number of class, and due to when the attribute to subclass carries out automatic numbering, the metadata mark based on parent Attribute ranking of the attribute of the indicated quantity of label and data object in subclass obtains the attribute sequence number of the attribute, realizes After parent is extended attribute, the attribute sequence number of attribute in subclass will not be caused to change because of parent extended attribute, therefore, even if Serializing end and unserializing end do not upgrade the class at both ends simultaneously, will not changing due to attribute sequence number during unserializing Become and cause unserializing abnormal, realize compatible.
It should be appreciated that the general description and following detailed description of the above are only exemplary and explanatory, not This specification can be limited.
Brief description of the drawings
Accompanying drawing herein is merged in specification and forms the part of this specification, shows the reality for meeting this specification Apply example, and be used for together with specification the principle for explaining this specification.
Fig. 1 is a kind of serializing and unserializing application scenario diagram of this specification according to an exemplary embodiment.
Fig. 2A is a kind of flow chart of sequencing method of this specification according to an exemplary embodiment.
Fig. 2 B are a kind of signal that to class student is encoded of this specification according to an exemplary embodiment Figure.
Fig. 3 is a kind of flow chart of unserializing method of this specification according to an exemplary embodiment.
Fig. 4 is a kind of hardware structure diagram of computer equipment where this specification serializing device or unserializing device.
Fig. 5 is a kind of block diagram of serializing device of this specification according to an exemplary embodiment.
Fig. 6 is a kind of block diagram of unserializing device of this specification according to an exemplary embodiment.
Embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment Described in embodiment do not represent all embodiments consistent with this specification.On the contrary, they are only and such as institute The example of the consistent apparatus and method of some aspects be described in detail in attached claims, this specification.
It is only merely for the purpose of description specific embodiment in the term that this specification uses, and is not intended to be limiting this explanation Book." one kind " of used singulative, " described " and "the" are also intended to bag in this specification and in the appended claims Most forms are included, unless context clearly shows that other implications.It is also understood that term "and/or" used herein is Refer to and any or all may be combined comprising the associated list items purpose of one or more.
It will be appreciated that though various information may be described using term first, second, third, etc. in this specification, but These information should not necessarily be limited by these terms.These terms are only used for same type of information being distinguished from each other out.For example, do not taking off In the case of this specification scope, the first information can also be referred to as the second information, and similarly, the second information can also be claimed For the first information.Depending on linguistic context, word as used in this " if " can be construed to " ... when " or " when ... " or " in response to determining ".
The technical scheme of this specification be can apply under distributed system environment, and data transfer is carried out between system or is deposited Storage, service end and client network communication etc. can also be applied to.As shown in figure 1, Fig. 1 is this specification according to an exemplary reality Apply a kind of serializing exemplified and unserializing application scenario diagram.In this example, to serialize end as service end, with inverted sequence Rowization end is that user terminal is illustrated.Service end can be serialized the data object for needing to transmit, and obtain sequence Change data, and serialized data is transmitted to user terminal, user terminal serialized data is subjected to unserializing operation, rebuild Data object.Cited application scenarios are certainly not limited to, in existing system or application program, as long as sequence can be performed Rowization and unserializing method, the method that this specification can be used to provide, and obtain corresponding beneficial effect.
Before the specific steps of the present embodiment are described in detail, the sequencing method and inverted sequence that are first related to the technical program Row method is briefly described.
Object serialization technology, it is the technology that object data is converted into another perdurable data form, i.e., by object Status information be converted to the technology of the form that can be stored or transmit.During serializing, object writes its current state To interim or persistent storage area, it is right can be re-created by the state of reading or unserializing object from memory block for this As.In order that the data after must storing and transmitting can become the object in internal memory again again, such conversion can be reversible. Sequencing method and unserializing method are widely used in inter-network data transmission and application, it usually needs change information Into data flow, data transfer and application are realized.In the object to inheriting in the subclass of parent carries out serialization process, Ke Yidi Return each attribute of traversal subclass object, and an attribute sequence number is distributed automatically for attribute, by the attribute sequence number and attribute of attribute Value is serialized, and obtains serialized data.But in data transfer and storage, for pair of the subclass of inheritance be present During as being serialized, if at serializing end to parent extended attribute, if performing the side of unserializing not by subclass Attribute synchronize, then subclass attribute coding sequence number can be caused to change, the problem of causing unserializing to fail.Increase, reduce Or the attribute in modification object, when the file after original serializing or data are carried out into unserializing, mistake or sequence can be produced Change failure.Here it is the compatibling problem of object serialization.All fields of usual object can be all serialized, it means that data Serialized data can be represented as.Similarly, unserializing extracts data, and directly setting pair from the representation of serializing As state.
It should be noted that data object is the entity such as people, thing, object present in objective world in computer logic Mapping.For example, when object is books, its attribute includes books numbering, author, publishing house and remarks etc., by the book After nationality is serialized, binary data stream corresponding with the books can be generated, the binary data stream has and books The corresponding property value of attribute, so as to represent the entities such as people, thing, object present in objective world by computer language.Number Can be the entities such as people present in arbitrary objective world, thing, object according to object, for example, data object can be user, i.e., User.Object includes at least one attribute, and the title of attribute is properly termed as Property Name, and value corresponding to attribute is properly termed as attribute Value, the type of attribute are properly termed as attribute type.For example, attribute type can be int (integer, integer type), Boolean (Boolean type), long (long), double (double-precision floating point type), float (single-precision floating point type), short (short) and string (character string type) etc..
Class can be by the bag for the cohesion that certain specific metadata is formed, and it describes the behavior rule of some objects Then, and these objects are thus referred to as such example.For example, User is the class of an expression user, user is a User class Object, i.e. User classes a example, user have attribute:UserId, attribute userId property value are 0001, Ke Yitong Cross serializing and user property value 0001 is converted into serialized data.Parent can be inherited in the class for exist inheritance Class, subclass can be the class inherited in the class for exist inheritance, and subclass is to inherit the class in parent in other words.
Next, this specification provides a kind of serializing with compatibility, unserializing scheme, configured in advance for parent Metadata tag, the metadata tag are used for the quantity for being designated as the reserved attribute sequence number of parent, can expanded so as to the attribute of parent It is charged to the quantity number, and due to when the attribute to subclass carries out automatic numbering, based on indicated by the metadata tag of parent Quantity and data object attribute in subclass attribute ranking obtain the attribute attribute sequence number, realize parent carry out After extended attribute, the attribute sequence number of attribute in subclass will not be caused to change because of parent extended attribute, therefore, even if serializing end Do not upgrade the class at both ends simultaneously with unserializing end, will not be caused during unserializing due to the change of attribute sequence number Unserializing is abnormal, realizes compatible.
As shown in Figure 2 A, Fig. 2A is a kind of flow of sequencing method of this specification according to an exemplary embodiment Figure, configures metadata tag to parent in advance, and the metadata tag is used to be designated as the reserved attribute sequence number of the parent Quantity, methods described may comprise steps of 201 to step 204:
In step 201, subclass corresponding to data object to be serialized is obtained, the subclass is inherited in the parent.
In step 202, the category of quantity indicated by metadata tag and the data object based on the parent Property attribute ranking in the subclass, determine the attribute sequence number of the attribute.
In step 203, property value corresponding to attribute described in the data object is read.
In step 204, the attribute sequence number and property value of the attribute are serialized, obtains serialized data.
In the present embodiment, in order to be embodied as attribute automatic numbering, can match somebody with somebody in advance at serializing end and unserializing end Put the class corresponding to data object.For example, analysis protocol can be exposed to unserializing end by serializing end, can be by data pair As corresponding class is with class bags transmission to unserializing end.Illustrated below with a specific class.
class User{
private int userId;
private string name;
private int age;
}
class student extend User{
private string address;
private char sex;
}
In this example embodiment, class student is inherited in class User, therefore, in this inheritance, can be referred to as class User Parent, class student is referred to as subclass.Parent (class User) includes attribute:UserId, name and age.Subclass can inherit father Attribute in class, this generic attribute can be referred to as to inherited attribute, subclass can be used for oneself exclusive attribute, such as Address and sex, this generic attribute can be referred to as to subclass attribute.
In actual applications, can be according to inheritance by parent to subclass when the object to subclass serializes Generic attribute is traveled through one by one, and is each attribute distributive property sequence number according to position (ranking) of the attribute in class.For example, in order For attribute userId, name, age, address and sex, Allotment Serial Number is 1,2,3,4,5 respectively.However, attribute may in parent Additions and deletions be present, for example, increasing attribute phone number in parent, then the mapping of inherited attribute and attribute sequence number is closed System is respectively:Corresponding 3, the phone number corresponding 4 of corresponding 2, the age of corresponding 1, the name of userId, subclass attribute and attribute sequence number Mapping relations be respectively:Corresponding 5, the sex corresponding 6 of address.It can be seen that due to adding attribute in parent, although parent Central Plains Attribute sequence number is not changed corresponding to some attributes, but attribute sequence number is changed corresponding to attribute in subclass.If inverted sequence Rowization end not in time by class be updated to serializing end in class it is consistent, then exception occurs in unserializing.
In consideration of it, the present embodiment configures metadata tag to parent in advance, the metadata tag is described for being designated as The quantity of the reserved attribute sequence number of parent, that is, represent that the attribute of parent extends to the quantity number, equivalent to having reserved parent The quantity that attribute can reach, therefore the quantity can be referred to as to reserved number of attributes again.In consideration of it, quantity can be based on parent The number for the attribute that may expand determines, for example, quantity to be arranged to the higher limit for the attribute number that parent can possess.When So, quantity can also be greater than the arbitrary value of the higher limit, and subclass attribute number is not interfered with to reach parent increase attribute Purpose.
The method for configuring metadata tag for parent has many kinds, such as can be matched somebody with somebody by way of TAG labels for parent Put metadata tag.Below by taking Java as an example, major key@tagSlot (value) can be increased before parent, wherein value is reserved Number of attributes.The specific example of above-mentioned class is still continued to use below, and parent configuration metadata tag is illustrated.
@tagSlot(10)
class User{
public int userId;
public string name;
private int age;
}
class student extend User{
private string address;
private char sex;
}
In this example embodiment, the quantity for being the reserved attribute sequence number of parent is 10, i.e., the attribute that parent can at most possess Number is 10.
In serialization process is carried out, subclass corresponding to data object to be serialized can be obtained.At this serializing end Different subclasses can be stored, same subclass can correspond to one or more data objects.Because data object is the example of subclass, Therefore, obtaining after the data object serialized, subclass can obtained according to data object.Meanwhile can be with data object Possess each attribute in subclass, and there can be corresponding property value for different attribute.For example, userId property value is 1, Name property value is aaa, and sex property value is female etc..Wherein, subclass is for foregoing parent, and the subclass is inherited In the parent.
The attribute in parent can be inherited due to subclass, therefore generic is traveled through one by one to subclass by parent according to inheritance Property and distributive property sequence number during, can be according to the attribute of data object in parent when traversing the attribute in parent Attribute ranks and ranking and the transformational relation of sequence number, determines the attribute sequence number of attribute.Because parent includes multiple attributes, then The attribute that the attribute can be obtained by the ranking order of attribute ranks.For example, the ranking for being arranged in the attribute of first place can be 1, Second attribute is arranged in, attribute arrangement can be 2 etc..On rank with the transformational relation of sequence number, in one example, can be with Directly attribute is ranked as attribute sequence number.In other examples, other transformational relations can also be used to rank attribute and changed For attribute sequence number.Appoint attribute ranking and the transformational relation of attribute sequence number in advance at serializing end and unserializing end, so as to Attribute and the mapping relations of attribute sequence number are obtained according to class.For example, attribute and the mapping relations of attribute sequence number are respectively:userId Corresponding corresponding 2, the age corresponding 3 of 1, name.
When traversing the attribute in subclass, quantity that can be indicated by the metadata tag based on the parent and described Attribute ranking of the attribute of data object in the subclass, determine the attribute sequence number of the attribute.
In this embodiment, when attribute in subclass being numbered, the attribute of last attribute in parent is eliminated the reliance on Sequence number, but ranked the quantity as the attribute of last attribute, attribute in subclass is numbered, obtains the attribute Attribute sequence number;Or using the quantity as attribute sequence number of first attribute of the subclass etc..In order to distinguish in subclass not With the attribute sequence number of attribute, not only to consider that (quantity is the quantity for the attribute sequence number reserved for the parent to the quantity, can be with Referred to as reserved number of attributes), it is also desirable to consider position (attribute ranking) of the attribute in subclass.
In an optional implementation, attribute that can be by the attribute based on the data object in the subclass The sequence number obtained is ranked, is added with the quantity indicated by the metadata tag of the parent, obtains the attribute sequence number of the attribute.
In this embodiment it is possible to the sequence that attribute ranking of the attribute based on the data object in the subclass obtains Number.Attribute rank with the transformational relation of sequence number, can with for attribute ranking and the transformational relation of sequence number during attribute number in parent It is identical.For example, directly attribute is ranked as sequence number.In order to avoid causing the attribute of attribute in subclass due to parent extended attribute Sequence number changes, can be by indicated by the sequence number of acquisition and metadata tag it is determined that during the attribute sequence number of attribute in subclass Quantity be added, obtain the attribute sequence number of attribute.For example, subclass attribute and the mapping relations of attribute sequence number can be respectively: Corresponding 11, the sex corresponding 12 of address.
It can be seen that the present embodiment is based on attribute of the attribute of data object in subclass by will rank the sequence number obtained, with Quantity indicated by the metadata tag of parent is added, and obtains the attribute sequence number of attribute, the attribute sequence number no longer in by parent most The attribute sequence number of latter bit attribute influences, and therefore, avoids because parent extended attribute causes the attribute sequence number of attribute in subclass to be sent out It is raw to change, the class needed for parsing although antitone sequence end does not upgrade in time, antitone sequence is carried out to serialized data using original class During change, attribute and the mapping relations of attribute sequence number will not change in subclass, still can normally be parsed.
In serialization process is carried out, property value corresponding to attribute in data object can also be read, for example, address Property value be xxxx, sex property value is female etc..Then the attribute sequence number and property value of the attribute are serialized, Obtain serialized data.
It should be noted that the serialized data can be binary data stream, but it is not limited to binary data stream.
It is described to be serialized the attribute sequence number and property value of the attribute as one of which serializing means, obtain Serialized data is obtained, can be included:
Key information using the attribute SEQ.XFER of the attribute as key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write into the data object by the order of the attribute sequence number Result data stream, serialized data of the result data stream as the data object.
Wherein, key-value pair includes key information (Key) and value information (Value) with corresponding relation.The present embodiment can be with By the attribute SEQ.XFER of attribute, and the information obtained encoding is as the key information of key-value pair;Can be by the property value of attribute Encode, and value information of the information as key-value pair of acquisition will be encoded, and key-value pair is write to the result data stream of data object In, such as binary stream can be exported into.Obtained because attribute of the attribute sequence number based on attribute ranks, therefore in write-in data pair During the result data stream of elephant, the key-value pair being made up of key information and value information can be write into data pair by the order of attribute sequence number The result data stream of elephant.
As shown in Figure 2 B, Fig. 2 B are that this specification is a kind of to class student progress according to an exemplary embodiment The schematic diagram of coding.Class student is class User subclass.Attribute userId attribute sequence number can be 1 in parent User, can So that the attribute SEQ.XFER is encoded as Value corresponding to Key_1 as Key_1, and using attribute userId property value, its His parent attribute is similarly.Attribute address attribute sequence number can be 11 in subclass student, can compile the attribute sequence number Code is used as Key_11, and attribute address property value is encoded as Value corresponding to Key_11.Belong in subclass student Property sex attribute sequence number can be 12, can be using the attribute SEQ.XFER as Key_12, and by attribute sex property value volume Code is used as Value corresponding to Key_12.
It can be seen that storing attribute sequence number and the relation of property value by way of key-value pair, follow-up unserializing can be improved Efficiency.Also, the key information only using attribute SEQ.XFER as key-value pair, content metadata in serialized data is reduced, is carried Height serializing compression ratio, and then preserving information or data transfer time save space and flow.
In one example, because serializing end and unserializing end are stored with needed for serializing and unserializing respectively Category information, therefore, during unserializing, when determining the mapping relations of attribute and attribute sequence number, it may be determined that the category of attribute Property type, and based on the attribute type of attribute to value information carry out unserializing, obtain corresponding property value.Wherein, Attribute class Type includes but is not limited to int, long, double, float, short and string etc..
, can be by described in order to quickly determine the attribute type of attribute during unserializing in another example When the attribute sequence number and property value of attribute are serialized, also the attribute type of the attribute is serialized.
For example, determining the attribute type of attribute based on the subclass, the process for obtaining serialized data, can wrap Include:
Key information using attribute sequence number and the attribute type coding of the attribute as key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write into the data object by the order of the attribute sequence number Result data stream, serialized data of the result data stream as the data object.
It can be seen that attribute type is encoded in key information by the embodiment simultaneously, it can improve and determine during unserializing The efficiency of attribute type.
Further, in order to reduce content metadata in serialized data, serializing compression ratio is improved, it is determined that attribute After attribute type, the mark of attribute type can be obtained.Wherein, for different attribute type, different marks can be pre-defined Know, for unique mark attribute type, and memory space shared by mark is less than memory space shared by attribute type.For example, mark It can be label., can be by the attribute sequence number of attribute and the identification code of attribute type after the mark of attribute type is obtained Key information as key-value pair.For encoded attributes type, code identification can improve serializing compression ratio.
In practical application, for some attribute types, the byte length of property value can be determined based on attribute type, it is this kind of Attribute type is properly termed as fixed length attribute type.For example, attribute type float byte length is 4 bytes, attribute type Double byte length is 8 bytes.But some attribute types are directed to, the byte of property value can not be determined based on attribute type Length, if for example, the attribute type of property value is string, the length of property value can not be determined.In consideration of it, for convenience During unserializing can fast resolving go out corresponding property value, in serialization process, by the attribute sequence number of the attribute and When property value is serialized, also the length value of the property value is serialized.
It can be seen that when the attribute sequence number and property value of attribute are serialized, the length value of property value can also be entered Row serializing, so that fast resolving goes out corresponding property value during unserializing.
For example, using the length value of the attribute sequence number of the attribute and property value coding as the key information of key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write into the data object by the order of the attribute sequence number Result data stream, serialized data of the result data stream as the data object.
The length value of property value is encoded in key information by the embodiment simultaneously, can be improved and be parsed during unserializing The efficiency of property value.
Above-described embodiment can be combined, for example, can be simultaneously by the attribute sequence number of attribute, attribute type, property value Length value and property value serialized, obtain serialized data.
Cause to reduce serializing compression ratio in order to avoid content metadata is more in serialized data, can also be to Attribute class Type is judged.(it be can determine that if the attribute type of attribute is the type for the length value that can determine that property value based on attribute type The length value of property value), then attribute sequence number, attribute type and the property value of the attribute are serialized, serialized Data.If the attribute type of attribute is the type for the length value that not can determine that property value (not can determine that category based on attribute type The length value of property value), then the attribute sequence number of the attribute, attribute type, the length value of property value and property value can be carried out Serializing, obtain serialized data.
It can be seen that by judging attribute type, to determine whether that the length value by property value is serialized, so as to Improve serializing compression ratio.
In the above-described embodiment, there is provided a kind of sequencing method, in addition, this specification also provides a kind of unserializing Method, the embodiment of the unserializing method are as follows:
As shown in figure 3, Fig. 3 is a kind of flow of unserializing method of this specification according to an exemplary embodiment Figure, configures metadata tag to parent in advance, and the metadata tag is used to be designated as the reserved attribute sequence number of the parent Quantity, methods described may comprise steps of 301 to step 304:
In step 301, serialized data is obtained.
In the present embodiment, the acquisition serialized data, can include:Serialized data is obtained by network transmission, Or serialized data from local acquisition compression etc..
It should be noted that the serialized data can be binary data stream, but it is not limited to binary data stream.
In step 302, subclass corresponding to the serialized data is obtained, the subclass is inherited in the parent.
After getting serialized data at unserializing end, it is known that solving the serialized data using which class is counter. In one example, API (Application Programming Interface, application programming interface) can be passed through Arrange the class (including but is not limited to parent, subclass etc.) corresponding to every kind of interface in advance.Pass through calling interface at unserializing end Mode obtain the serialized data, and because each interface corresponds to corresponding class, then can determine to obtain by the interface Serialized data corresponding to class.
, can be by class corresponding to serialized data after obtaining serialized data at serializing end in another example Identification information writes the head of serialized data, so that unserializing end is believed from the mark of the head of serialized data acquisition class Breath, so that it is determined that the class needed for anti-solution sequence data.
For example, identified using the tagged mode of prefix in binary data stream needed for the anti-solution of the binary data stream Class.
It should be noted that subclass corresponding to serialized data can also be obtained by other means, herein no longer one by one Repeat.
In step 303, attribute in the quantity indicated by metadata tag and the subclass based on the parent Attribute ranks, and determines the attribute sequence number of the attribute, obtains the mapping relations of the attribute and the attribute sequence number.
In the present embodiment, due to the subclass corresponding to serialized data it has been determined that can then automatically determine attribute and attribute The corresponding relation of sequence number.
The present embodiment configures metadata tag to parent in advance, and the metadata tag is reserved for being designated as the parent Attribute sequence number quantity, that is, represent that the attribute of parent extends to the quantity number, can be with equivalent to parent attribute has been reserved The quantity reached, therefore the quantity can be referred to as to reserved number of attributes again.It may expand in consideration of it, quantity can be based on parent Attribute number determine, for example, quantity to be arranged to the higher limit for the attribute number that parent can possess.
The attribute in parent can be inherited due to subclass, therefore generic is traveled through one by one to subclass by parent according to inheritance Property and distributive property sequence number during, when traversing the attribute in parent, can according in parent attribute attribute rank, it is determined that The attribute sequence number of attribute.Because parent includes multiple attributes, each attribute has the ranking of oneself, then suitable by the ranking of attribute Sequence can obtain the attribute ranking of the attribute.For example, the ranking for being arranged in the attribute of first place can be 1, second category is arranged in Property, attribute arrangement can be 2 etc..In one example, directly attribute can be ranked as attribute sequence number.In other examples In, other conversion regimes can also be used to be based on attribute coordination conversion and obtain attribute sequence number.At serializing end and unserializing end Attribute ranking and the transformational relation of attribute sequence number are appointed in advance, and then attribute and the mapping of attribute sequence number can be obtained according to class Relation.For example, the mapping relations of inherited attribute and attribute sequence number are respectively:Corresponding 2, the age corresponding 3 of corresponding 1, the name of userId. It is determined that after the attribute sequence number of attribute, the mapping relations of attribute and attribute sequence number can be obtained.It can be seen that attribute sequence number is the equal of to use In the identification information of identity property.
When traversing the attribute in subclass, quantity that can be indicated by the metadata tag based on the parent and described The attribute ranking of attribute, determines the attribute sequence number of the attribute, obtains the mapping of the attribute and the attribute sequence number in subclass Relation.
In this embodiment, when attribute in subclass being numbered, the attribute of last attribute in parent is eliminated the reliance on Sequence number, and can be ranked using the quantity as the attribute of last attribute, attribute in subclass is numbered, obtains the category The attribute sequence number of property;Or using the quantity as attribute sequence number of first attribute of the subclass etc..In order to distinguish in subclass The attribute sequence number of different attribute, not only to consider the quantity (reserved number of attributes), it is also desirable to consider attribute in subclass Position (attribute ranking).
In an optional implementation, the attribute based on attribute in the subclass is ranked to the sequence number obtained, with institute State the quantity indicated by the metadata tag of parent to be added, obtain the attribute sequence number of the attribute.
In this embodiment it is possible to the attribute ranking based on attribute in subclass obtains sequence number.Attribute ranks turn with sequence number Change relation, can with parent during attribute number attribute ranking it is identical with the transformational relation of sequence number.For example, directly attribute is arranged Position is used as sequence number.In order to avoid causing the attribute sequence number of attribute in subclass to change due to parent extended attribute, it is determined that son In class during the attribute sequence number of attribute, the sequence number of acquisition can be added with the quantity indicated by metadata tag, obtain attribute Attribute sequence number.For example, subclass attribute and the mapping relations of attribute sequence number can be respectively:Corresponding 11, the sex corresponding 12 of address.
It can be seen that the present embodiment by the attribute based on attribute in subclass by ranking the sequence number obtained, the metadata with parent Quantity indicated by label is added, and obtains the attribute sequence number of attribute, the attribute sequence number last bit attribute no longer in by parent Attribute sequence number influences, and therefore, avoids because parent extended attribute causes the attribute sequence number of attribute in subclass to change, although instead End sequence does not upgrade in time class needed for parsing, belongs to when carrying out unserializing to serialized data using original class, in subclass The mapping relations of property and attribute sequence number will not change, and still can normally be parsed.
In step 304, the serialized data is parsed, the category obtained according to the mapping relations and parsing Property sequence number and property value assignment is carried out to the attribute of data object to be reconstructed.
After mapping relations of the attribute with attribute sequence number are obtained, serialized data can be parsed (anti-solution), and profit The wiring method corresponding to attribute, the property value read is write in the attribute of data object to be reconstructed according to mapping relations.
In one example, because serializing end and unserializing end are stored with needed for serializing and unserializing respectively Category information, therefore, during unserializing, when determining the mapping relations of attribute and attribute sequence number, it may be determined that the category of attribute Property type, and based on the attribute type of attribute to value information carry out unserializing, obtain corresponding property value.Wherein, Attribute class Type includes but is not limited to int, long, double, float, short and string etc..
In another example, if serialized data includes attribute type, for example, in serializing by the category of attribute Property sequence number and attribute type encode key information as key-value pair, the property value of attribute is encoded into the value information as key-value pair. Therefore, unserializing can be carried out to value information using the attribute type read, obtained corresponding during unserializing Property value.
Further, if serialized data includes being used for the mark for indicating attribute type, for example, will in serializing The key information of the attribute sequence number of attribute and the identification code of attribute type as key-value pair, the property value of attribute is encoded as key The value information of value pair.Therefore, attribute type can be determined according to mark, utilize the Attribute class of determination during unserializing Type carries out unserializing to value information, obtains corresponding property value.
, can be in unserializing mistake if serialized data includes the length value of property value in another example Cheng Zhong, the length value of the property value obtained according to parsing, it is determined that the required length for reading information, so as to parse acquisition property value.
As seen from the above-described embodiment, metadata tag is configured for parent in advance, the metadata tag is used to be designated as parent The quantity of reserved attribute sequence number, to indicate that the attribute of parent extends to the quantity number, and due in the attribute to subclass When carrying out automatic numbering, the attribute ranking based on attribute in the quantity and subclass indicated by the metadata tag of parent is somebody's turn to do The attribute sequence number of attribute, and then the mapping relations of attribute and attribute sequence number are determined, avoid because parent extended attribute causes subclass The attribute sequence number of middle attribute changes, the class needed for parsing although antitone sequence end does not upgrade in time, using original class to sequence When rowization data carry out unserializing, attribute and the mapping relations of attribute sequence number will not change in subclass, can still carry out Normal parsing.
Various technical characteristics in embodiment of above can be arbitrarily combined, as long as the combination between feature is not present Conflict or contradiction, but as space is limited, do not described one by one, therefore the various technical characteristics in above-mentioned embodiment is any It is combined the scope for falling within this disclosure.
Corresponding with the embodiment of foregoing sequencesization and unserializing method, this specification additionally provides serializing and inverted sequence The embodiment for the electronic equipment that row makeup is put and its applied.
This specification serializes device or the embodiment of unserializing device and can applied in computer equipment.Device is implemented Example can be realized by software, can also be realized by way of hardware or software and hardware combining.Exemplified by implemented in software, as Device on one logical meaning, it is by corresponding meter in nonvolatile memory by the processor of computer equipment where it Calculation machine programmed instruction reads what operation in internal memory was formed.For hardware view, as shown in figure 4, Fig. 4 is this specification sequence Makeup is put or a kind of hardware structure diagram of unserializing device place computer equipment, except processor 410, the net shown in Fig. 4 Outside network interface 420, internal memory 430 and nonvolatile memory 440, the computer equipment in embodiment where device 431 leads to Often according to the actual functional capability of the equipment, other hardware can also be included, this is repeated no more.
As shown in figure 5, Fig. 5 is a kind of block diagram of serializing device of this specification according to an exemplary embodiment, Metadata tag is configured to parent in advance, the metadata tag is used for the number for being designated as the reserved attribute sequence number of the parent Amount, described device include:
Class obtains module 52, and for obtaining subclass corresponding to data object to be serialized, the subclass is inherited in described Parent.
Sequence number determining module 54, for the quantity indicated by the metadata tag based on the parent and the data pair Attribute ranking of the attribute of elephant in the subclass, determine the attribute sequence number of the attribute.
It is worth read module 56, for reading property value corresponding to attribute described in the data object.
Serialization module 58, for the attribute sequence number and property value of the attribute to be serialized, obtain serializing number According to.
Optionally, the sequence number determining module 54, is specifically used for:
The sequence number that attribute ranking of the attribute based on the data object in the subclass is obtained, with the parent Quantity indicated by metadata tag is added, and obtains the attribute sequence number of the attribute.
Optionally, the serialization module 58, is specifically used for:
Key information using the attribute SEQ.XFER of the attribute as key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write into the data object by the order of the attribute sequence number Result data stream, serialized data of the result data stream as the data object.
Optionally, the serialization module 58 is additionally operable to:
When the attribute sequence number and property value of the attribute are serialized, the attribute type of the attribute is also subjected to sequence Rowization.
Optionally, the serialization module 58 is additionally operable to:
When the attribute sequence number and property value of the attribute are serialized, the length value of the property value is also subjected to sequence Rowization.
As shown in fig. 6, Fig. 6 is a kind of frame of unserializing device of this specification according to an exemplary embodiment Figure, configures metadata tag to parent in advance, and the metadata tag is used to be designated as the reserved attribute sequence number of the parent Quantity, described device include:
Data acquisition module 62, for obtaining serialized data.
Class obtains module 64, and for obtaining subclass corresponding to the serialized data, the subclass is inherited in the parent.
Relation obtains module 66, in the quantity indicated by the metadata tag based on the parent and the subclass The attribute ranking of attribute, the attribute sequence number of the attribute is determined, obtain the mapping relations of the attribute and the attribute sequence number.
Unserializing module 68, for the serialized data to be parsed, according to the mapping relations and parsing The attribute sequence number and property value of acquisition carry out assignment to the attribute of data object to be reconstructed.
Optionally, the relation obtains module 66, is specifically used for:
The sequence number that attribute ranking based on attribute in the subclass is obtained, indicated by the metadata tag of the parent Quantity be added, obtain the attribute sequence number of the attribute.
For device embodiment, because it corresponds essentially to embodiment of the method, so related part is real referring to method Apply the part explanation of example.Device embodiment described above is only schematical, wherein described be used as separating component The module of explanation can be or may not be physically separate, can be as the part that module is shown or can also It is not physical module, you can with positioned at a place, or can also be distributed on multiple mixed-media network modules mixed-medias.Can be according to reality Need to select some or all of module therein to realize the purpose of this specification scheme.Those of ordinary skill in the art are not In the case of paying creative work, you can to understand and implement.
Accordingly, this specification embodiment also provides a kind of computer equipment, including:Processor;For storing processor The memory of executable instruction;Wherein, metadata tag is configured to parent in advance, the metadata tag is described for being designated as The quantity of the reserved attribute sequence number of parent, the processor are configured as:
Subclass corresponding to data object to be serialized is obtained, the subclass is inherited in the parent;
The attribute of quantity and the data object indicated by metadata tag based on the parent is in the subclass In attribute ranking, determine the attribute sequence number of the attribute;
Read property value corresponding to attribute described in the data object;
The attribute sequence number and property value of the attribute are serialized, obtain serialized data.
Accordingly, this specification embodiment also provides a kind of computer equipment, including:Processor;For storing processor The memory of executable instruction;Wherein, metadata tag is configured to parent in advance, the metadata tag is described for being designated as The quantity of the reserved attribute sequence number of parent, the processor are configured as:
Obtain serialized data;
Subclass corresponding to the serialized data is obtained, the subclass is inherited in the parent;
The attribute ranking of attribute in quantity and the subclass indicated by metadata tag based on the parent, it is determined that The attribute sequence number of the attribute, obtain the mapping relations of the attribute and the attribute sequence number;
The serialized data is parsed, the attribute sequence number and attribute obtained according to the mapping relations and parsing It is worth and assignment is carried out to the attribute of data object to be reconstructed.
Accordingly, this specification embodiment also provides a kind of computer-readable storage medium, and journey is stored with the storage medium Sequence instructs, and configures metadata tag to parent in advance, and the metadata tag is used to be designated as the reserved attribute sequence of the parent Number quantity, described program instruction include:
Subclass corresponding to data object to be serialized is obtained, the subclass is inherited in the parent;
The attribute of quantity and the data object indicated by metadata tag based on the parent is in the subclass In attribute ranking, determine the attribute sequence number of the attribute;
Read property value corresponding to attribute described in the data object;
The attribute sequence number and property value of the attribute are serialized, obtain serialized data.
Accordingly, this specification embodiment also provides a kind of computer-readable storage medium, and journey is stored with the storage medium Sequence instructs, and configures metadata tag to parent in advance, and the metadata tag is used to be designated as the reserved attribute sequence of the parent Number quantity, described program instruction include:
Obtain serialized data;
Subclass corresponding to the serialized data is obtained, the subclass is inherited in the parent;
The attribute ranking of attribute in quantity and the subclass indicated by metadata tag based on the parent, it is determined that The attribute sequence number of the attribute, obtain the mapping relations of the attribute and the attribute sequence number;
The serialized data is parsed, the attribute sequence number and attribute obtained according to the mapping relations and parsing It is worth and assignment is carried out to the attribute of data object to be reconstructed.
This specification embodiment can use wherein includes the storage medium of program code (including but not in one or more Be limited to magnetic disk storage, CD-ROM, optical memory etc.) on the form of computer program product implemented.Computer is available to be deposited Storage media includes permanent and non-permanent, removable and non-removable media, can realize letter by any method or technique Breath storage.Information can be computer-readable instruction, data structure, the module of program or other data.The storage of computer is situated between The example of matter includes but is not limited to:Phase transition internal memory (PRAM), static RAM (SRAM), dynamic random access memory Device (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), the read-only storage of electrically erasable Device (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus or any other non-biography Defeated medium, the information that can be accessed by a computing device available for storage.
Those skilled in the art will readily occur to this specification after considering specification and putting into practice the invention applied here Other embodiments.This specification is intended to any modification, purposes or adaptations of this specification, these modifications, Purposes or adaptations follow the general principle of this specification and not applied in the art including this specification Common knowledge or conventional techniques.Description and embodiments be considered only as it is exemplary, the true scope of this specification and Spirit is pointed out by following claim.
It should be appreciated that the precision architecture that this specification is not limited to be described above and is shown in the drawings, And various modifications and changes can be being carried out without departing from the scope.The scope of this specification is only limited by appended claim System.
The preferred embodiment of this specification is the foregoing is only, it is all in this explanation not to limit this specification Within the spirit and principle of book, any modification, equivalent substitution and improvements done etc., the model of this specification protection should be included in Within enclosing.

Claims (16)

1. a kind of sequencing method, configures metadata tag to parent in advance, the metadata tag is used to be designated as the father The quantity of the reserved attribute sequence number of class, methods described include:
Subclass corresponding to data object to be serialized is obtained, the subclass is inherited in the parent;
The attribute of quantity and the data object indicated by metadata tag based on the parent is in the subclass Attribute ranks, and determines the attribute sequence number of the attribute;
Read property value corresponding to attribute described in the data object;
The attribute sequence number and property value of the attribute are serialized, obtain serialized data.
2. according to the method for claim 1, quantity and institute indicated by the metadata tag based on the parent Attribute ranking of the attribute of data object in the subclass is stated, determines the attribute sequence number of the attribute, including:
The sequence number that attribute ranking of the attribute based on the data object in the subclass is obtained, first number with the parent It is added according to the quantity indicated by label, obtains the attribute sequence number of the attribute.
3. it is according to the method for claim 1, described to be serialized the attribute sequence number and property value of the attribute, obtain Serialized data, including:
Key information using the attribute SEQ.XFER of the attribute as key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write to the result of the data object by the order of the attribute sequence number Data flow, serialized data of the result data stream as the data object.
4. according to the method described in any one of claims 1 to 3, methods described also includes:
When the attribute sequence number and property value of the attribute are serialized, the attribute type of the attribute is also subjected to sequence Change.
5. according to the method described in any one of claims 1 to 3, methods described also includes:
When the attribute sequence number and property value of the attribute are serialized, the length value of the property value is also subjected to sequence Change.
6. a kind of unserializing method, configures metadata tag to parent in advance, the metadata tag is described for being designated as The quantity of the reserved attribute sequence number of parent, methods described include:
Obtain serialized data;
Subclass corresponding to the serialized data is obtained, the subclass is inherited in the parent;
The attribute ranking of attribute in quantity and the subclass indicated by metadata tag based on the parent, it is determined that described The attribute sequence number of attribute, obtain the mapping relations of the attribute and the attribute sequence number;
The serialized data is parsed, the attribute sequence number and property value pair obtained according to the mapping relations and parsing The attribute of data object to be reconstructed carries out assignment.
7. according to the method for claim 6, quantity and institute indicated by the metadata tag based on the parent The attribute ranking of attribute in subclass is stated, determines the attribute sequence number of the attribute, obtains reflecting for the attribute and the attribute sequence number Relation is penetrated, including:
The sequence number that attribute ranking based on attribute in the subclass is obtained, with the number indicated by the metadata tag of the parent Amount is added, and obtains the attribute sequence number of the attribute.
8. one kind serializing device, configures metadata tag to parent in advance, the metadata tag is used to be designated as the father The quantity of the reserved attribute sequence number of class, described device include:
Class obtains module, and for obtaining subclass corresponding to data object to be serialized, the subclass is inherited in the parent;
Sequence number determining module, for the quantity indicated by the metadata tag based on the parent and the category of the data object Property attribute ranking in the subclass, determine the attribute sequence number of the attribute;
It is worth read module, for reading property value corresponding to attribute described in the data object;
Serialization module, for the attribute sequence number and property value of the attribute to be serialized, obtain serialized data.
9. device according to claim 8, the sequence number determining module, are specifically used for:
The sequence number that attribute ranking of the attribute based on the data object in the subclass is obtained, first number with the parent It is added according to the quantity indicated by label, obtains the attribute sequence number of the attribute.
10. device according to claim 8, the serialization module, are specifically used for:
Key information using the attribute SEQ.XFER of the attribute as key-value pair;
Value information using the property value coding of the attribute as key-value pair;
The key-value pair being made up of key information and value information is write to the result of the data object by the order of the attribute sequence number Data flow, serialized data of the result data stream as the data object.
11. according to the device described in any one of claim 8 to 10, the serialization module is additionally operable to:
When the attribute sequence number and property value of the attribute are serialized, the attribute type of the attribute is also subjected to sequence Change.
12. according to the device described in any one of claim 8 to 10, the serialization module is additionally operable to:
When the attribute sequence number and property value of the attribute are serialized, the length value of the property value is also subjected to sequence Change.
13. a kind of unserializing device, configures metadata tag to parent in advance, the metadata tag is described for being designated as The quantity of the reserved attribute sequence number of parent, described device include:
Data acquisition module, for obtaining serialized data;
Class obtains module, and for obtaining subclass corresponding to the serialized data, the subclass is inherited in the parent;
Relation obtains module, for attribute in the quantity indicated by the metadata tag based on the parent and the subclass Attribute ranks, and determines the attribute sequence number of the attribute, obtains the mapping relations of the attribute and the attribute sequence number;
Unserializing module, for the serialized data to be parsed, obtained according to the mapping relations and parsing Attribute sequence number and property value carry out assignment to the attribute of data object to be reconstructed.
14. device according to claim 13, the relation obtains module, is specifically used for:
The sequence number that attribute ranking based on attribute in the subclass is obtained, with the number indicated by the metadata tag of the parent Amount is added, and obtains the attribute sequence number of the attribute.
15. a kind of computer equipment, including:
Processor;
For storing the memory of processor-executable instruction;
Wherein, metadata tag is configured to parent in advance, the metadata tag is used to be designated as the reserved attribute of the parent The quantity of sequence number, the processor are configured as:
Subclass corresponding to data object to be serialized is obtained, the subclass is inherited in the parent;
The attribute of quantity and the data object indicated by metadata tag based on the parent is in the subclass Attribute ranks, and determines the attribute sequence number of the attribute;
Read property value corresponding to attribute described in the data object;
The attribute sequence number and property value of the attribute are serialized, obtain serialized data.
16. a kind of computer equipment, including:
Processor;
For storing the memory of processor-executable instruction;
Wherein, metadata tag is configured to parent in advance, the metadata tag is used to be designated as the reserved attribute of the parent The quantity of sequence number, the processor are configured as:
Obtain serialized data;
Subclass corresponding to the serialized data is obtained, the subclass is inherited in the parent;
The attribute ranking of attribute in quantity and the subclass indicated by metadata tag based on the parent, it is determined that described The attribute sequence number of attribute, obtain the mapping relations of the attribute and the attribute sequence number;
The serialized data is parsed, the attribute sequence number and property value pair obtained according to the mapping relations and parsing The attribute of data object to be reconstructed carries out assignment.
CN201710619098.2A 2017-07-26 2017-07-26 Serialization and deserialization method, device and equipment Active CN107451237B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710619098.2A CN107451237B (en) 2017-07-26 2017-07-26 Serialization and deserialization method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710619098.2A CN107451237B (en) 2017-07-26 2017-07-26 Serialization and deserialization method, device and equipment

Publications (2)

Publication Number Publication Date
CN107451237A true CN107451237A (en) 2017-12-08
CN107451237B CN107451237B (en) 2020-09-15

Family

ID=60489042

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710619098.2A Active CN107451237B (en) 2017-07-26 2017-07-26 Serialization and deserialization method, device and equipment

Country Status (1)

Country Link
CN (1) CN107451237B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117209A (en) * 2018-07-23 2019-01-01 广州多益网络股份有限公司 Serializing and unserializing method and device
CN110362451A (en) * 2019-07-17 2019-10-22 北京小米移动软件有限公司 A kind of monitoring method, device and medium
CN110990050A (en) * 2019-11-25 2020-04-10 泰康保险集团股份有限公司 Model class attribute value printing control method, device, medium and equipment
CN111752547A (en) * 2020-06-30 2020-10-09 武汉虹信技术服务有限责任公司 Method for modifying Java serialized object serial number and application thereof
CN112286594A (en) * 2020-10-10 2021-01-29 百度(中国)有限公司 Object serialization and deserialization method and device, electronic device and medium
CN113312344A (en) * 2021-07-28 2021-08-27 阿里云计算有限公司 Data serialization and deserialization method, device, system, medium and product

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080256124A1 (en) * 2006-01-31 2008-10-16 Hernandez-Sherrington Mauricio Schema mapping specification framework
CN101661391A (en) * 2009-09-24 2010-03-03 金蝶软件(中国)有限公司 Object serializing method, object deserializing method, device and system
CN102567083A (en) * 2010-12-10 2012-07-11 金蝶软件(中国)有限公司 Object transmission method, object transmission device and object transmission system applying RPC (remote procedure call)
CN102750268A (en) * 2012-06-19 2012-10-24 山东中创软件商用中间件股份有限公司 Object serializing method as well as object de-serializing method, device and system
CN103593194A (en) * 2013-11-21 2014-02-19 北京国双科技有限公司 Object serialization method and device
CN104360865A (en) * 2014-11-28 2015-02-18 中国建设银行股份有限公司 Serialization method, deserialization method and related equipment
CN104850565A (en) * 2014-02-19 2015-08-19 北京京东尚科信息技术有限公司 Metadata management method based on K-V storage system
CN105446722A (en) * 2014-08-29 2016-03-30 优视科技有限公司 Serialization method and device and deserialization method and device
CN106570018A (en) * 2015-10-10 2017-04-19 阿里巴巴集团控股有限公司 Serialization method and apparatus, deserialization method and apparatus, serialization and deserialization system, and electronic device
US9665601B1 (en) * 2010-12-16 2017-05-30 Crimson Corporation Using a member attribute to perform a database operation on a computing device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080256124A1 (en) * 2006-01-31 2008-10-16 Hernandez-Sherrington Mauricio Schema mapping specification framework
CN101661391A (en) * 2009-09-24 2010-03-03 金蝶软件(中国)有限公司 Object serializing method, object deserializing method, device and system
CN102567083A (en) * 2010-12-10 2012-07-11 金蝶软件(中国)有限公司 Object transmission method, object transmission device and object transmission system applying RPC (remote procedure call)
US9665601B1 (en) * 2010-12-16 2017-05-30 Crimson Corporation Using a member attribute to perform a database operation on a computing device
CN102750268A (en) * 2012-06-19 2012-10-24 山东中创软件商用中间件股份有限公司 Object serializing method as well as object de-serializing method, device and system
CN103593194A (en) * 2013-11-21 2014-02-19 北京国双科技有限公司 Object serialization method and device
CN104850565A (en) * 2014-02-19 2015-08-19 北京京东尚科信息技术有限公司 Metadata management method based on K-V storage system
CN105446722A (en) * 2014-08-29 2016-03-30 优视科技有限公司 Serialization method and device and deserialization method and device
CN104360865A (en) * 2014-11-28 2015-02-18 中国建设银行股份有限公司 Serialization method, deserialization method and related equipment
CN106570018A (en) * 2015-10-10 2017-04-19 阿里巴巴集团控股有限公司 Serialization method and apparatus, deserialization method and apparatus, serialization and deserialization system, and electronic device

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117209A (en) * 2018-07-23 2019-01-01 广州多益网络股份有限公司 Serializing and unserializing method and device
CN109117209B (en) * 2018-07-23 2021-10-01 广州多益网络股份有限公司 Serialization and deserialization method and device
CN110362451A (en) * 2019-07-17 2019-10-22 北京小米移动软件有限公司 A kind of monitoring method, device and medium
CN110362451B (en) * 2019-07-17 2023-09-26 北京小米移动软件有限公司 Monitoring method, device and medium
CN110990050A (en) * 2019-11-25 2020-04-10 泰康保险集团股份有限公司 Model class attribute value printing control method, device, medium and equipment
CN110990050B (en) * 2019-11-25 2023-10-13 泰康保险集团股份有限公司 Model attribute value printing control method, device, medium and equipment
CN111752547A (en) * 2020-06-30 2020-10-09 武汉虹信技术服务有限责任公司 Method for modifying Java serialized object serial number and application thereof
CN112286594A (en) * 2020-10-10 2021-01-29 百度(中国)有限公司 Object serialization and deserialization method and device, electronic device and medium
CN113312344A (en) * 2021-07-28 2021-08-27 阿里云计算有限公司 Data serialization and deserialization method, device, system, medium and product
CN113312344B (en) * 2021-07-28 2022-01-04 阿里云计算有限公司 Data serialization and deserialization method, device, system, medium and product

Also Published As

Publication number Publication date
CN107451237B (en) 2020-09-15

Similar Documents

Publication Publication Date Title
CN107451237A (en) Serializing and unserializing method, apparatus and equipment
JP7288903B2 (en) Computer implemented methods, systems, computer programs, computer programs and storage media for data anonymization
CN105760534B (en) Data structure, hadoop cluster, server and its application method of customized serializability
CN111352935B (en) Index creating method, device and equipment in block chain type account book
CN103631847A (en) Method and system for context-based search for a data store related to a graph node
CN104160398B (en) Content structuring method and system used in large object data
CN108427731A (en) Processing method, device, terminal device and the medium of page code
CN111159215B (en) Mapping method and device for Java class and relational database and computing equipment
CN113721862B (en) Data processing method and device
CN111249736A (en) Code processing method and device
US9292549B2 (en) Method and system for index serialization
CN110019111A (en) Data processing method, device, storage medium and processor
CN110059088B (en) Data attribute identification method, device and equipment in block chain type account book
CN107408055B (en) Code cache system
Freund et al. A formalization of membrane systems with dynamically evolving structures
CN104346234B (en) A kind of method of internal storage access, equipment and system
CN111507075B (en) Method and device for converting data format
CN110059087A (en) Data attribute identification method, device and equipment in a kind of piece of chain type account book
CN116127154A (en) Knowledge tag recommendation method and device, electronic equipment and storage medium
CN115629763A (en) Target code generation method and NPU instruction display method and device
CN109840080B (en) Character attribute comparison method and device, storage medium and electronic equipment
CN112052234A (en) Service data processing method and device, storage medium and electronic device
US11928134B1 (en) Medoid-based data compression
CN111008195A (en) Database free space management method, system, terminal and storage medium
CN114036171B (en) Application data management method, device, computer 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
TR01 Transfer of patent right

Effective date of registration: 20200923

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200923

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.

TR01 Transfer of patent right