public class GuardedObject extends Object implements Serializable
一个guardedobject封装的目标对象和保护对象,这样访问目标对象可能只是如果警卫对象允许的话。一旦一个对象被封装至GuardedObject,访问该对象的方法调用getObject
控制,这是守警卫对象的checkGuard
方法。如果不允许访问,则抛出一个异常。
Guard
,
Permission
,
Serialized Form
Constructor and Description |
---|
GuardedObject(Object object, Guard guard)
使用指定的对象,构建了一个guardedobject守卫。
|
public Object getObject() throws SecurityException
SecurityException
如果访问受保护对象被拒绝。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.