You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-22Lines changed: 28 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,8 @@ To get the full features, you just have to import in your system 4 classes (1) :
16
16
17
17
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.
18
18
19
-
```
20
-
```
19
+
---
20
+
21
21
_**Example:**_
22
22
_(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`)_
23
23
@@ -34,12 +34,12 @@ From the terminal,in the name space where your class exists :
34
34
write newOBJ.%Id()
35
35
```
36
36
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
+
---
39
39
40
40
### What _`OPNLib.Serialize.Adaptor`_ provides?
41
41
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).
43
43
44
44
### How is the mapping built at first place?
45
45
@@ -49,23 +49,29 @@ By default, all classes that inherit from `OPNLib.Serialize.Adaptor` will have
49
49
50
50
Each property will be categorized in group types, numbered from 1 to 6. Currently these are the group types supported :
51
51
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).
0 commit comments