API / geotoolkit / persistence / MementoSerializationContext / MementoSerializationContext
persistence.MementoSerializationContext.MementoSerializationContext
The serialization context to Memento
↳
MementoSerializationContext
Methods
Constructors
• new MementoSerializationContext(object?, registry?)
| Name | Type |
|---|---|
Optional object | any |
Optional registry | Registry |
SerializationContext.constructor
Methods
▸ addObject(name, object, type?): MementoSerializationContext
Adds child element with the specified name and optional type to the current context. Unlike "setObject", this method creates a child node to store the object.
| Name | Type | Description |
|---|---|---|
name | string | number | unique property name |
object | any | object to be serialized |
Optional type | string | the optional serialization type |
SerializationContext.addObject
▸ addReference(obj, memento?): number
Add reference to the object
| Name | Type | Description |
|---|---|---|
obj | any | object to get reference |
Optional memento | any | serialized view of object |
number
id of the reference
SerializationContext.addReference
▸ addValue(name, value): void
Adds the specified value with name "name" to the current context
| Name | Type | Description |
|---|---|---|
name | string | unique property name |
value | any | object value |
void
▸ commit(): void
Commits changes
void
▸ createChild(name, type?): MementoSerializationContext
Create child element in the current context
| Name | Type | Description |
|---|---|---|
name | string | unique property name |
Optional type | string | type of the object |
SerializationContext.createChild
▸ getMemento(): any
Gets a result of the serialization to memento
any
▸ getOptions(): Options
Returnы serialization ooptions
serialization ooptions
SerializationContext.getOptions
▸ getReference(id): any
Get serialized view of object by reference id
| Name | Type | Description |
|---|---|---|
id | number | reference id |
any
serialized view of object
▸ getReferenceId(obj): number
Get reference id for the specified object. Null as return value means that the object was not saved before
| Name | Type | Description |
|---|---|---|
obj | any | object value |
number
reference id or null if not found
SerializationContext.getReferenceId
▸ getRegistry(): Registry
Get registry of memento serializers
SerializationContext.getRegistry
▸ setObject(object, type?): MementoSerializationContext
Sets object to the current context (no child nodes for the object will be created in current context)
| Name | Type | Description |
|---|---|---|
object | any | object value |
Optional type | string | the optional serialization type |
SerializationContext.setObject
▸ setOptions(options): MementoSerializationContext
Set serialization options
| Name | Type | Description |
|---|---|---|
options | Options | serialization options |
this
▸ setValue(value): MementoSerializationContext
Sets value to the current context (no child nodes for the value will be created in current context)
| Name | Type | Description |
|---|---|---|
value | any | object value |