Skip to content

Commit 028e108

Browse files
authored
Update README.md
1 parent 7944783 commit 028e108

1 file changed

Lines changed: 28 additions & 22 deletions

File tree

README.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ To get the full features, you just have to import in your system 4 classes (1) :
1616

1717
To enable this feature for a class, that class has to extend from _OPNLib.Serialize.Adaptor_. That'll be the only time that you'll have to touch your class for this feature. After that moment your class will be able to export/import JSON objects and it will accept future serialization mechanisms that you decide to implement without having to make more changes to class definition.
1818

19-
```
20-
```
19+
---
20+
2121
_**Example:**_
2222
_(Example assumes that your classname is `SampleApps.Serialize.MapTesting`, that is a persistent class and that you already extended it to inherit from `OPNLib.Serialize.Adaptor`)_
2323

@@ -34,12 +34,12 @@ From the terminal,in the name space where your class exists :
3434
write newOBJ.%Id()
3535
```
3636
We will have a new instance of _`SampleApps.Serialize.MapTesting`_ object, a clone of the one with ID=1. This was the example, we can modify it before saving or just discarding.
37-
```
38-
```
37+
38+
---
3939

4040
### What _`OPNLib.Serialize.Adaptor`_ provides?
4141

42-
Basically when we compile a class that inherits from our Adaptor, the class will have 4 new generic instance methods: `Export` and `Import` (that will act as dispatchers), and `exportStd` and `importStd` (that implements the logic to serialize/deserialize in/from JSON format). Also, and very important, it will be created a generic mapping between each of the properties in the Caché object and its equivalent serialized. That class mapping will be stored in 2 internal globals: `^MAPS` and `^MAPSREV` (Globals structure is explained in more detail in class documentation).
42+
Basically when we compile a class that inherits from our Adaptor, the class will have 4 new generic instance methods: `Export` and `Import` (that will act as dispatchers), and `exportStd` and `importStd` (that implements the default logic to serialize/deserialize in/from JSON format). Also, and very important, it will be created a generic mapping between each of the properties in the Caché object and its equivalent serialized. That class mapping will be stored in 2 internal globals: `^MAPS` and `^MAPSREV` (Globals structure is explained in more detail in class documentation).
4343

4444
### How is the mapping built at first place?
4545

@@ -49,23 +49,29 @@ By default, all classes that inherit from `OPNLib.Serialize.Adaptor` will have
4949

5050
Each property will be categorized in group types, numbered from 1 to 6. Currently these are the group types supported :
5151

52-
1. Basic type
53-
* It'll include %String, %Integer, %Date, %Datetime,%Timestamp,%Decimal,%Float,… and most of the basic types defined in the %Library package
54-
2. List collection
55-
* It'll include collections of datatypes of type %Collection.ListOfDT
56-
3. Array collection
57-
* It'll include collections of datatypes of type %Collection.ArrayOfDT
58-
4. Object Reference
59-
* A property that reference a custom object not in %* libraries
60-
5. Array of objects and Relationship objects
61-
* A property of type %Collection.ArrayOfObject or a property of type %RelationshipObject with cardinality many or children
62-
6. List of Objects
63-
* A property of type %Collection.ListOfObject
64-
7. Stream
65-
* Properties of type %Stream.*, %CSP.*stream*,…
66-
67-
During map generation, by default, the Adaptor sets export and Import conversion methods for dates and streams (which are exported as base64 text)
68-
52+
Code | Category | Description
53+
---- | ------------- | -----------
54+
1 | Basic type | It'll include %String, %Integer, %Date, %Datetime,%Timestamp,%Decimal,%Float,… and most of the basic types defined in the %Library package
55+
2 | List collection | It'll include collections of datatypes of type %Collection.ListOfDT
56+
3 | Array collection | It'll include collections of datatypes of type %Collection.ArrayOfDT
57+
4 | Object Reference | A property that reference a custom object not in %* libraries
58+
5 | Array of objects and Relationship objects | A property of type %Collection.ArrayOfObject or a property of type %RelationshipObject with cardinality many or children
59+
6 | List of Objects | A property of type %Collection.ListOfObject
60+
7 | Stream | Properties of type %Stream.*, %CSP.*stream*,…
61+
62+
During map generation, by default, the Adaptor sets export and Import conversion methods for dates and streams (which are exported as a stream in base64).
63+
64+
---
65+
**MAP0 structure**
66+
67+
MAP0("*classname*",_GroupType[1..6]_,"_Source Property Name_") = *List Element*
68+
*List Element*:
69+
> Pos 1 *Target Property Name*
70+
> Pos 2
71+
> Pos 3
72+
> Pos 4
73+
74+
---
6975

7076
### How could we configure our mapping for serialization?
7177

0 commit comments

Comments
 (0)