Skip to main content

HS.REST.Adaptor

deprecated abstract class HS.REST.Adaptor extends %Library.RegisteredObject

DEPRECATED. Use HS.REST.Model.ISerializable instead.

Method Inventory

Methods

final classmethod %ChangesToObject(pOldObj As HS.REST.Adaptor, pNewObj As HS.REST.Adaptor) as %Boolean
Checks for changes to properties between pOldObj and pNewObj. Returns 1 if changes found and 0 otherwise.
The following rules are used for to check for equality:

- Data type: Direct equality check using equality operator.
- Single JSON Object: Convert both objects to JSON strings and check equality.
- Single Object: Recursive call to this function.
- Collection (of data types): Check for equal count in both collections. Check equality of elements with the same key using equality operator.
- Collection (of objects): Check for equal count in both collections. Check equality of elements with the same key using by recursive calls to this function.
NOTE: Properties ignored when checking for equality: multi-dimensional, private, read-only if property parameter JSON = 0
@API.Method @Argument pOldObj First object of comparison @Argument pNewObj Second object of comparison
final method %FromJSON(pJson As %DynamicObject)
Copies the property values from the pJson %DynamicObject into this object.
The following rules are used for the copy:

- Data type/Single JSON object: Direct set of the caller's property to the json field.
- Single Object: Recursive call on the caller's property, passing in the equivalent json field as an argument.
- List (of data types/JSON objects): Iterate over the json field, inserting sub-fields into the caller's list property as would be done for a single data type/JSON object property.
- List (of objects): Iterate over the json field, inserting sub-fields into the caller's list property as would be done for a single object property.
- Array (of data types): Iterate over the json field, inserting sub-field values into the caller's array property as would be done for a single data type/JSON object property value, using the sub-field name as the array key.
- Array (of objects): Iterate over the json field, inserting sub-field values into the caller's array property as would be done for a single object property, using the sub-field name as the array key.
NOTE: Properties not converted: multi-dimensional, private properties, if property parameter JSON = 0.
@API.Method @Argument pJson the %DynamicObject from which to copy contents
final method %ToJSON() as %DynamicObject
Converts this object to a %DynamicObject and returns the %DynamicObject.
The following rules are used for the conversion:

- Data type: Direct set of the json field, with the json name and type mapped appropriately from the object name and type.
- Single JSON object: Direct set of the json field, with the json name mapped appropriately from the object name.
- Single Object: Set the json field to the output of a recursive call on this object, with the json name mapped appropriately from the object name.
- List (of data types): Create a %DynamicArray. Insert each list element into it as would be done for a single data type property. Set the json field to the %DynamicArray.
- List (of JSON objects): create a %DynamicArray. Insert each list element into it as would be done for a single JSON object property. Set the json field to the %DynamicArray.
- List (of objects): create a %DynamicArray. Insert each list element into it as would be done for a single object property. Set the json field to the %DynamicArray.
- Array (of data types): create a %DynamicObject. Insert each array value into it as would be done for single data type property, using the array key as the name of a field in the %DynamicObject. Set the json field to the %DynamicObject.
- Array (of JSON objects): create a %DynamicObject. Insert each array value into it as would be done for single JSON object property, using the array key as the name of a field in the %DynamicObject. Set the json field to the %DynamicObject.
- Array (of objects): create a %DynamicObject. Insert each array value into it as would be done for single object property, using the array key as the name of a field in the %DynamicObject. Set the json field to the %DynamicObject.
NOTE: Properties not converted: Multi-dimensional, private properties, if property parameter JSON = 0.
@API.Method

Inherited Members

Inherited Methods

FeedbackOpens in a new tab