Class PackageScopeControl


  • public final class PackageScopeControl
    extends Object
    Manage access to a subset of packages available from a source (e.g. model root) and classes in these packages. Comes handy when we want to control set of packages coming from a well-known classpath item, e.g. Java SDK classes, when we want to expose only specific, public APIs.
    • Constructor Detail

      • PackageScopeControl

        public PackageScopeControl()
    • Method Detail

      • save

        public void save​(Memento memento)
      • load

        public void load​(Memento memento)
      • includeWithPrefix

        public void includeWithPrefix​(@NotNull
                                      String packageNamePrefix)
        Package name prefix. To match exact package, not any starting with the prefix, don't forget to put dot in the end of the prefix (e.g. "org.com." not to match "org.common")
        Parameters:
        packageNamePrefix - qualified package name prefix to match
      • excludeWithPrefix

        public void excludeWithPrefix​(@NotNull
                                      String packageNamePrefix)
      • isSkipPrivate

        public boolean isSkipPrivate()
      • setSkipPrivate

        public void setSkipPrivate​(boolean skipPrivate)
      • isIncluded

        public boolean isIncluded​(@NotNull
                                  String qualifiedPackageName)
        First, package name is checked for inclusion, then for exclusion (so that include("com"); exclude("com.b.") would allow com.a.A, com.D and forbid com.b.C.
        Parameters:
        qualifiedPackageName - package to check for scope
        Returns:
        true if package deemed part of the scope
      • isAnyChildIncluded

        public boolean isAnyChildIncluded​(@NotNull
                                          String qualifiedPackageName)
        Checking if any of sub-packages of this package is included by myIncludePrefix
        Parameters:
        qualifiedPackageName - package to check for scope
        Returns:
        true if at least one of child packages may be included