MCPcopy Create free account
hub / github.com/apache/fory / register_serializer

Method register_serializer

python/pyfory/_fory.py:355–370  ·  view source on GitHub ↗

Register a custom serializer for a type. Allows you to provide a custom serializer implementation for a specific type, overriding Fory's default serialization behavior. Args: cls: The Python type to associate with the serializer serializer:

(self, cls: type, serializer)

Source from the content-addressed store, hash-verified

353 )
354
355 def register_serializer(self, cls: type, serializer):
356 """
357 Register a custom serializer for a type.
358
359 Allows you to provide a custom serializer implementation for a specific type,
360 overriding Fory's default serialization behavior.
361
362 Args:
363 cls: The Python type to associate with the serializer
364 serializer: Custom serializer instance implementing the Serializer protocol
365
366 Example:
367 >>> fory = Fory(xlang=False)
368 >>> fory.register_serializer(MyClass, MyCustomSerializer())
369 """
370 self.type_resolver.register_serializer(cls, serializer)
371
372 def dumps(
373 self,

Callers 1

register_serializerMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected