Class ExcludePackageNameFilter

  • All Implemented Interfaces:
    PackageNameFilter, DiscoveryFilter<java.lang.String>, Filter<java.lang.String>

    class ExcludePackageNameFilter
    extends java.lang.Object
    implements PackageNameFilter
    PackageNameFilter that matches fully qualified package names that are not prefixed by one of the package names provided to the filter.

    If the fully qualified name of a package starts with at least one of the packages names of the filter, the package will be excluded.

    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<java.lang.String> packageNames  
      private java.lang.String patternDescription  
    • Constructor Summary

      Constructors 
      Constructor Description
      ExcludePackageNameFilter​(java.lang.String... packageNames)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FilterResult apply​(java.lang.String packageName)
      Apply this filter to the supplied object.
      private java.util.Optional<java.lang.String> findMatchingName​(java.lang.String packageName)  
      private java.lang.String formatExclusionReason​(java.lang.String packageName, java.lang.String matchedName)  
      private java.lang.String formatInclusionReason​(java.lang.String packageName)  
      java.util.function.Predicate<java.lang.String> toPredicate()
      Return a Predicate that returns true if this filter includes the object supplied to the predicate's test method.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • packageNames

        private final java.util.List<java.lang.String> packageNames
      • patternDescription

        private final java.lang.String patternDescription
    • Constructor Detail

      • ExcludePackageNameFilter

        ExcludePackageNameFilter​(java.lang.String... packageNames)
    • Method Detail

      • apply

        public FilterResult apply​(java.lang.String packageName)
        Description copied from interface: Filter
        Apply this filter to the supplied object.
        Specified by:
        apply in interface Filter<java.lang.String>
      • formatInclusionReason

        private java.lang.String formatInclusionReason​(java.lang.String packageName)
      • formatExclusionReason

        private java.lang.String formatExclusionReason​(java.lang.String packageName,
                                                       java.lang.String matchedName)
      • toPredicate

        public java.util.function.Predicate<java.lang.String> toPredicate()
        Description copied from interface: Filter
        Return a Predicate that returns true if this filter includes the object supplied to the predicate's test method.
        Specified by:
        toPredicate in interface Filter<java.lang.String>
      • findMatchingName

        private java.util.Optional<java.lang.String> findMatchingName​(java.lang.String packageName)
      • toString

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