Example usage for java.security GuardedObject GuardedObject

List of usage examples for java.security GuardedObject GuardedObject

Introduction

In this page you can find the example usage for java.security GuardedObject GuardedObject.

Prototype


public GuardedObject(Object object, Guard guard) 

Source Link

Document

Constructs a GuardedObject using the specified object and guard.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String secretObj = "secret";
    Guard guard = new PropertyPermission("java.home", "read");

    GuardedObject gobj = new GuardedObject(secretObj, guard);

    try {/*from  ww w . j a  v  a 2 s . co m*/
        Object o = gobj.getObject();
    } catch (AccessControlException e) {
        e.printStackTrace();
    }
}