Manual Reference Source Test
public class | source

HelperFactory

Factory to convert responses to classes (deserialization)

Static Member Summary

Static Public Members
public static get
public static set
Static Private Members
private static

_map: *

Method Summary

Public Methods
public

async get(json: Object, type: String, meta: Object): Promise<Object>

Convert the json to the appropriate class (deserialize)

public

async getClass(json: Object, type: String): Class

Converts an object to a class if it is mapped

Static Public Members

public static get map: Object source

public static set map: Object source

Static Private Members

private static _map: * source

Public Methods

public async get(json: Object, type: String, meta: Object): Promise<Object> source

Convert the json to the appropriate class (deserialize)

Params:

NameTypeAttributeDescription
json Object

The json from an api call (in JSON)

type String
  • optional

The type to convert the object to (otherwise use json's data type)

meta Object
  • optional

Any object to be passed through to assign meta to array if necessary

Return:

Promise<Object>

Returns an object with the appropriate type

public async getClass(json: Object, type: String): Class source

Converts an object to a class if it is mapped

Params:

NameTypeAttributeDescription
json Object

JSON to convert to a class

type String
  • optional

The type to override the json.type

Return:

Class

Returns a class