Package java.security

Class GuardedObject

  • All Implemented Interfaces:
    Serializable

    public class GuardedObject
    extends Object
    implements Serializable
    GuardedObject controls access to an object, by checking all requests for the object with a Guard.
    See Also:
    Serialized Form
    • Constructor Detail

      • GuardedObject

        public GuardedObject​(Object object,
                             Guard guard)
        Constructs a new instance of GuardedObject which protects access to the specified Object using the specified Guard.
        Parameters:
        object - the Object to protect.
        guard - the Guard which protects the specified Object, maybe null.
    • Method Detail

      • getObject

        public Object getObject()
                         throws SecurityException
        Returns the guarded Object if the associated Guard permits access. If access is not granted, then a SecurityException is thrown.
        Returns:
        the guarded object.
        Throws:
        SecurityException - if access is not granted to the guarded object.