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

com.lyncode.jtwig.functions.json.mapper.JacksonFasterXmlJsonMapper Maven / Gradle / Ivy

The newest version!
package com.lyncode.jtwig.functions.json.mapper;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Function;
import com.lyncode.jtwig.functions.json.JsonMappingException;

import javax.annotation.Nullable;
import java.io.IOException;

public class JacksonFasterXmlJsonMapper implements Function {
    private static ObjectMapper mapper = new ObjectMapper();

    @Nullable
    @Override
    public String apply(@Nullable Object input) {
        try {
            return mapper.writeValueAsString(input);
        } catch (IOException e) {
            throw new JsonMappingException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy