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

      • TYPE_CLEANUP

        public static final String TYPE_CLEANUP
        PathFilterSets of this type are only used to remove nodes during import and ignored for calculation of the package type.
        See Also:
        Constant Field Values
      • 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​(@NotNull
                             @NotNull String root)
        Creates a new path filter set and sets the respective root path
        Parameters:
        root - path
    • Method Detail

      • contains

        public boolean contains​(@NotNull
                                @NotNull 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

        @NotNull
        public @NotNull PathFilterSet translate​(@Nullable
                                                @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 @Nullable String getType()
        Returns the filter type or null
        Returns:
        the filter type.
      • setType

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