From 53ced013fa6864c279f8b1028e958a5bad72c25c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 12 May 2016 09:29:55 -0400 Subject: [PATCH] lib/json: document how to refine `accept_json_serializer` and make it protected MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/json/serialization.nit | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/json/serialization.nit b/lib/json/serialization.nit index c14c734..65d5cbf 100644 --- a/lib/json/serialization.nit +++ b/lib/json/serialization.nit @@ -533,7 +533,15 @@ redef class Serializable return stream.to_s end - private fun accept_json_serializer(v: JsonSerializer) + # Refinable service to customize the serialization of this class to JSON + # + # This method can be refined to customize the serialization by either + # writing pure JSON directly on the stream `v.stream` or + # by using other services of `JsonSerializer`. + # + # Most of the time, it is preferable to refine the method `core_serialize_to` + # which is used by all the serialization engines, not just JSON. + protected fun accept_json_serializer(v: JsonSerializer) do var id = v.cache.new_id_for(self) v.stream.write "\{" -- 1.7.9.5