java.security
Class GuardedObject
java.lang.Object
java.security.GuardedObject
- All Implemented Interfaces:
- Serializable
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
- See Also:
- Serialized Form
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 |
Object |
getObject()
This method first call the checkGuard method on the
Guard object protecting the guarded object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 guardguard
- the Guard
that is protecting the object
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