Package io.micronaut.web.router
Class BasicObjectRouteMatch
- java.lang.Object
-
- io.micronaut.web.router.BasicObjectRouteMatch
-
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider,io.micronaut.core.annotation.AnnotationSource,RouteInfo<java.lang.Object>,RouteMatch<java.lang.Object>,java.util.concurrent.Callable<java.lang.Object>,java.util.function.Predicate<io.micronaut.http.HttpRequest>
public class BasicObjectRouteMatch extends java.lang.Object implements RouteMatch<java.lang.Object>
A route match designed to return an existing object.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description BasicObjectRouteMatch(java.lang.Object object)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RouteMatch<java.lang.Object>decorate(java.util.function.Function<RouteMatch<java.lang.Object>,java.lang.Object> 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.java.lang.Objectexecute(java.util.Map<java.lang.String,java.lang.Object> argumentValues)Execute the route with the given values.RouteMatch<java.lang.Object>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.lang.Class<?>getDeclaringType()java.util.List<io.micronaut.http.MediaType>getProduces()The media types able to produced by this route.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<?>getReturnType()java.util.Map<java.lang.String,java.lang.Object>getVariableValues()booleantest(io.micronaut.http.HttpRequest httpRequest)-
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, 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, isAsync, isAsyncOrReactive, isCompletable, isErrorRoute, isReactive, isSingleResult, isSpecifiedSingle, isSuspended, isVoid, isWebSocketRoute
-
Methods inherited from interface io.micronaut.web.router.RouteMatch
call, execute, explicitlyConsumes, explicitlyProduces, getRequiredArguments, isExecutable, isRequiredInput, isSatisfied
-
-
-
-
Method Detail
-
getDeclaringType
public java.lang.Class<?> getDeclaringType()
- Specified by:
getDeclaringTypein interfaceRouteInfo<java.lang.Object>- Returns:
- The declaring type of the route.
-
getVariableValues
public java.util.Map<java.lang.String,java.lang.Object> getVariableValues()
- Specified by:
getVariableValuesin interfaceRouteMatch<java.lang.Object>- Returns:
- The variable values following a successful match.
-
execute
public java.lang.Object execute(java.util.Map<java.lang.String,java.lang.Object> argumentValues)
Description copied from interface:RouteMatchExecute the route with the given values. The passed map should contain values for every argument returned byRouteMatch.getRequiredArguments().- Specified by:
executein interfaceRouteMatch<java.lang.Object>- Parameters:
argumentValues- The argument values- Returns:
- The result
-
fulfill
public RouteMatch<java.lang.Object> fulfill(java.util.Map<java.lang.String,java.lang.Object> argumentValues)
Description copied from interface:RouteMatchReturns a newRouteMatchfulfilling arguments required by this route to execute. The new route will not return the given arguments from theRouteMatch.getRequiredArguments()method.- Specified by:
fulfillin interfaceRouteMatch<java.lang.Object>- Parameters:
argumentValues- The argument values- Returns:
- The fulfilled route
-
decorate
public RouteMatch<java.lang.Object> decorate(java.util.function.Function<RouteMatch<java.lang.Object>,java.lang.Object> executor)
Description copied from interface:RouteMatchDecorates the execution of the route with the given executor.- Specified by:
decoratein interfaceRouteMatch<java.lang.Object>- Parameters:
executor- The executor- Returns:
- A new route match
-
getRequiredInput
public java.util.Optional<io.micronaut.core.type.Argument<?>> getRequiredInput(java.lang.String name)
Description copied from interface:RouteMatchReturn whether the given named input is required by this route.- Specified by:
getRequiredInputin interfaceRouteMatch<java.lang.Object>- Parameters:
name- The name of the input- Returns:
- True if it is
-
getBodyArgument
public java.util.Optional<io.micronaut.core.type.Argument<?>> getBodyArgument()
- Specified by:
getBodyArgumentin interfaceRouteMatch<java.lang.Object>- Returns:
- The argument that represents the body
-
getProduces
public java.util.List<io.micronaut.http.MediaType> getProduces()
Description copied from interface:RouteMatchThe media types able to produced by this route.- Specified by:
getProducesin interfaceRouteInfo<java.lang.Object>- Specified by:
getProducesin interfaceRouteMatch<java.lang.Object>- Returns:
- A list of
MediaTypethat this route can produce
-
getReturnType
public io.micronaut.core.type.ReturnType<?> getReturnType()
- Specified by:
getReturnTypein interfaceRouteInfo<java.lang.Object>- Specified by:
getReturnTypein interfaceRouteMatch<java.lang.Object>- Returns:
- The return type
-
doesConsume
public boolean doesConsume(@Nullable io.micronaut.http.MediaType contentType)Description copied from interface:RouteMatchWhether the specified content type is an accepted type.- Specified by:
doesConsumein interfaceRouteMatch<java.lang.Object>- Parameters:
contentType- The content type- Returns:
- True if it is
-
doesProduce
public boolean doesProduce(@Nullable java.util.Collection<io.micronaut.http.MediaType> acceptableTypes)Description copied from interface:RouteMatchWhether the route does produce any of the given types.- Specified by:
doesProducein interfaceRouteMatch<java.lang.Object>- Parameters:
acceptableTypes- The acceptable types- Returns:
- True if it is
-
doesProduce
public boolean doesProduce(@Nullable io.micronaut.http.MediaType acceptableType)Description copied from interface:RouteMatchWhether the route does produce any of the given types.- Specified by:
doesProducein interfaceRouteMatch<java.lang.Object>- Parameters:
acceptableType- The acceptable type- Returns:
- True if it is
-
test
public boolean test(io.micronaut.http.HttpRequest httpRequest)
- Specified by:
testin interfacejava.util.function.Predicate<io.micronaut.http.HttpRequest>
-
-