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

io.quarkus.pulsar.schema.ObjectMapperProducer Maven / Gradle / Ivy

There is a newer version: 3.15.0
Show newest version
package io.quarkus.pulsar.schema;

import com.fasterxml.jackson.databind.ObjectMapper;

import io.quarkus.arc.Arc;
import io.quarkus.arc.ArcContainer;

final class ObjectMapperProducer {

    private ObjectMapperProducer() {
    }

    // Try to get the ObjectMapper from Arc but fallback to regular ObjectMapper creation
    // The fallback could be used for example in unit tests where Arc has not been initialized
    static ObjectMapper get() {
        ObjectMapper objectMapper = null;
        ArcContainer container = Arc.container();
        if (container != null) {
            objectMapper = container.instance(ObjectMapper.class).get();
        }
        return objectMapper != null ? objectMapper : new ObjectMapper();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy