@Test public void testSerialize() { Acl attributes = new Acl(new Acl.UserAndRole(new Acl.CanonicalUser(""), new Acl.Role("w"))); Acl clone = new AclDictionary().deserialize(attributes.serialize(SerializerFactory.get())); assertEquals(attributes.get(new Acl.CanonicalUser()), clone.get(new Acl.CanonicalUser())); assertNotEquals(attributes, new Acl(new Acl.UserAndRole(new Acl.CanonicalUser("t"), new Acl.Role("w")))); assertEquals(attributes.get(new Acl.CanonicalUser()), clone.get(new Acl.CanonicalUser())); assertNotEquals(attributes.get(new Acl.CanonicalUser()), new Acl(new Acl.UserAndRole(new Acl.CanonicalUser(""), new Acl.Role("r"))).get(new Acl.CanonicalUser())); }
public <T> Acl deserialize(T serialized) { final Deserializer<?> dict = deserializer.create(serialized); final Acl acl = new Acl(); final List<String> keys = dict.keys(); for(String key : keys) { final List<Object> rolesObj = dict.listForKey(key); for(Object roleObj : rolesObj) { final Acl.Role role = new Acl.RoleDictionary(deserializer).deserialize(roleObj); acl.addAll(new Acl.CanonicalUser(key), role); } } return acl; }
AclDictionary { public <T> Acl deserialize(T serialized) { final Deserializer<?> dict = deserializer.create(serialized); final Acl acl = new Acl(); final List<String> keys = dict.keys(); for(String key : keys) { final List<Object> rolesObj = dict.listForKey(key); for(Object roleObj : rolesObj) { final Acl.Role role = new Acl.RoleDictionary(deserializer).deserialize(roleObj); acl.addAll(new Acl.CanonicalUser(key), role); } } return acl; } }
AclDictionary { public <T> Acl deserialize(T serialized) { final Deserializer<?> dict = deserializer.create(serialized); final Acl acl = new Acl(); final List<String> keys = dict.keys(); for(String key : keys) { final List<Object> rolesObj = dict.listForKey(key); for(Object roleObj : rolesObj) { final Acl.Role role = new Acl.RoleDictionary(deserializer).deserialize(roleObj); acl.addAll(new Acl.CanonicalUser(key), role); } } return acl; } AclDictionary();  AclDictionary(final DeserializerFactory deserializer); }
AclDictionary { public <T> Acl deserialize(T serialized) { final Deserializer<?> dict = deserializer.create(serialized); final Acl acl = new Acl(); final List<String> keys = dict.keys(); for(String key : keys) { final List<Object> rolesObj = dict.listForKey(key); for(Object roleObj : rolesObj) { final Acl.Role role = new Acl.RoleDictionary(deserializer).deserialize(roleObj); acl.addAll(new Acl.CanonicalUser(key), role); } } return acl; } AclDictionary();  AclDictionary(final DeserializerFactory deserializer); Acl deserialize(T serialized); }
AclDictionary { public <T> Acl deserialize(T serialized) { final Deserializer<?> dict = deserializer.create(serialized); final Acl acl = new Acl(); final List<String> keys = dict.keys(); for(String key : keys) { final List<Object> rolesObj = dict.listForKey(key); for(Object roleObj : rolesObj) { final Acl.Role role = new Acl.RoleDictionary(deserializer).deserialize(roleObj); acl.addAll(new Acl.CanonicalUser(key), role); } } return acl; } AclDictionary();  AclDictionary(final DeserializerFactory deserializer); Acl deserialize(T serialized);  }