This class uses a Guard object to guard against unauthorized access to an arbitrary encapsulated object. Create a GuardedObject by specifying an object and a Guard for it. The getObject( ) method calls the checkGuard( ) method of the Guard to determine whether access to the object should be allowed. If access is allowed, getObject( ) returns the encapsulated object. Otherwise, it throws a java.lang.SecurityException.
The Guard object used by a GuardedObject is often a Permission. In this case, access to the guarded object is granted only if the calling code is granted the specified permission by the current security policy.
public classGuardedObject implements Serializable { // Public Constructors public
GuardedObject (Object
object , Guard
guard ); // Public Instance Methods public Object
getObject ( ) throws SecurityException; }