Class AbstractImportRule

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean allowed
      Indicates whether to allow access or not.
      private boolean localOnly
      Indicates if the rule only applies to this package.
      private boolean regExp
      Indicates if the name is to be interpreted as a regular expression.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractImportRule​(boolean allow, boolean localOnly, boolean regExp)
      Constructs an instance.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected AccessResult calculateResult​(boolean matched)
      Returns the appropriate AccessResult based on whether there was a match and if the rule is to allow access.
      boolean isLocalOnly()
      Return true if the guard is to only be applied locally or false.
      protected boolean isRegExp()
      Return true if the name is to be interpreted as a regular expression or false.
      abstract AccessResult verifyImport​(java.lang.String forImport)
      Verifies whether a package name is used.
      • Methods inherited from class java.lang.Object

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

      • allowed

        private final boolean allowed
        Indicates whether to allow access or not.
      • localOnly

        private final boolean localOnly
        Indicates if the rule only applies to this package.
      • regExp

        private final boolean regExp
        Indicates if the name is to be interpreted as a regular expression.
    • Constructor Detail

      • AbstractImportRule

        protected AbstractImportRule​(boolean allow,
                                     boolean localOnly,
                                     boolean regExp)
        Constructs an instance.
        Parameters:
        allow - whether to allow access.
        localOnly - whether the rule is to be applied locally only.
        regExp - whether the name is to be interpreted as a regular expression.
    • Method Detail

      • verifyImport

        public abstract AccessResult verifyImport​(java.lang.String forImport)
        Verifies whether a package name is used.
        Parameters:
        forImport - the import to check.
        Returns:
        a result AccessResult indicating whether it can be used.
      • isLocalOnly

        public boolean isLocalOnly()
        Return true if the guard is to only be applied locally or false.
        Returns:
        whether the guard is to only be applied locally.
      • isRegExp

        protected boolean isRegExp()
        Return true if the name is to be interpreted as a regular expression or false.
        Returns:
        whether the name is to be interpreted as a regular expression.
      • calculateResult

        protected AccessResult calculateResult​(boolean matched)
        Returns the appropriate AccessResult based on whether there was a match and if the rule is to allow access.
        Parameters:
        matched - indicates whether there was a match.
        Returns:
        An appropriate AccessResult.