本文整理汇总了Java中java.security.Permission.implies方法的典型用法代码示例。如果您正苦于以下问题:Java Permission.implies方法的具体用法?Java Permission.implies怎么用?Java Permission.implies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.Permission
的用法示例。
在下文中一共展示了Permission.implies方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: implies
import java.security.Permission; //导入方法依赖的package包/类
/**
* Check and see if this collection of permissions implies the permissions
* expressed in "permission".
*
* @param permission the Permission object to compare
*
* @return true if "permission" is a proper subset of a permission in
* the collection, false if not.
*/
public boolean implies(Permission permission) {
if (! (permission instanceof DelegationPermission))
return false;
synchronized (this) {
for (Permission x : perms) {
if (x.implies(permission))
return true;
}
}
return false;
}
示例2: main
import java.security.Permission; //导入方法依赖的package包/类
public static void main(String[]args) throws Exception {
Permission p1 = new A("foo");
Permission p2 = new B("foo");
if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
throw new Exception("Test failed");
}
// make sure permissions imply and equal themselves
if (! (p1.implies(p1) && p1.equals(p1))) {
throw new Exception("Test failed");
}
}
示例3: checkPermission
import java.security.Permission; //导入方法依赖的package包/类
public final void checkPermission(final Permission perm) {
for (Permission p : grantedPermissions) {
if (p.implies(perm)) {
return;
}
}
throw new SecurityException(perm.toString());
}
示例4: tmpImplies
import java.security.Permission; //导入方法依赖的package包/类
private boolean tmpImplies(Permission perm) {
Map<Integer, Permission> tmpPermissions = transientPermissions.get();
if (tmpPermissions != null) {
for (Permission p : tmpPermissions.values()) {
if (p.implies(perm))
return true;
}
}
return false;
}
示例5: checkPermission
import java.security.Permission; //导入方法依赖的package包/类
public void checkPermission(Permission p) {
if (p.implies(new RuntimePermission("setSecurityManager"))
|| p.implies(new RuntimePermission("getProtectionDomain")))
return;
super.checkPermission(p);
}
示例6: checkPermission
import java.security.Permission; //导入方法依赖的package包/类
@Override
public void checkPermission(Permission perm) {
if (perm.implies(SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION)) {
throw new SecurityException();
}
}
示例7: checkPermission
import java.security.Permission; //导入方法依赖的package包/类
@Override
public void checkPermission(Permission perm) {
if (perm.implies(AWTPermissions.TOPLEVEL_WINDOW_PERMISSION)) {
throw new SecurityException();
}
}