1 7 8 package com.sun.security.auth; 9 10 import java.security.Principal ; 11 12 27 public final class UserPrincipal implements Principal , java.io.Serializable { 28 29 private static final long serialVersionUID = 892106070870210969L; 30 31 36 private final String name; 37 38 45 public UserPrincipal(String name) { 46 if (name == null) { 47 throw new NullPointerException ("null name is illegal"); 48 } 49 this.name = name; 50 } 51 52 58 public boolean equals(Object object) { 59 if (this == object) { 60 return true; 61 } 62 if (object instanceof UserPrincipal) { 63 return name.equals(((UserPrincipal)object).getName()); 64 } 65 return false; 66 } 67 68 73 public int hashCode() { 74 return name.hashCode(); 75 } 76 77 82 public String getName() { 83 return name; 84 } 85 86 91 public String toString() { 92 return name; 93 } 94 } 95 | Popular Tags |