@Test public void testCollection() { final AbstractPermissionCollection collection = new SomePermission("xx").newPermissionCollection(); assertEquals(0, collection.size()); Iterator<Permission> iterator = collection.iterator(); assertFalse(iterator.hasNext()); collection.add(new SomePermission("name1")); collection.add(new SomePermission("name2")); assertEquals(2, collection.size()); iterator = collection.iterator(); assertTrue(iterator.hasNext()); assertNotNull(iterator.next()); assertTrue(iterator.hasNext()); assertNotNull(iterator.next()); assertFalse(iterator.hasNext()); assertTrue(collection.implies(new SomePermission("name1"))); assertTrue(collection.implies(new SomePermission("name2"))); assertFalse(collection.implies(new SomePermission("name3"))); assertFalse(collection.implies(new SomePermission("*"))); assertFalse(collection.implies(new SomeOtherPermission("name1"))); assertFalse(collection.implies(new SomeOtherPermission("name3"))); assertFalse(collection.implies(new SomeOtherPermission("*"))); collection.add(new SomePermission("*")); assertEquals(1, collection.size()); assertTrue(collection.implies(new SomePermission("name1"))); assertTrue(collection.implies(new SomePermission("name2"))); assertTrue(collection.implies(new SomePermission("name3"))); assertTrue(collection.implies(new SomePermission("*"))); assertFalse(collection.implies(new SomeOtherPermission("name1"))); assertFalse(collection.implies(new SomeOtherPermission("name3"))); assertFalse(collection.implies(new SomeOtherPermission("*"))); iterator = collection.iterator(); assertTrue(iterator.hasNext()); assertEquals(new SomePermission("*"), iterator.next()); assertFalse(iterator.hasNext()); }
public AbstractPermissionCollection newPermissionCollection() { return new ByNamePermissionCollection(this); }
AbstractNameOnlyPermission extends AbstractNamedPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return new ByNamePermissionCollection(this); } }
AbstractNameOnlyPermission extends AbstractNamedPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return new ByNamePermissionCollection(this); } protected  AbstractNameOnlyPermission(final String name); }
AbstractNameOnlyPermission extends AbstractNamedPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return new ByNamePermissionCollection(this); } protected  AbstractNameOnlyPermission(final String name); AbstractPermissionCollection newPermissionCollection(); }
AbstractNameOnlyPermission extends AbstractNamedPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return new ByNamePermissionCollection(this); } protected  AbstractNameOnlyPermission(final String name); AbstractPermissionCollection newPermissionCollection();  }