Interface ReturnTypeParser


  • public interface ReturnTypeParser
    The interface Return type parser.
    Author:
    bnasslahsen
    • Method Summary

      All Methods Static Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      static void findTypeForGenerics​(Class<?>[] generics, Type[] typeArguments, org.springframework.core.ResolvableType contextType)
      Find type for generics.
      static org.springframework.core.ResolvableType getResolvedType​(org.springframework.core.ResolvableType resolvableType, Class<?> contextClass)
      Gets resolved type.
      default Type getReturnType​(org.springframework.core.MethodParameter methodParameter)
      Gets return type.
      static Type getType​(org.springframework.core.MethodParameter methodParameter)
      Gets type.
      static Type resolveType​(Type genericType, Class<?> contextClass)
      This is a copy of GenericTypeResolver.resolveType which is not available on spring 4.
      static void resolveType​(org.springframework.core.ResolvableType[] resolvableTypes, Class<?> contextClass)
      Resolve type.
      static org.springframework.core.ResolvableType resolveVariable​(TypeVariable<?> typeVariable, org.springframework.core.ResolvableType contextType)
      Resolve variable resolvable type.
    • Method Detail

      • resolveType

        static Type resolveType​(Type genericType,
                                @Nullable
                                Class<?> contextClass)
        This is a copy of GenericTypeResolver.resolveType which is not available on spring 4. This also keeps compatibility with spring-boot 1 applications. Resolve the given generic type against the given context class, substituting type variables as far as possible.
        Parameters:
        genericType - the (potentially) generic type
        contextClass - a context class for the target type, for example a class in which the target type appears in a method signature (can be null)
        Returns:
        the resolved type (possibly the given generic type as-is)
        Since:
        5.0
      • resolveType

        static void resolveType​(org.springframework.core.ResolvableType[] resolvableTypes,
                                Class<?> contextClass)
        Resolve type.
        Parameters:
        resolvableTypes - the resolvable types
        contextClass - the context class
      • getResolvedType

        static org.springframework.core.ResolvableType getResolvedType​(org.springframework.core.ResolvableType resolvableType,
                                                                       Class<?> contextClass)
        Gets resolved type.
        Parameters:
        resolvableType - the resolvable type
        contextClass - the context class
        Returns:
        the resolved type
      • findTypeForGenerics

        static void findTypeForGenerics​(Class<?>[] generics,
                                        Type[] typeArguments,
                                        org.springframework.core.ResolvableType contextType)
        Find type for generics.
        Parameters:
        generics - the generics
        typeArguments - the type arguments
        contextType - the context type
      • resolveVariable

        static org.springframework.core.ResolvableType resolveVariable​(TypeVariable<?> typeVariable,
                                                                       org.springframework.core.ResolvableType contextType)
        Resolve variable resolvable type.
        Parameters:
        typeVariable - the type variable
        contextType - the context type
        Returns:
        the resolvable type
      • getReturnType

        default Type getReturnType​(org.springframework.core.MethodParameter methodParameter)
        Gets return type.
        Parameters:
        methodParameter - the method parameter
        Returns:
        the return type
      • getType

        static Type getType​(org.springframework.core.MethodParameter methodParameter)
        Gets type.
        Parameters:
        methodParameter - the method parameter
        Returns:
        the type