Constructor
new BinaryObject(typeName)
Creates an instance of the BinaryObject without any fields.
Fields may be added later using setField() method.
Parameters:
Name | Type | Description |
---|---|---|
typeName |
string | name of the complex type to generate the type Id. |
- Source:
Methods
(async, static) fromObject(jsObject, complexObjectTypeopt) → {BinaryObject}
Creates an instance of the BinaryObject from the specified instance of JavaScript Object.
All fields of the JavaScript Object instance with their values are added to the BinaryObject. Fields may be added or removed later using setField() and removeField() methods.
If complexObjectType parameter is specified, then the type Id is taken from it. Otherwise, the type Id is generated from the name of the JavaScript Object.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
jsObject |
object | instance of JavaScript Object which adds and initializes the fields of the BinaryObject instance. |
||
complexObjectType |
ComplexObjectType |
<optional> |
null | instance of complex type definition which specifies non-standard mapping of the fields of the BinaryObject instance to/from the Ignite types. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- new BinaryObject instance.
- Type
- BinaryObject
(async) getField(fieldName, fieldTypeopt) → {*}
Returns a value of the specified field.
Optionally, specifies a type of the field. If the type is not specified then 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 | Attributes | Default | Description |
---|---|---|---|---|
fieldName |
string | name of the field. |
||
fieldType |
ObjectType.PRIMITIVE_TYPE | CompositeType |
<optional> |
null | type of the field:
|
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- value of the field or JavaScript undefined if the field does not exist.
- Type
- *
getFieldNames() → {Array.<string>}
Returns names of all fields of this BinaryObject instance.
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- names of all fields.
- Type
- Array.<string>
getTypeName() → {string}
Returns type name of this BinaryObject instance.
- Source:
Returns:
- type name.
- Type
- string
hasField(fieldName) → {boolean}
Checks if the specified field exists in this BinaryObject instance.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | name of the field. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if exists, false otherwise.
- Type
- boolean
removeField(fieldName) → {BinaryObject}
Removes the specified field. Does nothing if the field does not exist.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | name of the field. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the same instance of BinaryObject
- Type
- BinaryObject
setField(fieldName, fieldValue, fieldTypeopt) → {BinaryObject}
Sets the new value of the specified field. Adds the specified field, if it did not exist before.
Optionally, specifies a type of the field. 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 | Attributes | Default | Description |
---|---|---|---|---|
fieldName |
string | name of the field. |
||
fieldValue |
* | new value of the field. |
||
fieldType |
ObjectType.PRIMITIVE_TYPE | CompositeType |
<optional> |
null | type of the field:
|
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the same instance of BinaryObject
- Type
- BinaryObject
(async) toObject(complexObjectType) → {object}
Deserializes this BinaryObject instance into an instance of the specified complex object type.
Parameters:
Name | Type | Description |
---|---|---|
complexObjectType |
ComplexObjectType | instance of class representing complex object type. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- instance of the JavaScript object which corresponds to the specified complex object type.
- Type
- object