| 1 9 package org.jboss.portal.test.core.security; 10 11 import java.security.Principal ; 12 13 19 public class RolePrincipal implements Principal  20 { 21 22 private final String name; 23 24 public RolePrincipal(String name) 25 { 26 if (name == null) 27 { 28 throw new IllegalArgumentException ("Name cannot be null"); 29 } 30 this.name = name; 31 } 32 33 public String getName() 34 { 35 return name; 36 } 37 38 public boolean equals(Object obj) 39 { 40 if (obj == this) 41 { 42 return true; 43 } 44 if (obj instanceof RolePrincipal) 45 { 46 RolePrincipal other = (RolePrincipal)obj; 47 return other.name.equals(name); 48 } 49 return false; 50 } 51 52 public int hashCode() 53 { 54 return name.hashCode(); 55 } 56 57 } 58 | Popular Tags |