public class GuardedObject extends Object implements Serializable
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.| Constructor and Description |
|---|
GuardedObject(Object object,
Guard guard)
This method initializes a new instance of
GuardedObject
that protects the specified Object using the specified
Guard. |
public GuardedObject(Object object, Guard guard)
GuardedObject
that protects the specified Object using the specified
Guard. A null guard means there are no restrictions on
accessing the object.object - the Object to guardguard - the Guard that is protecting the objectpublic Object getObject()
checkGuard method on the
Guard object protecting the guarded object. If the
Guard disallows access, an exception is thrown, otherwise
the Object is returned.SecurityException - if access is denied