@Test public void testSerialization() { SomePermission perm = new SomePermission("name"); SerializedPermission obj = (SerializedPermission) perm.writeReplace(); SomePermission resolved = (SomePermission) obj.readResolve(); assertEquals(perm, resolved); AbstractPermissionCollection permissions = perm.newPermissionCollection(); permissions.add(new SomePermission("otherName")); SerializedPermissionCollection obj2 = (SerializedPermissionCollection) permissions.writeReplace(); AbstractPermissionCollection resolvedCollection = (AbstractPermissionCollection) obj2.readResolve(); assertTrue(PermissionUtil.equals(permissions, resolvedCollection)); Iterator<Permission> iterator = resolvedCollection.iterator(); assertTrue(iterator.hasNext()); assertEquals(new SomePermission("otherName"), 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();  }