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:
AnnotationMetadataProvider
,AnnotationSource
,RouteInfo<R>
- Direct Known Subclasses:
DefaultRequestMatcher
The default route info implementation.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AnnotationMetadata
protected final boolean
protected final Class<?>
protected final @Nullable HttpStatus
protected final boolean
protected final boolean
protected final 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
ConstructorDescriptionDefaultRouteInfo
(AnnotationMetadata annotationMetadata, ReturnType<? extends R> returnType, List<MediaType> consumesMediaTypes, List<MediaType> producesMediaTypes, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody, MessageBodyHandlerRegistry messageBodyHandlerRegistry) DefaultRouteInfo
(ReturnType<? extends R> returnType, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether this is consuming any content type.boolean
doesConsume
(MediaType contentType) Whether the specified content type is an accepted type.boolean
doesProduce
(@Nullable MediaType acceptableType) Whether the route does produce any of the given types.boolean
doesProduce
(@Nullable Collection<MediaType> acceptableTypes) Whether the route does produce any of the given types.boolean
explicitlyConsumes
(MediaType contentType) Whether the specified content type is explicitly an accepted type.boolean
explicitlyProduces
(MediaType contentType) Whether the specified content type is explicitly a producing type.findStatus
(HttpStatus defaultStatus) Finds predefined route http status or uses default.Supplies the metadata.The media types able to produced by this route.Class<?>
getExecutor
(ThreadSelection threadSelection) The media types able to produced by this route.ReturnType<? extends R>
boolean
isAsync()
boolean
boolean
boolean
boolean
Is this route recognized as imperative.boolean
Whether the route permits a request body.boolean
boolean
boolean
boolean
boolean
isVoid()
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
Methods inherited from interface io.micronaut.web.router.RouteInfo
getBodyArgument, getBodyType, getFullRequestBodyType, getMessageBodyReader, isResponseBodyJsonFormattable
-
Field Details
-
returnType
-
consumesMediaTypes
-
producesMediaTypes
-
annotationMetadata
-
declaringType
-
consumesMediaTypesContainsAll
protected final boolean consumesMediaTypesContainsAll -
producesMediaTypesContainsAll
protected final boolean producesMediaTypesContainsAll -
definedStatus
-
isWebSocketRoute
protected final boolean isWebSocketRoute
-
-
Constructor Details
-
DefaultRouteInfo
public DefaultRouteInfo(ReturnType<? extends R> returnType, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody) -
DefaultRouteInfo
public DefaultRouteInfo(AnnotationMetadata annotationMetadata, ReturnType<? extends R> returnType, List<MediaType> consumesMediaTypes, List<MediaType> producesMediaTypes, Class<?> declaringType, boolean isErrorRoute, boolean isPermitsBody, MessageBodyHandlerRegistry messageBodyHandlerRegistry)
-
-
Method Details
-
getMessageBodyWriter
- Specified by:
getMessageBodyWriter
in interfaceRouteInfo<R>
- Returns:
- The message body writer, if any.
-
getRequestBodyType
- Specified by:
getRequestBodyType
in interfaceRouteInfo<R>
- Returns:
- The argument that represents the body of the request
-
getReturnType
- Specified by:
getReturnType
in interfaceRouteInfo<R>
- Returns:
- The return type
-
getResponseBodyType
- Specified by:
getResponseBodyType
in interfaceRouteInfo<R>
- Returns:
- The argument representing the data type being produced.
-
getDeclaringType
- Specified by:
getDeclaringType
in interfaceRouteInfo<R>
- Returns:
- The declaring type of the route.
-
getProduces
Description copied from interface:RouteInfo
The media types able to produced by this route.- Specified by:
getProduces
in interfaceRouteInfo<R>
- Returns:
- A list of
MediaType
that this route can produce
-
getConsumes
Description copied from interface:RouteInfo
The media types able to produced by this route.- Specified by:
getConsumes
in interfaceRouteInfo<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 interfaceRouteInfo<R>
- Returns:
- True if it is
-
doesConsume
Description copied from interface:RouteInfo
Whether the specified content type is an accepted type.- Specified by:
doesConsume
in interfaceRouteInfo<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 interfaceRouteInfo<R>
- Returns:
- True if it is
-
doesProduce
Description copied from interface:RouteInfo
Whether the route does produce any of the given types.- Specified by:
doesProduce
in interfaceRouteInfo<R>
- Parameters:
acceptableTypes
- The acceptable types- Returns:
- True if it is
-
doesProduce
Description copied from interface:RouteInfo
Whether the route does produce any of the given types.- Specified by:
doesProduce
in interfaceRouteInfo<R>
- Parameters:
acceptableType
- The acceptable type- Returns:
- True if it is
-
explicitlyConsumes
Description copied from interface:RouteInfo
Whether the specified content type is explicitly an accepted type.- Specified by:
explicitlyConsumes
in interfaceRouteInfo<R>
- Parameters:
contentType
- The content type- Returns:
- True if it is
-
explicitlyProduces
Description copied from interface:RouteInfo
Whether the specified content type is explicitly a producing type.- Specified by:
explicitlyProduces
in interfaceRouteInfo<R>
- Parameters:
contentType
- The content type- Returns:
- True if it is
-
isSuspended
public boolean isSuspended()- Specified by:
isSuspended
in interfaceRouteInfo<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 interfaceRouteInfo<R>
- Returns:
- Is this route recognized as imperative.
-
isReactive
public boolean isReactive()- Specified by:
isReactive
in interfaceRouteInfo<R>
- Returns:
- Is the route a reactive route.
-
isSingleResult
public boolean isSingleResult()- Specified by:
isSingleResult
in interfaceRouteInfo<R>
- Returns:
- Does the route emit a single result or multiple results
-
isSpecifiedSingle
public boolean isSpecifiedSingle()- Specified by:
isSpecifiedSingle
in interfaceRouteInfo<R>
- Returns:
- Does the route emit a single result or multiple results
-
isCompletable
public boolean isCompletable()- Specified by:
isCompletable
in interfaceRouteInfo<R>
- Returns:
- is the return type completable
-
isAsync
public boolean isAsync() -
isAsyncOrReactive
public boolean isAsyncOrReactive()- Specified by:
isAsyncOrReactive
in interfaceRouteInfo<R>
- Returns:
- Is the route an async or reactive route.
-
isVoid
public boolean isVoid() -
findStatus
Description copied from interface:RouteInfo
Finds predefined route http status or uses default.- Specified by:
findStatus
in interfaceRouteInfo<R>
- Parameters:
defaultStatus
- The default status- Returns:
- The status
-
isErrorRoute
public boolean isErrorRoute()- Specified by:
isErrorRoute
in interfaceRouteInfo<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 interfaceRouteInfo<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 interfaceRouteInfo<R>
- Returns:
- True if the route permits a request body
-
getExecutor
- Specified by:
getExecutor
in interfaceRouteInfo<R>
- Parameters:
threadSelection
- The thread selection- Returns:
- The route executor
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProvider
Supplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA
.- Specified by:
getAnnotationMetadata
in interfaceAnnotationMetadataProvider
- Returns:
- The
AnnotationMetadata
-
needsRequestBody
public boolean needsRequestBody()- Specified by:
needsRequestBody
in interfaceRouteInfo<R>
- Returns:
- true if the route needs request body to be read
-