Class PathFilterSet

  • All Implemented Interfaces:

    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


        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

        public static final PathFilterSet INCLUDE_ALL
        The include all item filter set

        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
        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.
        path - the path to check
        true if this set matches the item
      • translate

        public @NotNull PathFilterSet translate​(@Nullable
                                                @Nullable PathMapping mapping)
        Translates this path filter with the given mapping. Note that only absolute filters can be translated.
        mapping - the mapping to apply
        the new filter
      • 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.
        true if only contains relative patterns
      • getType

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

        public @NotNull PathFilterSet setType​(@Nullable
                                              @Nullable String type)
        Sets the filter type
        type - the type