public class

GuardedObject

extends Object
implements Serializable
java.lang.Object
   ↳ java.security.GuardedObject

Class Overview

GuardedObject controls access to an object, by checking all requests for the object with a Guard.

Summary

Public Constructors
GuardedObject(Object object, Guard guard)
Constructs a new instance of GuardedObject which protects access to the specified Object using the specified Guard.
Public Methods
Object getObject()
Returns the guarded Object if the associated Guard permits access.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

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.

Public Methods

public Object getObject ()

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.