Example usage for com.fasterxml.jackson.databind.introspect BeanPropertyDefinition getField

List of usage examples for com.fasterxml.jackson.databind.introspect BeanPropertyDefinition getField

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.introspect BeanPropertyDefinition getField.

Prototype

public abstract AnnotatedField getField();

Source Link

Usage

From source file:org.midonet.cluster.rest_api.serialization.MidonetObjectMapper.java

static JsonError getError(DeserializationConfig config, JavaType valueType, String fieldName) {
    try {/* ww w .ja  v  a  2  s . c o  m*/
        BasicBeanDescription beanDesc = config.introspect(valueType);
        for (BeanPropertyDefinition property : beanDesc.findProperties()) {
            if (property.getName().equals(fieldName) && null != property.getField()
                    && null != property.getField().getAnnotated()) {
                return property.getField().getAnnotated().getAnnotation(JsonError.class);
            }
        }
        return null;
    } catch (Exception e) {
        return null;
    }
}