From f4c3e2ff8cb4461723f40066f14adcd1191e86e6 Mon Sep 17 00:00:00 2001 From: Ben Alex Date: Sat, 26 Nov 2005 04:18:21 +0000 Subject: [PATCH] Use Spring Assert for cleaner code. --- .../acl/basic/NamedEntityObjectIdentity.java | 57 ++++++++----------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/core/src/main/java/org/acegisecurity/acl/basic/NamedEntityObjectIdentity.java b/core/src/main/java/org/acegisecurity/acl/basic/NamedEntityObjectIdentity.java index b38e265387..edf32a8eed 100644 --- a/core/src/main/java/org/acegisecurity/acl/basic/NamedEntityObjectIdentity.java +++ b/core/src/main/java/org/acegisecurity/acl/basic/NamedEntityObjectIdentity.java @@ -29,9 +29,6 @@ import java.lang.reflect.Method; * instance. Also offers a constructor that uses reflection to build the * identity information. *

- * - * @author Ben Alex - * @version $Id$ */ public class NamedEntityObjectIdentity implements AclObjectIdentity { //~ Instance fields ======================================================== @@ -42,18 +39,16 @@ public class NamedEntityObjectIdentity implements AclObjectIdentity { //~ Constructors =========================================================== public NamedEntityObjectIdentity(String classname, String id) { - if ((classname == null) || "".equals(classname)) { - throw new IllegalArgumentException("classname required"); - } - - if ((id == null) || "".equals(id)) { - throw new IllegalArgumentException("id required"); - } - + Assert.hasText(classname, "classname required"); + Assert.hasText(id, "id required"); this.classname = classname; this.id = id; } + protected NamedEntityObjectIdentity() { + throw new IllegalArgumentException("Cannot use default constructor"); + } + /** * Creates the NamedEntityObjectIdentity based on the passed * object instance. The passed object must provide a getId() @@ -83,30 +78,8 @@ public class NamedEntityObjectIdentity implements AclObjectIdentity { } } - protected NamedEntityObjectIdentity() { - throw new IllegalArgumentException("Cannot use default constructor"); - } - //~ Methods ================================================================ - /** - * Indicates the classname portion of the object identity. - * - * @return the classname (never null) - */ - public String getClassname() { - return classname; - } - - /** - * Indicates the instance identity portion of the object identity. - * - * @return the instance identity (never null) - */ - public String getId() { - return id; - } - /** * Important so caching operates properly. * @@ -138,6 +111,24 @@ public class NamedEntityObjectIdentity implements AclObjectIdentity { return false; } + /** + * Indicates the classname portion of the object identity. + * + * @return the classname (never null) + */ + public String getClassname() { + return classname; + } + + /** + * Indicates the instance identity portion of the object identity. + * + * @return the instance identity (never null) + */ + public String getId() { + return id; + } + /** * Important so caching operates properly. *