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

org.seekay.contract.model.tools.PrintTools Maven / Gradle / Ivy

The newest version!
package org.seekay.contract.model.tools;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class PrintTools {

    /**
     * Private constructor for utility class
     */
    private PrintTools() {
        throw new IllegalStateException("Utility classes should never be constructed");
    }

    public static String prettyPrint(Object object, ObjectMapper objectMapper) {
        try {
            return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
        } catch (JsonProcessingException e) {
            throw new IllegalStateException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy