Class UriPathRouter<P,​T>

  • All Implemented Interfaces:
    java.util.function.Function<java.lang.String,​T>

    final class UriPathRouter<P,​T>
    extends java.lang.Object
    implements java.util.function.Function<java.lang.String,​T>
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  UriPathRouter.BestMatcher<T>
      Finds a match for the given path from a collection of URI patterns.
      (package private) static class  UriPathRouter.OrderedMatcher<T>
      Finds a match for the given path from an ordered collection of URI patterns.
      (package private) static class  UriPathRouter.RegexMatcher<T>
      Finds a match for the given path from a collection of regular expressions.
    • Constructor Summary

      Constructors 
      Constructor Description
      UriPathRouter​(java.util.function.Function<java.lang.String,​P> compiler, java.util.function.BiFunction<java.lang.String,​java.util.List<PathRoute<P,​T>>,​T> pathRouter, java.util.List<PathRoute<java.lang.String,​T>> routes)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T apply​(java.lang.String path)  
      (package private) static <T> UriPathRouter<?,​T> bestMatch​(java.util.List<PathRoute<java.lang.String,​T>> routes)  
      (package private) static <T> UriPathRouter<?,​T> ordered​(java.util.List<PathRoute<java.lang.String,​T>> routes)  
      (package private) static <T> UriPathRouter<?,​T> regEx​(java.util.List<PathRoute<java.lang.String,​T>> routes)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Field Detail

      • pathRouter

        private final java.util.function.BiFunction<java.lang.String,​java.util.List<PathRoute<P,​T>>,​T> pathRouter
      • routes

        private final java.util.List<PathRoute<P,​T>> routes
    • Constructor Detail

      • UriPathRouter

        UriPathRouter​(java.util.function.Function<java.lang.String,​P> compiler,
                      java.util.function.BiFunction<java.lang.String,​java.util.List<PathRoute<P,​T>>,​T> pathRouter,
                      java.util.List<PathRoute<java.lang.String,​T>> routes)
    • Method Detail

      • apply

        public T apply​(java.lang.String path)
        Specified by:
        apply in interface java.util.function.Function<P,​T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • bestMatch

        static <T> UriPathRouter<?,​T> bestMatch​(java.util.List<PathRoute<java.lang.String,​T>> routes)
      • ordered

        static <T> UriPathRouter<?,​T> ordered​(java.util.List<PathRoute<java.lang.String,​T>> routes)
      • regEx

        static <T> UriPathRouter<?,​T> regEx​(java.util.List<PathRoute<java.lang.String,​T>> routes)