@Test public void testCollection() { final AbstractPermissionCollection collection = new SomePermission("name1").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 NameSetPermissionCollection.newInstance(this, nameEnumeration); }
AbstractNameSetOnlyPermission extends AbstractNameOnlyPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return NameSetPermissionCollection.newInstance(this, nameEnumeration); } }
AbstractNameSetOnlyPermission extends AbstractNameOnlyPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return NameSetPermissionCollection.newInstance(this, nameEnumeration); } protected  AbstractNameSetOnlyPermission(final String name, final StringEnumeration nameEnumeration); }
AbstractNameSetOnlyPermission extends AbstractNameOnlyPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return NameSetPermissionCollection.newInstance(this, nameEnumeration); } protected  AbstractNameSetOnlyPermission(final String name, final StringEnumeration nameEnumeration); AbstractPermissionCollection newPermissionCollection(); final boolean nameEquals(final String name); final boolean impliesName(final String name); }
AbstractNameSetOnlyPermission extends AbstractNameOnlyPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return NameSetPermissionCollection.newInstance(this, nameEnumeration); } protected  AbstractNameSetOnlyPermission(final String name, final StringEnumeration nameEnumeration); AbstractPermissionCollection newPermissionCollection(); final boolean nameEquals(final String name); final boolean impliesName(final String name);  }