@@ -0,0 +1,2884 @@
+package org.febit.lang.util.jackson;%0A%0Aimport com.fasterxml.jackson.databind.JavaType;%0Aimport com.fasterxml.jackson.databind.cfg.MapperConfig;%0Aimport com.fasterxml.jackson.databind.introspect.AnnotatedClass;%0Aimport com.fasterxml.jackson.databind.introspect.AnnotatedMember;%0Aimport com.fasterxml.jackson.databind.jsontype.NamedType;%0Aimport com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver;%0Aimport lombok.Builder;%0Aimport lombok.RequiredArgsConstructor;%0Aimport lombok.Singular;%0Aimport lombok.val;%0A%0Aimport javax.annotation.Nullable;%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A@Builder(builderClassName = %22Builder%22)%0A@RequiredArgsConstructor%0Apublic class CustomSubtypeResolver extends StdSubtypeResolver %7B%0A%0A    @Singular(%22registerCustomSubtypes%22)%0A    private final Map%3CClass%3C?%3E, List%3CNamedType%3E%3E subtypesMapping;%0A%0A    @Nullable%0A    protected Collection%3CNamedType%3E copySubtypesIfPresent(Class%3C?%3E forType) %7B%0A        val subtypes = this.subtypesMapping.get(forType);%0A        if (subtypes != null) %7B%0A            return new ArrayList%3C%3E(subtypes);%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    public Collection%3CNamedType%3E collectAndResolveSubtypesByClass(%0A            MapperConfig%3C?%3E config, AnnotatedMember property, JavaType baseType) %7B%0A        Class%3C?%3E rawBase = baseType == null%0A                ? property.getRawType()%0A                : baseType.getRawClass();%0A        val subtypes = copySubtypesIfPresent(rawBase);%0A        if (subtypes != null) %7B%0A            return subtypes;%0A        %7D%0A        return super.collectAndResolveSubtypesByClass(config, property, baseType);%0A    %7D%0A%0A    @Override%0A    public Collection%3CNamedType%3E collectAndResolveSubtypesByClass(%0A            MapperConfig%3C?%3E config, AnnotatedClass type) %7B%0A        Class%3C?%3E rawBase = type.getRawType();%0A        val subtypes = copySubtypesIfPresent(rawBase);%0A        if (subtypes != null) %7B%0A            return subtypes;%0A        %7D%0A        return super.collectAndResolveSubtypesByClass(config, type);%0A    %7D%0A%0A    @Override%0A    public Collection%3CNamedType%3E collectAndResolveSubtypesByTypeId(%0A            MapperConfig%3C?%3E config, AnnotatedMember property, JavaType baseType) %7B%0A        Class%3C?%3E rawBase = baseType.getRawClass();%0A        val subtypes = copySubtypesIfPresent(rawBase);%0A        if (subtypes != null) %7B%0A            return subtypes;%0A        %7D%0A        return super.collectAndResolveSubtypesByTypeId(config, property, baseType);%0A    %7D%0A%0A    @Override%0A    public Collection%3CNamedType%3E collectAndResolveSubtypesByTypeId(%0A            MapperConfig%3C?%3E config, AnnotatedClass baseType) %7B%0A        final Class%3C?%3E rawBase = baseType.getRawType();%0A        val subtypes = copySubtypesIfPresent(rawBase);%0A        if (subtypes != null) %7B%0A            return subtypes;%0A        %7D%0A        return super.collectAndResolveSubtypesByTypeId(config, baseType);%0A    %7D%0A%7D%0A

add CustomSubtypeResolver