1 /* 2 * @(#)Principal.java 1.22 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.security; 9 10 /** 11 * This interface represents the abstract notion of a principal, which 12 * can be used to represent any entity, such as an individual, a 13 * corporation, and a login id. 14 * 15 * @see java.security.cert.X509Certificate 16 * 17 * @version 1.22, 03/12/19 18 * @author Li Gong 19 */ 20 public interface Principal { 21 22 /** 23 * Compares this principal to the specified object. Returns true 24 * if the object passed in matches the principal represented by 25 * the implementation of this interface. 26 * 27 * @param another principal to compare with. 28 * 29 * @return true if the principal passed in is the same as that 30 * encapsulated by this principal, and false otherwise. 31 32 */ 33 public boolean equals(Object another); 34 35 /** 36 * Returns a string representation of this principal. 37 * 38 * @return a string representation of this principal. 39 */ 40 public String toString(); 41 42 /** 43 * Returns a hashcode for this principal. 44 * 45 * @return a hashcode for this principal. 46 */ 47 public int hashCode(); 48 49 /** 50 * Returns the name of this principal. 51 * 52 * @return the name of this principal. 53 */ 54 public String getName(); 55 } 56