serialization :: InspectSerializer :: _first_attribute_serialized
serialization :: InspectSerializer :: first_attribute_serialized
serialization :: InspectSerializer :: first_attribute_serialized=
serialization :: InspectSerializer :: stream=
Target writing streamserialization $ InspectSerializer :: SELF
Type of this instance, automatically specialized in every classserialization $ InspectSerializer :: current_object
The object currently serialized byserialized
serialization $ InspectSerializer :: serialize
Entry point method of this service, serialize theobject
serialization $ InspectSerializer :: serialize_attribute
Serialize an attribute to compose a serializable objectserialization $ InspectSerializer :: serialize_reference
Serialize an object, with full serialization or a simple referenceserialization :: CachingSerializer :: _cache
Cache of known objectsserialization :: InspectSerializer :: _first_attribute_serialized
serialization :: 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
serialization :: InspectSerializer :: first_attribute_serialized
serialization :: InspectSerializer :: first_attribute_serialized=
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 :: native_class_name
The class name of the object in CString format.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 :: InspectSerializer :: stream=
Target writing streamserialization :: 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 attribute
# Serialization engine writing the object attributes to strings
private class InspectSerializer
super CachingSerializer
# Target writing stream
var stream: Writer
redef var current_object = null
var first_object: nullable Object = null
redef fun serialize(object)
do
if object == null then
stream.write "null"
else
if current_object == null then
first_object = object
end
var last_object = current_object
current_object = object
object.accept_inspect_serializer self
current_object = last_object
end
end
var first_attribute_serialized = false
redef fun serialize_attribute(name, value)
do
if first_attribute_serialized then
stream.write ", "
else
stream.write " "
first_attribute_serialized = true
end
stream.write name
stream.write ":"
super
end
redef fun serialize_reference(object)
do
if cache.has_object(object) then
# Cycle
var id = object.object_id
if inspect_testing then id = cache.id_for(object)
stream.write "<"
stream.write object.class_name
stream.write "#"
stream.write id.to_s
stream.write ">"
else if object != first_object and (not object isa DirectSerializable) then
# Another object, print class and id only
var id = object.object_id
if inspect_testing then id = cache.new_id_for(object)
stream.write "<"
stream.write object.class_name
stream.write "#"
stream.write id.to_s
stream.write ">"
else
# Main object
serialize object
end
end
end
lib/serialization/inspect.nit:23,1--94,3