1 7 8 9 package javax.management.remote; 10 11 import java.io.Serializable ; 12 import java.security.Principal ; 13 14 30 public class JMXPrincipal implements Principal , Serializable { 31 32 private static final long serialVersionUID = -4184480100214577411L; 33 34 39 private String name; 40 41 49 public JMXPrincipal(String name) { 50 if (name == null) 51 throw new NullPointerException ("illegal null input"); 52 53 this.name = name; 54 } 55 56 63 public String getName() { 64 return name; 65 } 66 67 74 public String toString() { 75 return("JMXPrincipal: " + name); 76 } 77 78 92 public boolean equals(Object o) { 93 if (o == null) 94 return false; 95 96 if (this == o) 97 return true; 98 99 if (!(o instanceof JMXPrincipal )) 100 return false; 101 JMXPrincipal that = (JMXPrincipal )o; 102 103 return (this.getName().equals(that.getName())); 104 } 105 106 113 public int hashCode() { 114 return name.hashCode(); 115 } 116 } 117 | Popular Tags |