Class DefaultStatusRouteInfo<T,R>

Type Parameters:
T - The target
R - The result
All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, MethodBasedRouteInfo<T,R>, RequestMatcher, RouteInfo<R>, StatusRouteInfo<T,R>

@Internal public final class DefaultStatusRouteInfo<T,R> extends DefaultRequestMatcher<T,R> implements StatusRouteInfo<T,R>
The default StatusRouteInfo implementation.
Since:
4.0.0
  • Constructor Details

    • DefaultStatusRouteInfo

      public DefaultStatusRouteInfo(Class<?> originatingType, int statusCode, io.micronaut.inject.MethodExecutionHandle<T,R> targetMethod, @Nullable @Nullable String bodyArgumentName, @Nullable @Nullable io.micronaut.core.type.Argument<?> bodyArgument, List<io.micronaut.http.MediaType> consumesMediaTypes, List<io.micronaut.http.MediaType> producesMediaTypes, List<Predicate<io.micronaut.http.HttpRequest<?>>> predicates, io.micronaut.core.convert.ConversionService conversionService, io.micronaut.http.body.MessageBodyHandlerRegistry messageBodyHandlerRegistry)
  • Method Details

    • originatingType

      public Class<?> originatingType()
      Specified by:
      originatingType in interface StatusRouteInfo<T,R>
      Returns:
      The type the exception originates from. Null if the error route is global.
    • status

      public io.micronaut.http.HttpStatus status()
      Specified by:
      status in interface StatusRouteInfo<T,R>
      Returns:
      The status
    • statusCode

      public int statusCode()
      Specified by:
      statusCode in interface StatusRouteInfo<T,R>
      Returns:
      The status
    • findStatus

      public 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<T>
      Overrides:
      findStatus in class DefaultRouteInfo<R>
      Parameters:
      defaultStatus - The default status
      Returns:
      The status
    • match

      public Optional<RouteMatch<R>> match(Class<?> originatingClass, io.micronaut.http.HttpStatus status)
      Description copied from interface: StatusRouteInfo
      Match the given HTTP status.
      Specified by:
      match in interface StatusRouteInfo<T,R>
      Parameters:
      originatingClass - The class where the error originates from
      status - The status to match
      Returns:
      The route match
    • match

      public Optional<RouteMatch<R>> match(io.micronaut.http.HttpStatus status)
      Description copied from interface: StatusRouteInfo
      Match the given HTTP status.
      Specified by:
      match in interface StatusRouteInfo<T,R>
      Parameters:
      status - The status to match
      Returns:
      The route match
    • match

      public Optional<RouteMatch<R>> match(int statusCode)
      Description copied from interface: StatusRouteInfo
      Match the given HTTP status.
      Specified by:
      match in interface StatusRouteInfo<T,R>
      Parameters:
      statusCode - The status to match
      Returns:
      The route match
    • match

      public Optional<RouteMatch<R>> match(Class<?> originatingClass, int statusCode)
      Description copied from interface: StatusRouteInfo
      Match the given HTTP status.
      Specified by:
      match in interface StatusRouteInfo<T,R>
      Parameters:
      originatingClass - The class where the error originates from
      statusCode - The status to match
      Returns:
      The route match
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMessageBodyReader

      public final io.micronaut.http.body.MessageBodyReader<?> getMessageBodyReader()
      Specified by:
      getMessageBodyReader in interface RouteInfo<T>
      Returns:
      The message body reader. if any.
    • resolveArgumentBinders

      public io.micronaut.http.bind.binders.RequestArgumentBinder<Object>[] resolveArgumentBinders(io.micronaut.http.bind.RequestBinderRegistry requestBinderRegistry)
      Specified by:
      resolveArgumentBinders in interface MethodBasedRouteInfo<T,R>
    • isVoid

      public boolean isVoid()
      Specified by:
      isVoid in interface RouteInfo<T>
      Overrides:
      isVoid in class DefaultRouteInfo<R>
      Returns:
      Does the route return void
    • getTargetMethod

      public io.micronaut.inject.MethodExecutionHandle<T,R> getTargetMethod()
      Specified by:
      getTargetMethod in interface MethodBasedRouteInfo<T,R>
      Returns:
      The MethodExecutionHandle
    • getRequestBodyType

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

      public Optional<io.micronaut.core.type.Argument<?>> getFullRequestBodyType()
      Description copied from interface: RouteInfo
      Like RouteInfo.getRequestBodyType(), but excludes body arguments that may match only a part of the body (i.e. that have no @Body annotation, or where the @Body has a value set).
      Specified by:
      getFullRequestBodyType in interface RouteInfo<T>
      Returns:
      The argument that represents the body
    • getArgumentNames

      public String[] getArgumentNames()
      Specified by:
      getArgumentNames in interface MethodBasedRouteInfo<T,R>
    • needsRequestBody

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