/** * Get a read-only collection of the given permissions. * * @param permissions the permissions to assign * @return the read-only collection */ public static PermissionCollection readOnlyCollectionOf(Permission... permissions) { final int length = permissions.length; if (length == 0) { return EMPTY_PERMISSION_COLLECTION; } else { Permissions collection = new Permissions(); addAll(collection, Arrays.asList(permissions)); collection.setReadOnly(); return collection; } } }
public void setReadOnly() { perms.setReadOnly(); } }
private static PermissionCollection noPermissions() { final Permissions permissions = new Permissions(); permissions.setReadOnly(); return permissions; }
private static PermissionCollection copyPermissions(PermissionCollection permissionCollection) { final Permissions permissions = new Permissions(); final Enumeration<Permission> elements = permissionCollection.elements(); while (elements.hasMoreElements()) { permissions.add(elements.nextElement()); } permissions.setReadOnly(); return permissions; }
/** * Get a read-only collection of the given permissions. * * @param permissions the permissions to assign * @return the read-only collection */ public static PermissionCollection readOnlyCollectionOf(Permission... permissions) { final int length = permissions.length; if (length == 0) { return EMPTY_PERMISSION_COLLECTION; } else { Permissions collection = new Permissions(); addAll(collection, Arrays.asList(permissions)); collection.setReadOnly(); return collection; } } }
/** * Get a read-only collection of the given permissions. * * @param permissions the permissions to assign * @return the read-only collection */ public static PermissionCollection readOnlyCollectionOf(Permission... permissions) { final int length = permissions.length; if (length == 0) { return EMPTY_PERMISSION_COLLECTION; } else { Permissions collection = new Permissions(); addAll(collection, Arrays.asList(permissions)); collection.setReadOnly(); return collection; } } }
/** * Get a read-only collection of the given permissions. * * @param permissions the permissions to assign * @return the read-only collection */ public static PermissionCollection readOnlyCollectionOf(Permission... permissions) { final int length = permissions.length; if (length == 0) { return EMPTY_PERMISSION_COLLECTION; } else { Permissions collection = new Permissions(); addAll(collection, Arrays.asList(permissions)); collection.setReadOnly(); return collection; } } }
Permissions getAssembled() { if (assembled == null) { synchronized (this) { if (assembled == null) { final Permissions assembled = new Permissions(); for (PermissionFactory factory : factories) { if (factory != null) { final Permission permission = factory.construct(); if (permission != null) { assembled.add(permission); } } } assembled.setReadOnly(); this.assembled = assembled; } } } return assembled; }
Permissions getAssembled() { if (assembled == null) { synchronized (this) { if (assembled == null) { final Permissions assembled = new Permissions(); for (PermissionFactory factory : factories) { if (factory != null) { final Permission permission = factory.construct(); if (permission != null) { assembled.add(permission); } } } assembled.setReadOnly(); this.assembled = assembled; } } } return assembled; }
permissions.setReadOnly(); checkRequiredPermissions();