Example usage for com.fasterxml.jackson.databind BeanDescription findJsonValueMethod

List of usage examples for com.fasterxml.jackson.databind BeanDescription findJsonValueMethod


In this page you can find the example usage for com.fasterxml.jackson.databind BeanDescription findJsonValueMethod.


public abstract AnnotatedMethod findJsonValueMethod();

Source Link


From source file:org.springframework.data.rest.webmvc.json.JacksonMetadata.java

 * Creates a new {@link JacksonMetadata} instance for the given {@link ObjectMapper} and type.
 * //from   www.  j  a v  a2s  . 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();