Unit 'fpjson' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#fcl]

SetJSONInstanceType

JSON factory: Set the JSONData class types to use.

Declaration

Source position: fpjson.pp line 784

function SetJSONInstanceType(

  AType: TJSONInstanceType;

  AClass: TJSONDataClass

):TJSONDataClass;

Arguments

AType

  

Type of data to register a class for.

AClass

  

Class to use when a data item of type AType is encountered.

Function result

Previous JSON instance type.

Description

SetJSONInstanceType can be used to register descendents of the TJSONData class, one for each possible kind of data. The class type used to instantiate data of type AType is passed in AClass.

The JSON parser will use the registered types to instantiate JSON Data instanced: when the parser encounters a value of type AType, it will instantiate a class of type AClass. By default, the classes in the fpJSON unit are used.

The CreateJSON functions also use the types registered here to instantiate their data.

The return value is the previously registered instance type for the AType.

Errors

If AClass is not suitable to contain data of type AType, an exception is raised.

See also

GetJSONInstanceType

  

JSON factory: Get the JSONData class types to use.

CreateJSON

  

Create a JSON data item.


Documentation generated on: Nov 23 2024