60 * If the Guard object is null, then no restrictions will
61 * be placed on who can access the object.
62 *
63 * @param object the object to be guarded.
64 *
65 * @param guard the Guard object that guards access to the object.
66 */
67
68 public GuardedObject(Object object, Guard guard)
69 {
70 this.guard = guard;
71 this.object = object;
72 }
73
74 /**
75 * Retrieves the guarded object, or throws an exception if access
76 * to the guarded object is denied by the guard.
77 *
78 * @return the guarded object.
79 *
80 * @exception SecurityException if access to the guarded object is
81 * denied.
82 */
83 public Object getObject()
84 throws SecurityException
85 {
86 if (guard != null)
87 guard.checkGuard(object);
88
89 return object;
90 }
91
92 /**
93 * Writes this object out to a stream (i.e., serializes it).
94 * We check the guard if there is one.
95 */
96 @java.io.Serial
97 private void writeObject(java.io.ObjectOutputStream oos)
98 throws java.io.IOException
99 {
100 if (guard != null)
|
60 * If the Guard object is null, then no restrictions will
61 * be placed on who can access the object.
62 *
63 * @param object the object to be guarded.
64 *
65 * @param guard the Guard object that guards access to the object.
66 */
67
68 public GuardedObject(Object object, Guard guard)
69 {
70 this.guard = guard;
71 this.object = object;
72 }
73
74 /**
75 * Retrieves the guarded object, or throws an exception if access
76 * to the guarded object is denied by the guard.
77 *
78 * @return the guarded object.
79 *
80 * @throws SecurityException if access to the guarded object is
81 * denied.
82 */
83 public Object getObject()
84 throws SecurityException
85 {
86 if (guard != null)
87 guard.checkGuard(object);
88
89 return object;
90 }
91
92 /**
93 * Writes this object out to a stream (i.e., serializes it).
94 * We check the guard if there is one.
95 */
96 @java.io.Serial
97 private void writeObject(java.io.ObjectOutputStream oos)
98 throws java.io.IOException
99 {
100 if (guard != null)
|