Class BindingRepository<T>

    • Constructor Detail

      • BindingRepository

        public BindingRepository()
    • Method Detail

      • bindAll

        public void bindAll​(Map<String,​T> bindings)

        Convenient method for calling bind(String, Object) for all entries in a collection of bindings.

        Parameters:
        bindings - The collection of bindings to copy to this.
        Throws:
        NullPointerException - If argument is null or contains null.
      • put

        public void put​(UriPattern uriPattern,
                        T target)

        Binds the given target to the given UriPattern. Although all bindings will eventually be evaluated by a call to BindingSet.resolve(URI), where matching order is significant, the order in which bindings are added is NOT. Instead, the creation of the BindingSet in activate() sorts the bindings in such a way that the more strict patterns are evaluated first. See class-level commentary on UriPattern for more on this.

        Parameters:
        uriPattern - The URI pattern to parse and bind to the target.
        target - The target to assign to the URI pattern.
        Throws:
        NullPointerException - If any argument is null.
        IllegalArgumentException - If the pattern has already been bound to another target.
      • activate

        public BindingSet<T> activate()

        Creates and returns an immutable BindingSet that contains the bindings of this BindingRepository. Notice that the BindingSet uses a snapshot of the current bindings so that this repository remains mutable and reusable.

        Returns:
        The created BindingSet instance.
      • clear

        public void clear()
        Removes all bindings from this repository.