java.security

Class GuardedObject

public class GuardedObject extends Object implements Serializable

This class is an object that is guarded by a Guard object. The object that is being guarded is retrieved by a call to the only method in this class - getObject. That method returns the guarded Object after first checking with the Guard. If the Guard disallows access, an exception will be thrown.

Since: 1.1

UNKNOWN: updated to 1.4

Constructor Summary
GuardedObject(Object object, Guard guard)
This method initializes a new instance of GuardedObject that protects the specified Object using the specified Guard.
Method Summary
ObjectgetObject()
This method first call the checkGuard method on the Guard object protecting the guarded object.

Constructor Detail

GuardedObject

public GuardedObject(Object object, Guard guard)
This method initializes a new instance of GuardedObject that protects the specified Object using the specified Guard. A null guard means there are no restrictions on accessing the object.

Parameters: object the Object to guard guard the Guard that is protecting the object

Method Detail

getObject

public Object getObject()
This method first call the checkGuard method on the Guard object protecting the guarded object. If the Guard disallows access, an exception is thrown, otherwise the Object is returned.

Returns: The object being guarded

Throws: SecurityException if access is denied