本文整理汇总了C#中Permission.newPermissionCollection方法的典型用法代码示例。如果您正苦于以下问题:C# Permission.newPermissionCollection方法的具体用法?C# Permission.newPermissionCollection怎么用?C# Permission.newPermissionCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permission
的用法示例。
在下文中一共展示了Permission.newPermissionCollection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: resolveCollection
/**
* Resolves all permissions of the same class as the specified target
* permission and adds them to the specified collection. If passed
* collection is {@code null} and some unresolved permissions were resolved,
* an appropriate new collection is instantiated and used. All resolved
* permissions are removed from this unresolved collection, and collection
* with resolved ones is returned.
*
* @param target
* a kind of permissions to be resolved.
* @param holder
* an existing collection for storing resolved permissions.
* @return a collection containing resolved permissions (if any found)
*/
internal PermissionCollection resolveCollection(Permission target,
PermissionCollection holder)
{
String klass = target.getClass().getName();
if (klasses.containsKey(klass))
{
lock (klasses)
{
java.util.Collection<Object> klassMates = (java.util.Collection<Object>)klasses.get(klass);
for (java.util.Iterator<Object> iter = klassMates.iterator(); iter.hasNext(); )
{
UnresolvedPermission element = (UnresolvedPermission)iter
.next();
Permission resolved = element.resolve(target.getClass());
if (resolved != null)
{
if (holder == null)
{
holder = target.newPermissionCollection();
if (holder == null)
{
holder = new PermissionsHash();
}
}
holder.add(resolved);
iter.remove();
}
}
if (klassMates.size() == 0)
{
klasses.remove(klass);
}
}
}
return holder;
}