package io.ebeaninternal.server.deploy.meta;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.AnnotatedClassResolver;
import io.ebean.config.ServerConfig;
class DeployBeanObtainJackson<T> {
private final ServerConfig serverConfig;
private final Class<T> beanType;
DeployBeanObtainJackson(ServerConfig serverConfig, Class<T> beanType) {
this.serverConfig = serverConfig;
this.beanType = beanType;
}
Object obtain() {
ObjectMapper objectMapper = (ObjectMapper) serverConfig.getObjectMapper();
JavaType javaType = objectMapper.getTypeFactory().constructType(beanType);
return AnnotatedClassResolver.resolve(objectMapper.getDeserializationConfig(), javaType, objectMapper.getDeserializationConfig());
}
}