Example usage for com.fasterxml.jackson.databind.introspect AnnotatedField getGenericType

List of usage examples for com.fasterxml.jackson.databind.introspect AnnotatedField getGenericType

Introduction

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

Prototype

public Type getGenericType() 

Source Link

Usage

From source file:com.google.api.server.spi.config.jsonwriter.JacksonResourceSchemaProvider.java

@Nullable
private TypeToken<?> getPropertyType(TypeToken<?> beanType, Method readMethod, Method writeMethod,
        AnnotatedField field, ApiConfig config) {
    if (readMethod != null) {
        // read method's return type is the property type
        return ApiAnnotationIntrospector.getSchemaType(beanType.resolveType(readMethod.getGenericReturnType()),
                config);//from w  w  w  .j  ava  2  s.c  o  m
    } else if (writeMethod != null) {
        Type[] paramTypes = writeMethod.getGenericParameterTypes();
        if (paramTypes.length == 1) {
            // write method's first parameter type is the property type
            return ApiAnnotationIntrospector.getSchemaType(beanType.resolveType(paramTypes[0]), config);
        }
    } else if (field != null) {
        return ApiAnnotationIntrospector.getSchemaType(beanType.resolveType(field.getGenericType()), config);
    }
    return null;
}