Code example for Permissions

0
        AdjustablePolicy(Permission... permissions) {
            for (Permission permission : permissions)
                perms.add(permission);
        } 
        void addPermission(Permission perm) { perms.add(perm); }
        void clearPermissions() { perms = new Permissions(); }
        public PermissionCollection getPermissions(CodeSource cs) {
            return perms;
        } 
        public PermissionCollection getPermissions(ProtectionDomain pd) {
            return perms;
        } 
        public boolean implies(ProtectionDomain pd, Permission p) {
            return perms.implies(p);
        } 
        public void refresh() {} 
        public String toString() {
            List<Permission> ps = new ArrayList<Permission>();
            for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();)
                ps.add(e.nextElement());
            return "AdjustablePolicy with permissions " + ps;