FileDocCategorySizeDatePackage
GuardedObject.javaAPI DocAndroid 1.5 API2673Wed May 06 22:41:06 BST 2009java.security

GuardedObject

public class GuardedObject extends Object implements Serializable
{@code GuardedObject} controls access to an object, by checking all requests for the object with a {@code Guard}.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
private final Object
object
private final Guard
guard
Constructors Summary
public GuardedObject(Object object, Guard guard)
Constructs a new instance of {@code GuardedObject} which protects access to the specified {@code Object} using the specified {@code Guard}.

param
object the {@code Object} to protect.
param
guard the {@code Guard} which protects the specified {@code Object}, maybe {@code null}.
since
Android 1.0


                                                                                       
         
        this.object = object;
        this.guard = guard;
    
Methods Summary
public java.lang.ObjectgetObject()
Returns the guarded {@code Object} if the associated {@code Guard} permits access. If access is not granted, then a {@code SecurityException} is thrown.

return
the guarded object.
exception
SecurityException if access is not granted to the guarded object.
since
Android 1.0

        if (guard != null) {
            guard.checkGuard(object);
        }
        return object;
    
private voidwriteObject(java.io.ObjectOutputStream out)
Checks the guard (if there is one) before performing a default serialization.

        if (guard != null) {
            guard.checkGuard(object);
        }
        out.defaultWriteObject();