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

com.github.restup.test.serializer.AutoDetectConstants Maven / Gradle / Ivy

package com.github.restup.test.serializer;

public class AutoDetectConstants {

    public static final boolean JACKSON2_EXISTS =
            classesExist("com.fasterxml.jackson.databind.ObjectMapper",
                    "com.fasterxml.jackson.core.JsonGenerator");

    public static final boolean GSON_EXISTS =
            classesExist("com.google.gson.Gson");

    private AutoDetectConstants() {

    }

    static boolean classesExist(String... classes) {
        try {
            for (String clazz : classes) {
                AutoDetectConstants.class.getClassLoader().loadClass(clazz);
            }
        } catch (Throwable e) {
            return false;
        }
        return true;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy