Class AccessRestriction

java.lang.Object
org.kohsuke.accmod.AccessRestriction
Direct Known Subclasses:
DoNotUse, None

public abstract class AccessRestriction extends Object
Access restriction policy — determines what access is OK and what are not.

The subtype of this interface is a strategy object. Instances of these classes are created during the access enforcement to perform constraint checks.

Single execution of the enforcement check would create at most one instance of a given AccessRestriction type, so instance fields can be used to store heavy-weight objects or other indices that you might need for implementing access control checks.

Author:
Kohsuke Kawaguchi
  • Field Details

  • Constructor Details

    • AccessRestriction

      public AccessRestriction()
  • Method Details

    • usedAsSuperType

      public abstract void usedAsSuperType(Location loc, RestrictedElement target, ErrorListener errorListener)
      The type on which this restriction is placed is used as a supertype by another class. The location points to the subtype.
      Parameters:
      loc - Points to the subtype.
      errorListener - Report any error here.
    • usedAsInterface

      public abstract void usedAsInterface(Location loc, RestrictedElement target, ErrorListener errorListener)
      The type on which this restriction is placed is used as an interface that another class/interface implements.
      Parameters:
      loc - Points to the subtype.
      errorListener - Report any error here.
    • instantiated

      public abstract void instantiated(Location loc, RestrictedElement target, ErrorListener errorListener)
      The type on which this restriction is placed is instantiated elsewhere.
    • invoked

      public abstract void invoked(Location loc, RestrictedElement target, ErrorListener errorListener)
      The method on which this restriction is placed is invoked elsewhere.
    • read

      public abstract void read(Location loc, RestrictedElement target, ErrorListener errorListener)
      The field on which this restriction is placed is read.
    • written

      public abstract void written(Location loc, RestrictedElement target, ErrorListener errorListener)
      The field on which this restriction is placed is updated.
    • appliesToNested

      public boolean appliesToNested()
      Whether this access restriction, if applied to a type, should also be considered to apply implicitly to all transitively nested members.
      Returns:
      by default, false