Use Spring Assert for cleaner code.
This commit is contained in:
parent
e53a00371c
commit
f4c3e2ff8c
|
@ -29,9 +29,6 @@ import java.lang.reflect.Method;
|
|||
* instance. Also offers a constructor that uses reflection to build the
|
||||
* identity information.
|
||||
* </p>
|
||||
*
|
||||
* @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 <code>NamedEntityObjectIdentity</code> based on the passed
|
||||
* object instance. The passed object must provide a <code>getId()</code>
|
||||
|
@ -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 <code>null</code>)
|
||||
*/
|
||||
public String getClassname() {
|
||||
return classname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the instance identity portion of the object identity.
|
||||
*
|
||||
* @return the instance identity (never <code>null</code>)
|
||||
*/
|
||||
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 <code>null</code>)
|
||||
*/
|
||||
public String getClassname() {
|
||||
return classname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the instance identity portion of the object identity.
|
||||
*
|
||||
* @return the instance identity (never <code>null</code>)
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Important so caching operates properly.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue