IRISLIB database
Adaptor Class Reference

The following table displays the correspondence between JSON field values and property values that will be implemented by the JSON Adaptor. More...

Inheritance diagram for Adaptor:

Static Public Attributes

 JSONENABLED
 If this parameter is true then JSON-enabling methods will be generated. More...
 
 JSONIGNOREINVALIDFIELD
 The JSONIGNOREINVALIDFIELD parameter allows the programmer to control handling of unexpected fields in the JSON input. More...
 
 JSONIGNORENULL
 JSONIGNORENULL allows the programmer to override the default handling of empty strings for string properties. More...
 
 JSONNULL
 If JSONNULL is true (=1), then unspecified properties are exported as the null value. More...
 
 JSONREFERENCE
 JSONREFERENCE specifies the default value of the JSONREFERENCE property parameter that specifies how to More...
 

Private Member Functions

_.Library.Status JSONExport (_, _.Library.String mappingName)
 Serialize a JSON enabled class as a JSON document and write it to the current device. More...
 
_.Library.Status JSONExportToStream (_.Stream.Object export, _, _.Library.String mappingName)
 Serialize a JSON enabled class as a JSON document and write it to a stream. More...
 
_.Library.Status JSONExportToString (_, _.Library.String export, _, _.Library.String mappingName)
 Serialize a JSON enabled class as a JSON document and return it as a string. More...
 
_.Library.Status JSONImport (input, _, _.Library.String mappingName)
 JSONImport imports JSON or dynamic object input into this object. More...
 

Static Private Member Functions

_.Library.RegisteredObject JSONNew (_.Library.DynamicObject dynamicObject, _.Library.RegisteredObject containerOref)
 Get an instance of an JSON enabled class. More...
 

Detailed Description

The following table displays the correspondence between JSON field values and property values that will be implemented by the JSON Adaptor.



The actual conversion between registered object values and JSON values will be done by new datatype methods: JSONToLogical and LogicalToJSON. In addition, a new JSONTYPE parameter will be introduced for the datatype classes which indicates how the data type will be mapped to JSON.

    JSON                                            Registered object type
    object                                          class referenced by property
    array - error if all values are not literals    ListOfDatatypes
    array - error if all values are not objects     ListOfObjects or relationship
    array - error if all values are not literals    List
    string                                          String, Char, Name, FileCharacterStream, GlobalCharacterStream
    string - must be base64 encoded                 Binary, FileBinaryStream, GlobalBinaryStream
    string - ODBC format date                       Date
    string - ODBC format time                       Time
    string - ODBC format date/time                  DateTime, TimeStamp
    numeric - bounds must match object type         BigInt, Currency, Decimal, Double, Float, Integer, Numeric, SmallInt, TinyInt
    boolean                                         Boolean

    

Note that the types xsd package are all subclasses of base % datatypes and will map as the super type.

Member Function Documentation

◆ JSONExport()

_.Library.Status JSONExport (   _,
_.Library.String  mappingName 
)
private

Serialize a JSON enabled class as a JSON document and write it to the current device.


mappingName is the name of the mapping to use for the export. The base mapping is represented by "" and is the default.

◆ JSONExportToStream()

_.Library.Status JSONExportToStream ( _.Stream.Object  export,
  _,
_.Library.String  mappingName 
)
private

Serialize a JSON enabled class as a JSON document and write it to a stream.


mappingName is the name of the mapping to use for the export. The base mapping is represented by "" and is the default.

◆ JSONExportToString()

_.Library.Status JSONExportToString (   _,
_.Library.String  export,
  _,
_.Library.String  mappingName 
)
private

Serialize a JSON enabled class as a JSON document and return it as a string.


mappingName is the name of the mapping to use for the export. The base mapping is represented by "" and is the default.

◆ JSONImport()

_.Library.Status JSONImport (   input,
  _,
_.Library.String  mappingName 
)
private

JSONImport imports JSON or dynamic object input into this object.


The input argument is either JSON as a string or stream, or a subclass of DynamicAbstractObject.
mappingName is the name of the mapping to use for the import. The base mapping is represented by "" and is the default.

◆ JSONNew()

_.Library.RegisteredObject JSONNew ( _.Library.DynamicObject  dynamicObject,
_.Library.RegisteredObject  containerOref 
)
staticprivate

Get an instance of an JSON enabled class.



You may override this method to do custom processing (such as initializing
the object instance) before returning an instance of this class.
However, this method should not be called directly from user code.<br>
Arguments:<br>
    dynamicObject is the dynamic object with thee values to be assigned to the new object.<br>
    containerOref is the containing object instance when called from JSONImport.

Member Data Documentation

◆ JSONENABLED

JSONENABLED
static

If this parameter is true then JSON-enabling methods will be generated.

Otherwise, the method generators do not produce a runnable method.

◆ JSONIGNOREINVALIDFIELD

JSONIGNOREINVALIDFIELD
static

The JSONIGNOREINVALIDFIELD parameter allows the programmer to control handling of unexpected fields in the JSON input.

The default (JSONIGNOREINVALIDFIELD = 0) will treat an unexpected field as an error. If JSONIGNOREINVALIDFIELD is set = 1, then unexpected fields will be ignored.

◆ JSONIGNORENULL

JSONIGNORENULL
static

JSONIGNORENULL allows the programmer to override the default handling of empty strings for string properties.

This paramneter applies to only true strings which is determined by XSDTYPE = "string" as well as JSONTYPE="string" By default (JSONIGNORENULL = 0), empty strings in the JSON input are stored as $c(0) and $c(0) is written to JSON as the string "". A missing field in the JSON input is always stored as "" and "" is always output to JSON according to the JSONNULL parameter.
If JSONIGNORENULL is set = 1, then both missing fields in the JSON and empty strings are input as "", and both "" and $c(0) are output as field values of "". The corresponding property parameter overrides this parameter if specified.

◆ JSONNULL

JSONNULL
static

If JSONNULL is true (=1), then unspecified properties are exported as the null value.

Otherwise the field corresponding to the property is just skipped during export. The corresponding property parameter overrides this parameter if specified.

◆ JSONREFERENCE

JSONREFERENCE
static

JSONREFERENCE specifies the default value of the JSONREFERENCE property parameter that specifies how to

project references to JSON. JSONREFERENCE may be specified for any property to override this default value. Possible values of JSONREFERENCE are "OBJECT", "ID", "OID", "GUID".
="OBJECT" is the default and indicates that the properties of the referenced class are used to represent the referenced object.
="ID" indicates that the id of a persistent or serial class is used to represent the reference.
="OID" indicates that the oid of a persistent or serial class is used to represent the reference. The form of the oid as projected to JSON will be classname,id.
="GUID" indicates the GUID of a persistent class is used to represent the reference.
The corresponding property parameter overrides this parameter if specified.