1 53 package org.bsf.remoting.util; 54 55 import java.io.Serializable ; 56 import java.security.Principal ; 57 58 61 public class DefaultPrincipal implements Principal , Serializable { 62 63 private String name; 64 65 public DefaultPrincipal(String name) { 66 if (name == null) throw new NullPointerException (); 67 this.name = name; 68 } 69 70 public String getName() { 71 return name; 72 } 73 74 public int hashCode() { 75 return name.hashCode(); 76 } 77 78 public boolean equals(Object obj) { 79 if (!(obj instanceof DefaultPrincipal)) return false; 80 return ((DefaultPrincipal) obj).getName().equals(name); 81 } 82 83 public String toString() { 84 return name; 85 } 86 } | Popular Tags |