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. package java.security;
  8. /**
  9. * This interface represents the abstract notion of a principal, which
  10. * can be used to represent any entity, such as an individual, a
  11. * corporation, and a login id.
  12. *
  13. * @see java.security.cert.X509Certificate
  14. *
  15. * @version 1.22, 03/12/19
  16. * @author Li Gong
  17. */
  18. public interface Principal {
  19. /**
  20. * Compares this principal to the specified object. Returns true
  21. * if the object passed in matches the principal represented by
  22. * the implementation of this interface.
  23. *
  24. * @param another principal to compare with.
  25. *
  26. * @return true if the principal passed in is the same as that
  27. * encapsulated by this principal, and false otherwise.
  28. */
  29. public boolean equals(Object another);
  30. /**
  31. * Returns a string representation of this principal.
  32. *
  33. * @return a string representation of this principal.
  34. */
  35. public String toString();
  36. /**
  37. * Returns a hashcode for this principal.
  38. *
  39. * @return a hashcode for this principal.
  40. */
  41. public int hashCode();
  42. /**
  43. * Returns the name of this principal.
  44. *
  45. * @return the name of this principal.
  46. */
  47. public String getName();
  48. }