Class 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
    • Field Summary

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

        EMPTY
    • 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.
      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.
      java.lang.Object execute​(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 new RouteMatch fulfilling 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()  
      boolean test​(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 java.util.function.Predicate

        and, negate, or
    • Constructor Detail

      • BasicObjectRouteMatch

        public BasicObjectRouteMatch​(java.lang.Object object)
        Parameters:
        object - An object
    • Method Detail

      • getDeclaringType

        public java.lang.Class<?> getDeclaringType()
        Specified by:
        getDeclaringType in interface RouteInfo<java.lang.Object>
        Returns:
        The declaring type of the route.
      • getVariableValues

        public java.util.Map<java.lang.String,​java.lang.Object> getVariableValues()
        Specified by:
        getVariableValues in interface RouteMatch<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: RouteMatch
        Execute the route with the given values. The passed map should contain values for every argument returned by RouteMatch.getRequiredArguments().
        Specified by:
        execute in interface RouteMatch<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: RouteMatch
        Returns a new RouteMatch fulfilling arguments required by this route to execute. The new route will not return the given arguments from the RouteMatch.getRequiredArguments() method.
        Specified by:
        fulfill in interface RouteMatch<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: RouteMatch
        Decorates the execution of the route with the given executor.
        Specified by:
        decorate in interface RouteMatch<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: RouteMatch
        Return whether the given named input is required by this route.
        Specified by:
        getRequiredInput in interface RouteMatch<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:
        getBodyArgument in interface RouteMatch<java.lang.Object>
        Returns:
        The argument that represents the body
      • getProduces

        public java.util.List<io.micronaut.http.MediaType> getProduces()
        Description copied from interface: RouteMatch
        The media types able to produced by this route.
        Specified by:
        getProduces in interface RouteInfo<java.lang.Object>
        Specified by:
        getProduces in interface RouteMatch<java.lang.Object>
        Returns:
        A list of MediaType that this route can produce
      • getReturnType

        public io.micronaut.core.type.ReturnType<?> getReturnType()
        Specified by:
        getReturnType in interface RouteInfo<java.lang.Object>
        Specified by:
        getReturnType in interface RouteMatch<java.lang.Object>
        Returns:
        The return type
      • doesConsume

        public boolean doesConsume​(@Nullable
                                   io.micronaut.http.MediaType contentType)
        Description copied from interface: RouteMatch
        Whether the specified content type is an accepted type.
        Specified by:
        doesConsume in interface RouteMatch<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: RouteMatch
        Whether the route does produce any of the given types.
        Specified by:
        doesProduce in interface RouteMatch<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: RouteMatch
        Whether the route does produce any of the given types.
        Specified by:
        doesProduce in interface RouteMatch<java.lang.Object>
        Parameters:
        acceptableType - The acceptable type
        Returns:
        True if it is
      • test

        public boolean test​(io.micronaut.http.HttpRequest httpRequest)
        Specified by:
        test in interface java.util.function.Predicate<io.micronaut.http.HttpRequest>