A GuardedObject is an object that is used to protect access to
another object.
A GuardedObject encapsulates a target object and a Guard object,
such that access to the target object is possible
only if the Guard object allows it.
Once an object is encapsulated by a GuardedObject,
access to that object is controlled by the getObject
method, which invokes the
checkGuard method on the Guard object that is
guarding access. If access is not allowed,
an exception is thrown.
Constructs a GuardedObject using the specified object and guard.
If the Guard object is null, then no restrictions will
be placed on who can access the object.
Parameters
object
the object to be guarded.
guard
the Guard object that guards access to the object.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[],["`GuardedObject` protects access to a target object using a `Guard` object. It is constructed with both a target object and a `Guard`. Access to the target is only granted if the `Guard` allows it, verified through the `getObject()` method. If access is denied, a `SecurityException` is thrown. A `null` `Guard` allows unrestricted access. It extends the class Object, with the possibility to use Object methods, and has implemented the method Serializable.\n"]]