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

com.nhl.link.rest.client.runtime.jackson.JsonEntityReaderFactory Maven / Gradle / Ivy

There is a newer version: 2.13
Show newest version
package com.nhl.link.rest.client.runtime.jackson;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.databind.JsonNode;

/**
 * @since 2.0
 */
public class JsonEntityReaderFactory implements IJsonEntityReaderFactory {

	private Map, IJsonEntityReader> readerMap;

	public JsonEntityReaderFactory() {
		readerMap = new HashMap<>();
		readerMap.put(JsonNode.class, new JsonEntityReader());
	}

	@SuppressWarnings("unchecked")
	@Override
	public  IJsonEntityReader getReaderForType(Class targetType) {

		if (targetType == null) {
			throw new NullPointerException("Target type");
		}
		return (IJsonEntityReader) readerMap.get(targetType);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy