mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-22 05:02:10 +00:00
Extract ebean-jackson-mapper module - rename DeployBeanObtainJackson -> AnnotatedClassUtil and convert to static method
This commit is contained in:
+2
-10
@@ -8,20 +8,12 @@ import com.fasterxml.jackson.databind.introspect.AnnotatedClassResolver;
|
||||
/**
|
||||
* Used to obtain the Jackson AnnotatedClass for a given bean type utlimately to obtain field level Jackson annotations.
|
||||
*/
|
||||
final class DeployBeanObtainJackson<T> {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
private final Class<T> beanType;
|
||||
|
||||
DeployBeanObtainJackson(ObjectMapper objectMapper, Class<T> beanType) {
|
||||
this.objectMapper = objectMapper;
|
||||
this.beanType = beanType;
|
||||
}
|
||||
final class AnnotatedClassUtil {
|
||||
|
||||
/**
|
||||
* Return the Jackson AnnotatedClass for the given bean type.
|
||||
*/
|
||||
AnnotatedClass obtain() {
|
||||
static AnnotatedClass obtain(ObjectMapper objectMapper, Class<?> beanType) {
|
||||
JavaType javaType = objectMapper.getTypeFactory().constructType(beanType);
|
||||
return AnnotatedClassResolver.resolve(objectMapper.getDeserializationConfig(), javaType, objectMapper.getDeserializationConfig());
|
||||
}
|
||||
+1
-1
@@ -54,7 +54,7 @@ public final class ScalarJsonJacksonMapper implements ScalarJsonMapper {
|
||||
private AnnotatedClass annotatedClass(ScalarJsonRequest req) {
|
||||
return jacksonClasses.computeIfAbsent(req.beanType(), key -> {
|
||||
ObjectMapper mapper = (ObjectMapper) req.manager().mapper();
|
||||
return new DeployBeanObtainJackson(mapper, req.beanType()).obtain();
|
||||
return AnnotatedClassUtil.obtain(mapper, req.beanType());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import io.ebean.jackson.mapper.ScalarJsonJacksonMapper;
|
||||
|
||||
module io.ebean.jackson.mapper {
|
||||
|
||||
requires io.ebean.core.type;
|
||||
requires com.fasterxml.jackson.core;
|
||||
requires com.fasterxml.jackson.databind;
|
||||
|
||||
Reference in New Issue
Block a user