# All refinement should look for a precise `class_name` and call super
# on unsupported classes.
protected fun deserialize_class(class_name: String): Object do
+ return deserialize_class_intern(class_name)
+ end
+
+ # Generated service to deserialize the next available object as an instance of `class_name`
+ #
+ # Refinements to this method will be generated by the serialization phase.
+ # To avoid conflicts, there should not be any other refinements to this method.
+ # You can instead use `deserialize_class`.
+ protected fun deserialize_class_intern(class_name: String): Object do
print "Error: doesn't know how to deserialize class \"{class_name}\""
abort
end
if deserializer_npropdef == null then
# create the property
- code.add " redef fun deserialize_class(name)"
+ code.add " redef fun deserialize_class_intern(name)"
code.add " do"
else
- toolcontext.error(deserializer_npropdef.location, "Error: you cannot define `Deserializer::deserialize_class` in a module where you use `auto_serializable`.")
+ toolcontext.error(deserializer_npropdef.location, "Error: `Deserializer::deserialize_class_intern` is generated and must not be defined, use `deserialize_class` instead.")
return
end
do
for npropdef in n_propdefs do if npropdef isa AMethPropdef then
var id = npropdef.n_methid
- if id isa AIdMethid and id.n_id.text == "deserialize_class" then
+ if id isa AIdMethid and id.n_id.text == "deserialize_class_intern" then
return npropdef
end
end