Class PathFilterSet

  • All Implemented Interfaces:
    Dumpable

    public class PathFilterSet
    extends FilterSet<PathFilter>
    The path filter set holds a set of path filters each attributes as include or exclude filter. The evaluation of the set allows included paths and rejects excluded paths.

    Additionally it contains a "root" path for which the filters are evaluated. if an item has not the node addressed by the root path as ancestor, it is always excluded.

    • Field Detail

      • INCLUDE_ALL

        public static final PathFilterSet INCLUDE_ALL
        The include all item filter set
      • EXCLUDE_ALL

        public static final PathFilterSet EXCLUDE_ALL
        The exclude all item filter set
    • Constructor Detail

      • PathFilterSet

        public PathFilterSet()
        Default constructor. initializes the root path to "/"
      • PathFilterSet

        public PathFilterSet​(@Nonnull
                             java.lang.String root)
        Creates a new path filter set and sets the respective root path
        Parameters:
        root - path
    • Method Detail

      • contains

        public boolean contains​(@Nonnull
                                java.lang.String path)
        Evaluates the filters if this set does cover the given item. otherwise false is returned. The result of the evaluation is the polarity of the last matched path. If no filter matches it returns true if the first filter is an exclude filter or if no filter is defined; false if the first filter is an include filter.
        Parameters:
        path - the path to check
        Returns:
        true if this set matches the item
      • translate

        @Nonnull
        public PathFilterSet translate​(@Nullable
                                       PathMapping mapping)
        Translates this path filter with the given mapping. Note that only absolute filters can be translated.
        Parameters:
        mapping - the mapping to apply
        Returns:
        the new filter
        Since:
        2.4.10
      • hasOnlyRelativePatterns

        public boolean hasOnlyRelativePatterns()
        Checks if this path filter set only contains entries that are relative include patterns, eg: ".* /foo.*". in this case the aggregator will use a different strategy when providing non matching leave nodes.
        Returns:
        true if only contains relative patterns
      • getType

        @Nullable
        public java.lang.String getType()
        Returns the filter type or null
        Returns:
        the filter type.
      • setType

        @Nonnull
        public PathFilterSet setType​(@Nullable
                                     java.lang.String type)
        Sets the filter type
        Parameters:
        type - the type
        Returns:
        this.