Class DefaultRouteInfo<R>

java.lang.Object
io.micronaut.web.router.DefaultRouteInfo<R>
Type Parameters:
R - The result type
All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, RouteInfo<R>
Direct Known Subclasses:
DefaultRequestMatcher

@Internal public class DefaultRouteInfo<R> extends Object implements RouteInfo<R>
The default route info implementation.
Since:
4.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final io.micronaut.core.annotation.AnnotationMetadata
     
    protected final List<io.micronaut.http.MediaType>
     
    protected final boolean
     
    protected final Class<?>
     
    protected final @Nullable io.micronaut.http.HttpStatus
     
    protected final boolean
     
    protected final List<io.micronaut.http.MediaType>
     
    protected final boolean
     
    protected final io.micronaut.core.type.ReturnType<? extends R>
     

    Fields inherited from interface io.micronaut.core.annotation.AnnotationSource

    EMPTY

    Fields inherited from interface io.micronaut.web.router.RouteInfo

    DEFAULT_PRODUCES
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultRouteInfo(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, io.micronaut.core.type.ReturnType<? extends R> returnType, List<io.micronaut.http.MediaType> consumesMediaTypes, List<io.micronaut.http.MediaType> producesMediaTypes, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody, io.micronaut.http.body.MessageBodyHandlerRegistry messageBodyHandlerRegistry)
     
    DefaultRouteInfo(io.micronaut.core.type.ReturnType<? extends R> returnType, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether this is consuming any content type.
    boolean
    doesConsume(io.micronaut.http.MediaType contentType)
    Whether the specified content type is an accepted type.
    boolean
    doesProduce(@Nullable io.micronaut.http.MediaType acceptableType)
    Whether the route does produce any of the given types.
    boolean
    doesProduce(@Nullable Collection<io.micronaut.http.MediaType> acceptableTypes)
    Whether the route does produce any of the given types.
    boolean
    explicitlyConsumes(io.micronaut.http.MediaType contentType)
    Whether the specified content type is explicitly an accepted type.
    boolean
    explicitlyProduces(io.micronaut.http.MediaType contentType)
    Whether the specified content type is explicitly a producing type.
    @NonNull io.micronaut.http.HttpStatus
    findStatus(io.micronaut.http.HttpStatus defaultStatus)
    Finds predefined route http status or uses default.
    @NonNull io.micronaut.core.annotation.AnnotationMetadata
     
    List<io.micronaut.http.MediaType>
    The media types able to produced by this route.
     
    getExecutor(io.micronaut.scheduling.executor.ThreadSelection threadSelection)
     
    io.micronaut.http.body.MessageBodyWriter<R>
     
    List<io.micronaut.http.MediaType>
    The media types able to produced by this route.
    Optional<io.micronaut.core.type.Argument<?>>
     
    @NonNull io.micronaut.core.type.Argument<?>
     
    io.micronaut.core.type.ReturnType<? extends R>
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    Is this route recognized as imperative.
    boolean
    Whether the route permits a request body.
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    Checks if route is for web socket.
    boolean
     
    boolean
    Whether this is producing any content type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider

    findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType

    Methods inherited from interface io.micronaut.core.annotation.AnnotationSource

    getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
  • Field Details

    • returnType

      protected final io.micronaut.core.type.ReturnType<? extends R> returnType
    • consumesMediaTypes

      protected final List<io.micronaut.http.MediaType> consumesMediaTypes
    • producesMediaTypes

      protected final List<io.micronaut.http.MediaType> producesMediaTypes
    • annotationMetadata

      protected final io.micronaut.core.annotation.AnnotationMetadata annotationMetadata
    • declaringType

      protected final Class<?> declaringType
    • consumesMediaTypesContainsAll

      protected final boolean consumesMediaTypesContainsAll
    • producesMediaTypesContainsAll

      protected final boolean producesMediaTypesContainsAll
    • definedStatus

      @Nullable protected final @Nullable io.micronaut.http.HttpStatus definedStatus
    • isWebSocketRoute

      protected final boolean isWebSocketRoute
  • Constructor Details

    • DefaultRouteInfo

      public DefaultRouteInfo(io.micronaut.core.type.ReturnType<? extends R> returnType, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody)
    • DefaultRouteInfo

      public DefaultRouteInfo(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, io.micronaut.core.type.ReturnType<? extends R> returnType, List<io.micronaut.http.MediaType> consumesMediaTypes, List<io.micronaut.http.MediaType> producesMediaTypes, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody, io.micronaut.http.body.MessageBodyHandlerRegistry messageBodyHandlerRegistry)
  • Method Details

    • getMessageBodyWriter

      public io.micronaut.http.body.MessageBodyWriter<R> getMessageBodyWriter()
      Specified by:
      getMessageBodyWriter in interface RouteInfo<R>
      Returns:
      The message body writer, if any.
    • getRequestBodyType

      public Optional<io.micronaut.core.type.Argument<?>> getRequestBodyType()
      Specified by:
      getRequestBodyType in interface RouteInfo<R>
      Returns:
      The argument that represents the body of the request
    • getReturnType

      public io.micronaut.core.type.ReturnType<? extends R> getReturnType()
      Specified by:
      getReturnType in interface RouteInfo<R>
      Returns:
      The return type
    • getResponseBodyType

      @NonNull public @NonNull io.micronaut.core.type.Argument<?> getResponseBodyType()
      Specified by:
      getResponseBodyType in interface RouteInfo<R>
      Returns:
      The argument representing the data type being produced.
    • getDeclaringType

      public Class<?> getDeclaringType()
      Specified by:
      getDeclaringType in interface RouteInfo<R>
      Returns:
      The declaring type of the route.
    • getProduces

      public List<io.micronaut.http.MediaType> getProduces()
      Description copied from interface: RouteInfo
      The media types able to produced by this route.
      Specified by:
      getProduces in interface RouteInfo<R>
      Returns:
      A list of MediaType that this route can produce
    • getConsumes

      public List<io.micronaut.http.MediaType> getConsumes()
      Description copied from interface: RouteInfo
      The media types able to produced by this route.
      Specified by:
      getConsumes in interface RouteInfo<R>
      Returns:
      A list of MediaType that this route can produce
    • consumesAll

      public boolean consumesAll()
      Description copied from interface: RouteInfo
      Whether this is consuming any content type.
      Specified by:
      consumesAll in interface RouteInfo<R>
      Returns:
      True if it is
    • doesConsume

      public boolean doesConsume(io.micronaut.http.MediaType contentType)
      Description copied from interface: RouteInfo
      Whether the specified content type is an accepted type.
      Specified by:
      doesConsume in interface RouteInfo<R>
      Parameters:
      contentType - The content type
      Returns:
      True if it is
    • producesAll

      public boolean producesAll()
      Description copied from interface: RouteInfo
      Whether this is producing any content type.
      Specified by:
      producesAll in interface RouteInfo<R>
      Returns:
      True if it is
    • doesProduce

      public boolean doesProduce(@Nullable @Nullable Collection<io.micronaut.http.MediaType> acceptableTypes)
      Description copied from interface: RouteInfo
      Whether the route does produce any of the given types.
      Specified by:
      doesProduce in interface RouteInfo<R>
      Parameters:
      acceptableTypes - The acceptable types
      Returns:
      True if it is
    • doesProduce

      public boolean doesProduce(@Nullable @Nullable io.micronaut.http.MediaType acceptableType)
      Description copied from interface: RouteInfo
      Whether the route does produce any of the given types.
      Specified by:
      doesProduce in interface RouteInfo<R>
      Parameters:
      acceptableType - The acceptable type
      Returns:
      True if it is
    • explicitlyConsumes

      public boolean explicitlyConsumes(io.micronaut.http.MediaType contentType)
      Description copied from interface: RouteInfo
      Whether the specified content type is explicitly an accepted type.
      Specified by:
      explicitlyConsumes in interface RouteInfo<R>
      Parameters:
      contentType - The content type
      Returns:
      True if it is
    • explicitlyProduces

      public boolean explicitlyProduces(io.micronaut.http.MediaType contentType)
      Description copied from interface: RouteInfo
      Whether the specified content type is explicitly a producing type.
      Specified by:
      explicitlyProduces in interface RouteInfo<R>
      Parameters:
      contentType - The content type
      Returns:
      True if it is
    • isSuspended

      public boolean isSuspended()
      Specified by:
      isSuspended in interface RouteInfo<R>
      Returns:
      Is this route match a suspended function (Kotlin).
    • isImperative

      public boolean isImperative()
      Description copied from interface: RouteInfo
      Is this route recognized as imperative.
      Specified by:
      isImperative in interface RouteInfo<R>
      Returns:
      Is this route recognized as imperative.
    • isReactive

      public boolean isReactive()
      Specified by:
      isReactive in interface RouteInfo<R>
      Returns:
      Is the route a reactive route.
    • isSingleResult

      public boolean isSingleResult()
      Specified by:
      isSingleResult in interface RouteInfo<R>
      Returns:
      Does the route emit a single result or multiple results
    • isSpecifiedSingle

      public boolean isSpecifiedSingle()
      Specified by:
      isSpecifiedSingle in interface RouteInfo<R>
      Returns:
      Does the route emit a single result or multiple results
    • isCompletable

      public boolean isCompletable()
      Specified by:
      isCompletable in interface RouteInfo<R>
      Returns:
      is the return type completable
    • isAsync

      public boolean isAsync()
      Specified by:
      isAsync in interface RouteInfo<R>
      Returns:
      Is the route an async route.
    • isAsyncOrReactive

      public boolean isAsyncOrReactive()
      Specified by:
      isAsyncOrReactive in interface RouteInfo<R>
      Returns:
      Is the route an async or reactive route.
    • isVoid

      public boolean isVoid()
      Specified by:
      isVoid in interface RouteInfo<R>
      Returns:
      Does the route return void
    • findStatus

      @NonNull public @NonNull io.micronaut.http.HttpStatus findStatus(io.micronaut.http.HttpStatus defaultStatus)
      Description copied from interface: RouteInfo
      Finds predefined route http status or uses default.
      Specified by:
      findStatus in interface RouteInfo<R>
      Parameters:
      defaultStatus - The default status
      Returns:
      The status
    • isErrorRoute

      public boolean isErrorRoute()
      Specified by:
      isErrorRoute in interface RouteInfo<R>
      Returns:
      True if the route was called due to an error
    • isWebSocketRoute

      public boolean isWebSocketRoute()
      Description copied from interface: RouteInfo
      Checks if route is for web socket.
      Specified by:
      isWebSocketRoute in interface RouteInfo<R>
      Returns:
      true if it's web socket route
    • isPermitsRequestBody

      public boolean isPermitsRequestBody()
      Description copied from interface: RouteInfo
      Whether the route permits a request body.
      Specified by:
      isPermitsRequestBody in interface RouteInfo<R>
      Returns:
      True if the route permits a request body
    • getExecutor

      public ExecutorService getExecutor(io.micronaut.scheduling.executor.ThreadSelection threadSelection)
      Specified by:
      getExecutor in interface RouteInfo<R>
      Parameters:
      threadSelection - The thread selection
      Returns:
      The route executor
    • getAnnotationMetadata

      @NonNull public @NonNull io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
      Specified by:
      getAnnotationMetadata in interface io.micronaut.core.annotation.AnnotationMetadataProvider
    • needsRequestBody

      public boolean needsRequestBody()
      Specified by:
      needsRequestBody in interface RouteInfo<R>
      Returns:
      true if the route needs request body to be read