rs.jerseyclient.util.ObjectMapperProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jersey-client Show documentation
Show all versions of jersey-client Show documentation
Basic implementation to create RS WS clients with Jersey
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;
}
}