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>
    A Route that is executable.
    Since:
    1.0
    • Field Summary

      • Fields inherited from interface io.micronaut.core.annotation.AnnotationSource

        EMPTY
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default R call()
      Same as execute().
      RouteMatch<R> decorate​(java.util.function.Function<RouteMatch<R>,​R> executor)
      Decorates the execution of the route with the given executor.
      boolean doesConsume​(io.micronaut.http.MediaType contentType)
      Whether the specified content type is an accepted type.
      boolean doesProduce​(io.micronaut.http.MediaType acceptableType)
      Whether the route does produce any of the given types.
      boolean doesProduce​(java.util.Collection<io.micronaut.http.MediaType> acceptableTypes)
      Whether the route does produce any of the given types.
      default R execute()
      Execute the route with the given values.
      R execute​(java.util.Map<java.lang.String,​java.lang.Object> argumentValues)
      Execute the route with the given values.
      default boolean explicitlyConsumes​(io.micronaut.http.MediaType contentType)
      Whether the specified content type is explicitly an accepted type.
      default boolean explicitlyProduces​(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 new RouteMatch fulfilling 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 boolean isExecutable()  
      default boolean isRequiredInput​(java.lang.String name)
      Return whether the given named input is required by this route.
      default boolean isSatisfied​(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 java.util.function.Predicate

        and, negate, or, test
    • 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 by getRequiredArguments().
        Parameters:
        argumentValues - The argument values
        Returns:
        The result
      • fulfill

        RouteMatch<R> fulfill​(java.util.Map<java.lang.String,​java.lang.Object> argumentValues)
        Returns a new RouteMatch fulfilling arguments required by this route to execute. The new route will not return the given arguments from the getRequiredArguments() 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:
        getProduces in interface RouteInfo<R>
        Returns:
        A list of MediaType that 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:
        getReturnType in interface RouteInfo<R>
        Returns:
        The return type
      • execute

        default R execute()
        Execute the route with the given values. Note if there are required arguments returned from getRequiredArguments() this method will throw an IllegalArgumentException.
        Returns:
        The result
      • call

        default R call()
                throws java.lang.Exception
        Same as execute().
        Specified by:
        call in interface java.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