Module java.base
Package java.security

Interface Guard

所有已知的实现类:
AllPermission, AttachPermission, AudioPermission, AuthPermission, AWTPermission, BasicPermission, CardPermission, DelegationPermission, FilePermission, FlightRecorderPermission, InquireSecContextPermission, JDIPermission, LinkPermission, LoggingPermission, ManagementPermission, MBeanPermission, MBeanServerPermission, MBeanTrustPermission, NetPermission, NetworkPermission, Permission, PrivateCredentialPermission, PropertyPermission, ReflectPermission, RuntimePermission, SecurityPermission, SerializablePermission, ServicePermission, SocketPermission, SQLPermission, SSLPermission, SubjectDelegationPermission, UnresolvedPermission, URLPermission

public interface Guard

此接口表示一个守卫,用于保护对另一个对象的访问。

此接口包含一个方法checkGuard,带有一个object参数。通过GuardedObject的getObject方法调用checkGuard来确定是否允许访问该对象。

自 JDK 版本:
1.2
参见:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkGuard(Object object)
    确定是否允许访问受保护的对象object
  • Method Details

    • checkGuard

      void checkGuard(Object object) throws SecurityException
      确定是否允许访问受保护的对象object。如果允许访问,则静默返回。否则,抛出SecurityException
      参数:
      object - 受守卫保护的对象。
      抛出:
      SecurityException - 如果拒绝访问。