Package io.micronaut.web.router
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
The default route info implementation.
- Since:
- 4.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.micronaut.core.annotation.AnnotationMetadataprotected final List<io.micronaut.http.MediaType>protected final booleanprotected final Class<?>protected final @Nullable io.micronaut.http.HttpStatusprotected final booleanprotected final List<io.micronaut.http.MediaType>protected final booleanprotected final io.micronaut.core.type.ReturnType<? extends R>Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTYFields inherited from interface io.micronaut.web.router.RouteInfo
DEFAULT_PRODUCES -
Constructor Summary
ConstructorsConstructorDescriptionDefaultRouteInfo(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 TypeMethodDescriptionbooleandoesConsume(io.micronaut.http.MediaType contentType) Whether the specified content type is an accepted type.booleandoesProduce(@Nullable io.micronaut.http.MediaType acceptableType) Whether the route does produce any of the given types.booleandoesProduce(@Nullable Collection<io.micronaut.http.MediaType> acceptableTypes) Whether the route does produce any of the given types.booleanexplicitlyConsumes(io.micronaut.http.MediaType contentType) Whether the specified content type is explicitly an accepted type.booleanexplicitlyProduces(io.micronaut.http.MediaType contentType) Whether the specified content type is explicitly a producing type.io.micronaut.http.HttpStatusfindStatus(io.micronaut.http.HttpStatus defaultStatus) Finds predefined route http status or uses default.io.micronaut.core.annotation.AnnotationMetadataList<io.micronaut.http.MediaType>The media types able to produced by this route.Class<?>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<?>>io.micronaut.core.type.Argument<?>io.micronaut.core.type.ReturnType<? extends R>booleanisAsync()booleanbooleanbooleanbooleanWhether the route permits a request body.booleanbooleanbooleanbooleanbooleanisVoid()booleanChecks if route is for web socket.booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface io.micronaut.web.router.RouteInfo
getBodyArgument, getBodyType, getFullRequestBodyType, getMessageBodyReader, isResponseBodyJsonFormattable
-
Field Details
-
returnType
-
consumesMediaTypes
-
producesMediaTypes
-
annotationMetadata
protected final io.micronaut.core.annotation.AnnotationMetadata annotationMetadata -
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
-
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
- Specified by:
getMessageBodyWriterin interfaceRouteInfo<R>- Returns:
- The message body writer, if any.
-
getRequestBodyType
- Specified by:
getRequestBodyTypein interfaceRouteInfo<R>- Returns:
- The argument that represents the body of the request
-
getReturnType
- Specified by:
getReturnTypein interfaceRouteInfo<R>- Returns:
- The return type
-
getResponseBodyType
public io.micronaut.core.type.Argument<?> getResponseBodyType()- Specified by:
getResponseBodyTypein interfaceRouteInfo<R>- Returns:
- The argument representing the data type being produced.
-
getDeclaringType
- Specified by:
getDeclaringTypein interfaceRouteInfo<R>- Returns:
- The declaring type of the route.
-
getProduces
Description copied from interface:RouteInfoThe media types able to produced by this route.- Specified by:
getProducesin interfaceRouteInfo<R>- Returns:
- A list of
MediaTypethat this route can produce
-
getConsumes
Description copied from interface:RouteInfoThe media types able to produced by this route.- Specified by:
getConsumesin interfaceRouteInfo<R>- Returns:
- A list of
MediaTypethat this route can produce
-
doesConsume
public boolean doesConsume(io.micronaut.http.MediaType contentType) Description copied from interface:RouteInfoWhether the specified content type is an accepted type.- Specified by:
doesConsumein interfaceRouteInfo<R>- Parameters:
contentType- The content type- Returns:
- True if it is
-
doesProduce
public boolean doesProduce(@Nullable @Nullable Collection<io.micronaut.http.MediaType> acceptableTypes) Description copied from interface:RouteInfoWhether the route does produce any of the given types.- Specified by:
doesProducein interfaceRouteInfo<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:RouteInfoWhether the route does produce any of the given types.- Specified by:
doesProducein interfaceRouteInfo<R>- Parameters:
acceptableType- The acceptable type- Returns:
- True if it is
-
explicitlyConsumes
public boolean explicitlyConsumes(io.micronaut.http.MediaType contentType) Description copied from interface:RouteInfoWhether the specified content type is explicitly an accepted type.- Specified by:
explicitlyConsumesin interfaceRouteInfo<R>- Parameters:
contentType- The content type- Returns:
- True if it is
-
explicitlyProduces
public boolean explicitlyProduces(io.micronaut.http.MediaType contentType) Description copied from interface:RouteInfoWhether the specified content type is explicitly a producing type.- Specified by:
explicitlyProducesin interfaceRouteInfo<R>- Parameters:
contentType- The content type- Returns:
- True if it is
-
isSuspended
public boolean isSuspended()- Specified by:
isSuspendedin interfaceRouteInfo<R>- Returns:
- Is this route match a suspended function (Kotlin).
-
isReactive
public boolean isReactive()- Specified by:
isReactivein interfaceRouteInfo<R>- Returns:
- Is the route a reactive route.
-
isSingleResult
public boolean isSingleResult()- Specified by:
isSingleResultin interfaceRouteInfo<R>- Returns:
- Does the route emit a single result or multiple results
-
isSpecifiedSingle
public boolean isSpecifiedSingle()- Specified by:
isSpecifiedSinglein interfaceRouteInfo<R>- Returns:
- Does the route emit a single result or multiple results
-
isCompletable
public boolean isCompletable()- Specified by:
isCompletablein interfaceRouteInfo<R>- Returns:
- is the return type completable
-
isAsync
public boolean isAsync() -
isAsyncOrReactive
public boolean isAsyncOrReactive()- Specified by:
isAsyncOrReactivein interfaceRouteInfo<R>- Returns:
- Is the route an async or reactive route.
-
isVoid
public boolean isVoid() -
findStatus
public io.micronaut.http.HttpStatus findStatus(io.micronaut.http.HttpStatus defaultStatus) Description copied from interface:RouteInfoFinds predefined route http status or uses default.- Specified by:
findStatusin interfaceRouteInfo<R>- Parameters:
defaultStatus- The default status- Returns:
- The status
-
isErrorRoute
public boolean isErrorRoute()- Specified by:
isErrorRoutein interfaceRouteInfo<R>- Returns:
- True if the route was called due to an error
-
isWebSocketRoute
public boolean isWebSocketRoute()Description copied from interface:RouteInfoChecks if route is for web socket.- Specified by:
isWebSocketRoutein interfaceRouteInfo<R>- Returns:
- true if it's web socket route
-
isPermitsRequestBody
public boolean isPermitsRequestBody()Description copied from interface:RouteInfoWhether the route permits a request body.- Specified by:
isPermitsRequestBodyin interfaceRouteInfo<R>- Returns:
- True if the route permits a request body
-
getExecutor
public ExecutorService getExecutor(io.micronaut.scheduling.executor.ThreadSelection threadSelection) - Specified by:
getExecutorin interfaceRouteInfo<R>- Parameters:
threadSelection- The thread selection- Returns:
- The route executor
-
getAnnotationMetadata
public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()- Specified by:
getAnnotationMetadatain interfaceio.micronaut.core.annotation.AnnotationMetadataProvider
-
needsRequestBody
public boolean needsRequestBody()- Specified by:
needsRequestBodyin interfaceRouteInfo<R>- Returns:
- true if the route needs request body to be read
-