List of usage examples for com.fasterxml.jackson.databind SerializationConfig introspect
public <T extends BeanDescription> T introspect(JavaType paramJavaType)
From source file:springfox.documentation.schema.property.bean.BeanModelPropertyProvider.java
private BeanDescription beanDescription(ResolvedType type, ModelContext context) { if (context.isReturnType()) { SerializationConfig serializationConfig = objectMapper.getSerializationConfig(); return serializationConfig .introspect(TypeFactory.defaultInstance().constructType(type.getErasedType())); } else {/*from ww w . j a v a 2 s . c om*/ DeserializationConfig serializationConfig = objectMapper.getDeserializationConfig(); return serializationConfig .introspect(TypeFactory.defaultInstance().constructType(type.getErasedType())); } }
From source file:org.springframework.data.rest.webmvc.json.JacksonMetadata.java
/** * Creates a new {@link JacksonMetadata} instance for the given {@link ObjectMapper} and type. * /* w w w. jav a 2 s.c o m*/ * @param mapper must not be {@literal null}. * @param type must not be {@literal null}. */ public JacksonMetadata(ObjectMapper mapper, Class<?> type) { Assert.notNull(mapper, "ObjectMapper must not be null!"); Assert.notNull(type, "Type must not be null!"); this.mapper = mapper; SerializationConfig serializationConfig = mapper.getSerializationConfig(); JavaType javaType = serializationConfig.constructType(type); BeanDescription description = serializationConfig.introspect(javaType); this.definitions = description.findProperties(); this.isValue = description.findJsonValueMethod() != null; DeserializationConfig deserializationConfig = mapper.getDeserializationConfig(); JavaType deserializationType = deserializationConfig.constructType(type); this.deserializationDefinitions = deserializationConfig.introspect(deserializationType).findProperties(); }