Example usage for java.lang.reflect GenericArrayType GenericArrayType

List of usage examples for java.lang.reflect GenericArrayType GenericArrayType

Introduction

In this page you can find the example usage for java.lang.reflect GenericArrayType GenericArrayType.

Prototype

GenericArrayType

Source Link

Usage

From source file:capital.scalable.restdocs.payload.JacksonResponseFieldSnippet.java

@Override
protected Type getType(final HandlerMethod method) {
    Class<?> returnType = method.getReturnType().getParameterType();
    if (returnType == ResponseEntity.class) {
        return firstGenericType(method.getReturnType());
    } else if (returnType == Page.class) {
        return firstGenericType(method.getReturnType());
    } else if (isCollection(returnType)) {
        return new GenericArrayType() {

            @Override/*  w  w  w . j a va2 s .  c  o  m*/
            public Type getGenericComponentType() {
                return firstGenericType(method.getReturnType());
            }
        };
    } else if ("void".equals(returnType.getName())) {
        return null;
    } else {
        return returnType;
    }
}

From source file:capital.scalable.restdocs.payload.JacksonRequestFieldSnippet.java

private Type getType(final MethodParameter param) {
    if (isCollection(param.getParameterType())) {
        return new GenericArrayType() {

            @Override//from  w ww .j a v a2 s  .  c om
            public Type getGenericComponentType() {
                return firstGenericType(param);
            }
        };
    } else {
        return param.getParameterType();
    }
}