Serializer.overrideSerializer

Overrides a globally registered serializer for the given type with a serializer local to the receiver.

The receiver will first check if a local serializer is registered, otherwise a global serializer will be used (if available).

  1. void overrideSerializer(void delegate(Base, Serializer, Data) dg)
  2. void overrideSerializer(void function(Base, Serializer, Data) func)
    class Serializer
    void
    overrideSerializer
    (
    Derived
    Base
    )
    (
    void function func
    )

Examples

class Base {}
class Foo : Base {}

auto archive = new XmlArchive!();
auto serializer = new Serializer(archive);

void func (Base value, Serializer serializer, Data key) {
	// perform serialization
}

Serializer.registerSerializer!(Foo)(&func);

void overrideFunc (Base value, Serializer serializer, Data key) {
	// this will override the above serializer
}

serializer.overrideSerializer!(Foo)(&overrideFunc);

Meta