Class LocalRouteRepository

  • All Implemented Interfaces:
    RouteRepository

    public class LocalRouteRepository
    extends RouteRepositoryBase<java.util.Map<java.lang.String,​Route>>
    implements RouteRepository
    Local in-memory implementation of a RouteRepository.
    Author:
    https://github.com/ljucam [Mario Ljuca]
    • Constructor Summary

      Constructors 
      Constructor Description
      LocalRouteRepository()
      Creates a new instance of a local in-memory HookRouteRepository.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRoute​(java.lang.String urlPattern, Route route)
      Adds a route for the given url pattern.
      java.util.Set<java.lang.String> getCollections​(java.lang.String parentUri)
      Returns a set with collections (routes) contained in the given parent.
      Route getRoute​(java.lang.String url)
      Returns the route which is foreseen for the given url.
      java.util.Map<java.lang.String,​Route> getRoutes()
      Returns a copy of all routes.
      void removeRoute​(java.lang.String urlPattern)
      Removes the route for the url pattern.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalRouteRepository

        public LocalRouteRepository()
        Creates a new instance of a local in-memory HookRouteRepository.
    • Method Detail

      • addRoute

        public void addRoute​(java.lang.String urlPattern,
                             Route route)
        Description copied from interface: RouteRepository
        Adds a route for the given url pattern.
        Specified by:
        addRoute in interface RouteRepository
        Parameters:
        urlPattern - - is used as a key.
        route - route
      • removeRoute

        public void removeRoute​(java.lang.String urlPattern)
        Description copied from interface: RouteRepository
        Removes the route for the url pattern.
        Specified by:
        removeRoute in interface RouteRepository
        Parameters:
        urlPattern - urlPattern
      • getRoute

        public Route getRoute​(java.lang.String url)
        Description copied from interface: RouteRepository
        Returns the route which is foreseen for the given url. The repository checks if a url pattern is present for this url and then returns the corresponding route. If nothing is found, null is returned.
        Specified by:
        getRoute in interface RouteRepository
        Parameters:
        url - url
        Returns:
        a route or null if no route is found
      • getRoutes

        public java.util.Map<java.lang.String,​Route> getRoutes()
        Description copied from interface: RouteRepository
        Returns a copy of all routes.
        Specified by:
        getRoutes in interface RouteRepository
        Returns:
        a copy of all routes
      • getCollections

        public java.util.Set<java.lang.String> getCollections​(java.lang.String parentUri)
        Description copied from interface: RouteRepository
        Returns a set with collections (routes) contained in the given parent. Only routes (collections) directly resided in the given parent will be returned. If no route could be found an empty set will be returned.
        Specified by:
        getCollections in interface RouteRepository
        Parameters:
        parentUri - the parent of which the routes should be listed
        Returns:
        a set with routes