1 7 8 package java.security; 9 10 31 32 public class GuardedObject implements java.io.Serializable { 33 34 private static final long serialVersionUID = -5240450096227834308L; 35 36 private Object object; private Guard guard; 39 48 49 public GuardedObject(Object object, Guard guard) 50 { 51 this.guard = guard; 52 this.object = object; 53 } 54 55 64 public Object getObject() 65 throws SecurityException 66 { 67 if (guard != null) 68 guard.checkGuard(object); 69 70 return object; 71 } 72 73 77 private synchronized void writeObject(java.io.ObjectOutputStream oos) 78 throws java.io.IOException 79 { 80 if (guard != null) 81 guard.checkGuard(object); 82 83 oos.defaultWriteObject(); 84 } 85 } 86 | Popular Tags |