home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / security / GuardedObject.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  734 b   |  32 lines

  1. package java.security;
  2.  
  3. import java.io.IOException;
  4. import java.io.ObjectOutputStream;
  5. import java.io.Serializable;
  6.  
  7. public class GuardedObject implements Serializable {
  8.    private Object object;
  9.    private Guard guard;
  10.  
  11.    public GuardedObject(Object var1, Guard var2) {
  12.       this.guard = var2;
  13.       this.object = var1;
  14.    }
  15.  
  16.    public Object getObject() throws SecurityException {
  17.       if (this.guard != null) {
  18.          this.guard.checkGuard(this.object);
  19.       }
  20.  
  21.       return this.object;
  22.    }
  23.  
  24.    private synchronized void writeObject(ObjectOutputStream var1) throws IOException {
  25.       if (this.guard != null) {
  26.          this.guard.checkGuard(this.object);
  27.       }
  28.  
  29.       var1.defaultWriteObject();
  30.    }
  31. }
  32.