All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.module.afterburner.ser.SerializerUtil Maven / Gradle / Ivy

Go to download

Jackson (https://github.com/FasterXML/jackson) extension module used to enhance performance using bytecode generation to replace use of Reflection for field access and method calls

There is a newer version: 2.18.1
Show newest version
package com.fasterxml.jackson.module.afterburner.ser;

import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.databind.util.ClassUtil;

/**
 * Helper class that contains utility methods needed by various other classes
 * in this package.
 *
 * @since 2.12
 */
class SerializerUtil
{
    /**
     * Helper method used to check whether given serializer is the default
     * serializer implementation: this is necessary to avoid overriding other
     * kinds of serializers.
     */
    public static boolean isDefaultSerializer(JsonSerializer ser)
    {
        if (ser == null) {
            return true;
        }
        if (ClassUtil.isJacksonStdImpl(ser)) {
            // 20-Nov-2020, tatu: As per [modules-base#117], need to consider
            //   one standard serializer that should not be replaced...
            if (ser instanceof ToStringSerializer) {
                return false;
            }
            return true;
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy