Interface RouteMatch<R>

Type Parameters:
R - The route
All Superinterfaces:
AnnotationMetadataProvider, AnnotationSource, Callable<R>, Predicate<HttpRequest>, RouteInfo<R>
All Known Subinterfaces:
MethodBasedRouteMatch<T,R>, UriRouteMatch<T,R>
All Known Implementing Classes:
BasicObjectRouteMatch

public interface RouteMatch<R> extends Callable<R>, Predicate<HttpRequest>, RouteInfo<R>
A Route that is executable.
Since:
1.0
Author:
Graeme Rocher
  • Method Details

    • getVariableValues

      Map<String,Object> getVariableValues()
      Returns:
      The variable values following a successful match.
    • execute

      R execute(Map<String,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(Map<String,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(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

      Optional<Argument<?>> getRequiredInput(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

      Optional<Argument<?>> getBodyArgument()
      Returns:
      The argument that represents the body
    • getProduces

      List<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 Collection<Argument<?>> getRequiredArguments()

      Returns the required arguments for this RouteMatch.

      Returns:
      The required arguments in order to invoke this route
    • getReturnType

      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 Exception
      Same as execute().
      Specified by:
      call in interface Callable<R>
      Returns:
      The result
      Throws:
      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(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 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 Collection<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 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 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 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(String name)
      Is the given input satisfied.
      Parameters:
      name - The name of the input
      Returns:
      True if it is