1 7 8 package com.sun.security.auth; 9 10 import java.security.Principal ; 11 12 27 public class UnixPrincipal implements Principal , java.io.Serializable { 28 29 private static final long serialVersionUID = -2951667807323493631L; 30 31 34 private String name; 35 36 46 public UnixPrincipal(String name) { 47 if (name == null) { 48 java.text.MessageFormat form = new java.text.MessageFormat 49 (sun.security.util.ResourcesMgr.getString 50 ("invalid null input: value", 51 "sun.security.util.AuthResources")); 52 Object [] source = {"name"}; 53 throw new NullPointerException (form.format(source)); 54 } 55 56 this.name = name; 57 } 58 59 66 public String getName() { 67 return name; 68 } 69 70 77 public String toString() { 78 java.text.MessageFormat form = new java.text.MessageFormat 79 (sun.security.util.ResourcesMgr.getString 80 ("UnixPrincipal: name", 81 "sun.security.util.AuthResources")); 82 Object [] source = {name}; 83 return form.format(source); 84 } 85 86 100 public boolean equals(Object o) { 101 if (o == null) 102 return false; 103 104 if (this == o) 105 return true; 106 107 if (!(o instanceof UnixPrincipal)) 108 return false; 109 UnixPrincipal that = (UnixPrincipal)o; 110 111 if (this.getName().equals(that.getName())) 112 return true; 113 return false; 114 } 115 116 123 public int hashCode() { 124 return name.hashCode(); 125 } 126 } 127 | Popular Tags |