Package io.micronaut.web.router
Interface RouteMatch<R>
-
- Type Parameters:
R- The route
- All Superinterfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider,io.micronaut.core.annotation.AnnotationSource,java.util.concurrent.Callable<R>,java.util.function.Predicate<io.micronaut.http.HttpRequest>,RouteInfo<R>
- All Known Subinterfaces:
MethodBasedRouteMatch<T,R>,UriRouteMatch<T,R>
- All Known Implementing Classes:
BasicObjectRouteMatch
public interface RouteMatch<R> extends java.util.concurrent.Callable<R>, java.util.function.Predicate<io.micronaut.http.HttpRequest>, RouteInfo<R>
ARoutethat is executable.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Rcall()Same asexecute().RouteMatch<R>decorate(java.util.function.Function<RouteMatch<R>,R> executor)Decorates the execution of the route with the given executor.booleandoesConsume(io.micronaut.http.MediaType contentType)Whether the specified content type is an accepted type.booleandoesProduce(io.micronaut.http.MediaType acceptableType)Whether the route does produce any of the given types.booleandoesProduce(java.util.Collection<io.micronaut.http.MediaType> acceptableTypes)Whether the route does produce any of the given types.default Rexecute()Execute the route with the given values.Rexecute(java.util.Map<java.lang.String,java.lang.Object> argumentValues)Execute the route with the given values.default booleanexplicitlyConsumes(io.micronaut.http.MediaType contentType)Whether the specified content type is explicitly an accepted type.default booleanexplicitlyProduces(io.micronaut.http.MediaType contentType)Whether the specified content type is explicitly a producing type.RouteMatch<R>fulfill(java.util.Map<java.lang.String,java.lang.Object> argumentValues)Returns a newRouteMatchfulfilling arguments required by this route to execute.java.util.Optional<io.micronaut.core.type.Argument<?>>getBodyArgument()java.util.List<io.micronaut.http.MediaType>getProduces()The media types able to produced by this route.default java.util.Collection<io.micronaut.core.type.Argument>getRequiredArguments()Returns the required arguments for this RouteMatch.java.util.Optional<io.micronaut.core.type.Argument<?>>getRequiredInput(java.lang.String name)Return whether the given named input is required by this route.io.micronaut.core.type.ReturnType<? extends R>getReturnType()java.util.Map<java.lang.String,java.lang.Object>getVariableValues()default booleanisExecutable()default booleanisRequiredInput(java.lang.String name)Return whether the given named input is required by this route.default booleanisSatisfied(java.lang.String name)Is the given input satisfied.-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, 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
findStatus, getBodyType, getConsumes, getDeclaringType, isAsync, isAsyncOrReactive, isCompletable, isErrorRoute, isReactive, isSingleResult, isSpecifiedSingle, isSuspended, isVoid, isWebSocketRoute
-
-
-
-
Method Detail
-
getVariableValues
java.util.Map<java.lang.String,java.lang.Object> getVariableValues()
- Returns:
- The variable values following a successful match.
-
execute
R execute(java.util.Map<java.lang.String,java.lang.Object> argumentValues)
Execute the route with the given values. The passed map should contain values for every argument returned bygetRequiredArguments().- Parameters:
argumentValues- The argument values- Returns:
- The result
-
fulfill
RouteMatch<R> fulfill(java.util.Map<java.lang.String,java.lang.Object> argumentValues)
Returns a newRouteMatchfulfilling arguments required by this route to execute. The new route will not return the given arguments from thegetRequiredArguments()method.- Parameters:
argumentValues- The argument values- Returns:
- The fulfilled route
-
decorate
RouteMatch<R> decorate(java.util.function.Function<RouteMatch<R>,R> executor)
Decorates the execution of the route with the given executor.- Parameters:
executor- The executor- Returns:
- A new route match
-
getRequiredInput
java.util.Optional<io.micronaut.core.type.Argument<?>> getRequiredInput(java.lang.String name)
Return whether the given named input is required by this route.- Parameters:
name- The name of the input- Returns:
- True if it is
-
getBodyArgument
java.util.Optional<io.micronaut.core.type.Argument<?>> getBodyArgument()
- Returns:
- The argument that represents the body
-
getProduces
java.util.List<io.micronaut.http.MediaType> getProduces()
The media types able to produced by this route.- Specified by:
getProducesin interfaceRouteInfo<R>- Returns:
- A list of
MediaTypethat this route can produce
-
getRequiredArguments
default java.util.Collection<io.micronaut.core.type.Argument> getRequiredArguments()
Returns the required arguments for this RouteMatch.
- Returns:
- The required arguments in order to invoke this route
-
getReturnType
io.micronaut.core.type.ReturnType<? extends R> getReturnType()
- Specified by:
getReturnTypein interfaceRouteInfo<R>- Returns:
- The return type
-
execute
default R execute()
Execute the route with the given values. Note if there are required arguments returned fromgetRequiredArguments()this method will throw anIllegalArgumentException.- Returns:
- The result
-
call
default R call() throws java.lang.Exception
Same asexecute().- Specified by:
callin interfacejava.util.concurrent.Callable<R>- Returns:
- The result
- Throws:
java.lang.Exception- When an exception occurs
-
isExecutable
default boolean isExecutable()
- Returns:
- Whether the route match can be executed without passing any additional arguments ie. via
execute()
-
isRequiredInput
default boolean isRequiredInput(java.lang.String name)
Return whether the given named input is required by this route.- Parameters:
name- The name of the input- Returns:
- True if it is
-
doesConsume
boolean doesConsume(@Nullable io.micronaut.http.MediaType contentType)Whether the specified content type is an accepted type.- Parameters:
contentType- The content type- Returns:
- True if it is
-
doesProduce
boolean doesProduce(@Nullable java.util.Collection<io.micronaut.http.MediaType> acceptableTypes)Whether the route does produce any of the given types.- Parameters:
acceptableTypes- The acceptable types- Returns:
- True if it is
-
doesProduce
boolean doesProduce(@Nullable io.micronaut.http.MediaType acceptableType)Whether the route does produce any of the given types.- Parameters:
acceptableType- The acceptable type- Returns:
- True if it is
-
explicitlyConsumes
default boolean explicitlyConsumes(@Nullable io.micronaut.http.MediaType contentType)Whether the specified content type is explicitly an accepted type.- Parameters:
contentType- The content type- Returns:
- True if it is
-
explicitlyProduces
default boolean explicitlyProduces(@Nullable io.micronaut.http.MediaType contentType)Whether the specified content type is explicitly a producing type.- Parameters:
contentType- The content type- Returns:
- True if it is
- Since:
- 2.5.0
-
isSatisfied
default boolean isSatisfied(java.lang.String name)
Is the given input satisfied.- Parameters:
name- The name of the input- Returns:
- True if it is
-
-