Last updated

API / geotoolkit / persistence / MementoSerializationContext / MementoSerializationContext

Class: MementoSerializationContext

persistence.MementoSerializationContext.MementoSerializationContext

The serialization context to Memento

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new MementoSerializationContext(object, registry)

new MementoSerializationContext(object?, registry?)

Parameters

Name Type
Optional objectany
Optional registryRegistry

Overrides

SerializationContext.constructor

Methods

addObject

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.

Parameters

Name Type Description
namestring | numberunique property name
objectanyobject to be serialized
Optional typestringthe optional serialization type

Returns

MementoSerializationContext

Overrides

SerializationContext.addObject


addReference

addReference(obj, memento?): number

Add reference to the object

Parameters

Name Type Description
objanyobject to get reference
Optional mementoanyserialized view of object

Returns

number

id of the reference

Overrides

SerializationContext.addReference


addValue

addValue(name, value): void

Adds the specified value with name "name" to the current context

Parameters

Name Type Description
namestringunique property name
valueanyobject value

Returns

void

Overrides

SerializationContext.addValue


commit

commit(): void

Commits changes

Returns

void

Overrides

SerializationContext.commit


createChild

createChild(name, type?): MementoSerializationContext

Create child element in the current context

Parameters

Name Type Description
namestringunique property name
Optional typestringtype of the object

Returns

MementoSerializationContext

Overrides

SerializationContext.createChild


getMemento

getMemento(): any

Gets a result of the serialization to memento

Returns

any


getOptions

getOptions(): Options

Returnы serialization ooptions

Returns

Options

serialization ooptions

Overrides

SerializationContext.getOptions


getReference

getReference(id): any

Get serialized view of object by reference id

Parameters

Name Type Description
idnumberreference id

Returns

any

serialized view of object


getReferenceId

getReferenceId(obj): number

Get reference id for the specified object. Null as return value means that the object was not saved before

Parameters

Name Type Description
objanyobject value

Returns

number

reference id or null if not found

Overrides

SerializationContext.getReferenceId


getRegistry

getRegistry(): Registry

Get registry of memento serializers

Returns

Registry

Overrides

SerializationContext.getRegistry


setObject

setObject(object, type?): MementoSerializationContext

Sets object to the current context (no child nodes for the object will be created in current context)

Parameters

Name Type Description
objectanyobject value
Optional typestringthe optional serialization type

Returns

MementoSerializationContext

Overrides

SerializationContext.setObject


setOptions

setOptions(options): MementoSerializationContext

Set serialization options

Parameters

Name Type Description
optionsOptionsserialization options

Returns

MementoSerializationContext

this


setValue

setValue(value): MementoSerializationContext

Sets value to the current context (no child nodes for the value will be created in current context)

Parameters

Name Type Description
valueanyobject value

Returns

MementoSerializationContext

Overrides

SerializationContext.setValue