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

rs.jerseyclient.util.ObjectMapperProvider Maven / Gradle / Ivy

The newest version!
package rs.jerseyclient.util;

import jakarta.ws.rs.ext.ContextResolver;
import jakarta.ws.rs.ext.Provider;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Provides a custom {@link ObjectMapper}.
 * 
 * @author ralph
 *
 */
@Provider
public class ObjectMapperProvider implements ContextResolver {

	private static ObjectMapper mapper;

	/**
	 * Sets the {@link ObjectMapper} object.
	 * 
	 * @param mapper the mapper to provide
	 */
	public static void setMapper(ObjectMapper mapper) {
		ObjectMapperProvider.mapper = mapper;
	}

	@Override
	public ObjectMapper getContext(Class type) {
		return mapper;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy