Serializer
with a cache
serialization :: CachingSerializer :: cache=
Cache of known objectsserialization :: CachingSerializer :: link
Link the cache ofself
with deserializer
serialization $ CachingSerializer :: SELF
Type of this instance, automatically specialized in every classserialization :: CachingSerializer :: cache=
Cache of known objectscore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
serialization :: Serializer :: current_object
The object currently serialized byserialized
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
serialization :: CachingSerializer :: link
Link the cache ofself
with deserializer
core :: Object :: output_class_name
Display class name on stdout (debug only).serialization :: Serializer :: serialize
Entry point method of this service, serialize theobject
serialization :: Serializer :: serialize_attribute
Serialize an attribute to compose a serializable objectserialization :: Serializer :: serialize_core
The method is called when a standardvalue
is serialized
serialization :: Serializer :: serialize_reference
Serialize an object, with full serialization or a simple referenceserialization :: Serializer :: try_to_serialize
Serializevalue
is possible, i.e. it is Serializable
or null
serialization :: Serializer :: warn
Warn of problems and potential errors (such as if an attributeserialization :: RestrictedJsonSerializer
Extends JsonSerializer and adds specific business behaviors when dealing with business objects.
# A `Serializer` with a `cache`
abstract class CachingSerializer
super Serializer
# Cache of known objects
var cache = new SerializerCache is lazy, writable
# Link the cache of `self` with `deserializer`
#
# This allows reference objects by id when they are known by the other side
# of the stream.
#
# Use `cache` if it is a `DuplexCache`, otherwise create a new one.
fun link(deserializer: CachingDeserializer)
do
var mem = self.cache
if not mem isa DuplexCache then mem = new DuplexCache
self.cache = mem
deserializer.cache = mem
end
end
lib/serialization/caching.nit:21,1--42,3