Class DefaultIoFilterChainBuilder

    • Constructor Detail

      • DefaultIoFilterChainBuilder

        public DefaultIoFilterChainBuilder()
        Creates a new instance with an empty filter list.
    • Method Detail

      • get

        public IoFilter get​(java.lang.String name)
        Parameters:
        name - The Filter's name we are looking for
        Returns:
        The found Filter, or null
        See Also:
        IoFilterChain.get(String)
      • get

        public IoFilter get​(java.lang.Class<? extends IoFilter> filterType)
        Parameters:
        filterType - The FilterType we are looking for
        Returns:
        The found Filter, or null
        See Also:
        IoFilterChain.get(Class)
      • contains

        public boolean contains​(java.lang.String name)
        Parameters:
        name - The Filter's name we want to check if it's in the chain
        Returns:
        true if the chain contains the given filter name
        See Also:
        IoFilterChain.contains(String)
      • contains

        public boolean contains​(IoFilter filter)
        Parameters:
        filter - The Filter we want to check if it's in the chain
        Returns:
        true if the chain contains the given filter
        See Also:
        IoFilterChain.contains(IoFilter)
      • contains

        public boolean contains​(java.lang.Class<? extends IoFilter> filterType)
        Parameters:
        filterType - The FilterType we want to check if it's in the chain
        Returns:
        true if the chain contains the given filterType
        See Also:
        IoFilterChain.contains(Class)
      • remove

        public IoFilter remove​(java.lang.String name)
        Parameters:
        name - The Filter's name to remove from the list of Filters
        Returns:
        The removed IoFilter
        See Also:
        IoFilterChain.remove(String)
      • remove

        public IoFilter remove​(java.lang.Class<? extends IoFilter> filterType)
        Parameters:
        filterType - The FilterType we want to remove from the list of Filters
        Returns:
        The removed IoFilter
        See Also:
        IoFilterChain.remove(Class)
      • replace

        public IoFilter replace​(java.lang.String name,
                                IoFilter newFilter)
        Replace a filter by a new one.
        Parameters:
        name - The name of the filter to replace
        newFilter - The new filter to use
        Returns:
        The replaced filter
      • replace

        public void replace​(IoFilter oldFilter,
                            IoFilter newFilter)
        Replace a filter by a new one.
        Parameters:
        oldFilter - The filter to replace
        newFilter - The new filter to use
      • replace

        public void replace​(java.lang.Class<? extends IoFilter> oldFilterType,
                            IoFilter newFilter)
        Replace a filter by a new one. We are looking for a filter type, but if we have more than one with the same type, only the first found one will be replaced
        Parameters:
        oldFilterType - The filter type to replace
        newFilter - The new filter to use
      • setFilters

        public void setFilters​(java.util.Map<java.lang.String,​? extends IoFilter> filters)
        Clears the current list of filters and adds the specified filter mapping to this builder. Please note that you must specify a Map implementation that iterates the filter mapping in the order of insertion such as LinkedHashMap. Otherwise, it will throw an IllegalArgumentException.
        Parameters:
        filters - The list of filters to set
      • buildFilterChain

        public void buildFilterChain​(IoFilterChain chain)
                              throws java.lang.Exception
        Modifies the specified chain.
        Specified by:
        buildFilterChain in interface IoFilterChainBuilder
        Parameters:
        chain - The chain to modify
        Throws:
        java.lang.Exception - If the chain modification failed
      • toString

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