Constructor
new ComplexObjectType(jsObject, typeNameopt)
Public constructor.
Specifies a JavaScript Object type which will be mapped to/from the complex type. This specification is done using an instance of the JavaScript Object.
If an object of the complex type is going to be received (deserialized), the JavaScript Object must have a constructor without parameters or with optional parameters only.
The JavaScript Object defines a set of fields of the complex type.
By default, the fields have no types specified. It means during operations the Ignite client will try to make automatic mapping between JavaScript types and Ignite object types - according to the mapping table defined in the description of the ObjectType class.
A type of any field may be specified later by setFieldType() method.
By default, the name of the complex type is the name of the JavaScript Object. The name may be explicitely specified using optional typeName parameter in the constructor.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
jsObject |
object | instance of JavaScript Object which will be mapped to/from this complex type. |
||
typeName |
string |
<optional> |
null | name of the complex type. |
- Source:
Extends
Methods
setFieldType(fieldName, fieldType) → {ComplexObjectType}
Specifies a type of the field in the complex type.
If the type is not specified then during operations the Ignite client will try to make automatic mapping between JavaScript types and Ignite object types - according to the mapping table defined in the description of the ObjectType class.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | name of the field. |
fieldType |
ObjectType.PRIMITIVE_TYPE | CompositeType | type of the field:
|
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the same instance of the ComplexObjectType.
- Type
- ComplexObjectType