Class DefaultRouteInfo<R>

java.lang.Object
io.micronaut.web.router.DefaultRouteInfo<R>
Type Parameters:
R - The result type
All Implemented Interfaces:
AnnotationMetadataProvider, 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
Author:
Denis Stepanov
  • Field Details

    • returnType

      protected final ReturnType<? extends R> returnType
    • consumesMediaTypes

      protected final List<MediaType> consumesMediaTypes
    • producesMediaTypes

      protected final List<MediaType> producesMediaTypes
    • annotationMetadata

      protected final AnnotationMetadata annotationMetadata
    • declaringType

      protected final Class<?> declaringType
    • consumesMediaTypesContainsAll

      protected final boolean consumesMediaTypesContainsAll
    • producesMediaTypesContainsAll

      protected final boolean producesMediaTypesContainsAll
    • definedStatus

      @Nullable protected final @Nullable HttpStatus definedStatus
    • isWebSocketRoute

      protected final boolean isWebSocketRoute
  • Constructor Details

  • Method Details

    • getMessageBodyWriter

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

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

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

      public 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<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<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(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<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 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(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(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

      public HttpStatus findStatus(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(ThreadSelection threadSelection)
      Specified by:
      getExecutor in interface RouteInfo<R>
      Parameters:
      threadSelection - The thread selection
      Returns:
      The route executor
    • getAnnotationMetadata

      public AnnotationMetadata getAnnotationMetadata()
      Description copied from interface: AnnotationMetadataProvider
      Supplies the metadata. Defaults to AnnotationMetadata.EMPTY_METADATA.
      Specified by:
      getAnnotationMetadata in interface AnnotationMetadataProvider
      Returns:
      The AnnotationMetadata
    • needsRequestBody

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