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

com.github.rmannibucau.featuredmock.mock.unmarshaller.jackson.JacksonUnmarshaller Maven / Gradle / Ivy

There is a newer version: 0.4
Show newest version
package com.github.rmannibucau.featuredmock.mock.unmarshaller.jackson;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.rmannibucau.featuredmock.mock.unmarshaller.Unmarshaller;

import java.io.IOException;
import java.io.InputStream;

public class JacksonUnmarshaller implements Unmarshaller {
    private static final ObjectMapper MAPPER = new ObjectMapper()
                                                .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    @Override
    public  T unmarshall(final Class clazz, final InputStream is) throws IOException {
        return MAPPER.readValue(is, clazz);
    }

    @Override
    public boolean accept(final String extension) {
        return ".json".equals(extension);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy