Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: edu/emory/mathcs/util/security/auth/spi/passwd/GroupIDPrincipal.java


1   /*
2    * UserPrincipal.java
3    *
4    * Created on January 13, 2003, 6:36 PM
5    */
6   package edu.emory.mathcs.util.security.auth.spi.passwd;
7   
8   import java.security.*;
9   
10  
11  /**
12   * DOCUMENT ME!
13   *
14   * @author Drzewo
15   */
16  public class GroupIDPrincipal extends IDPrincipal implements Principal {
17      /** DOCUMENT ME! */
18      private final String name;
19  
20      /**
21       * Creates a new instance of GroupIDPrincipal
22       *
23       * @param name DOCUMENT ME!
24       */
25      public GroupIDPrincipal(String name) {
26          this.name = name;
27      }
28  
29      /**
30       * Returns the name of this principal.
31       *
32       * @return the name of this principal.
33       */
34      public String getName() {
35          return name;
36      }
37  
38      /**
39       * DOCUMENT ME!
40       *
41       * @return DOCUMENT ME!
42       */
43      public String toString() {
44          return ("GroupIDPrincipal: " + getName());
45      }
46  
47      /**
48       * Compares the specified Object with this <code>GroupIDPrincipal</code>.
49       * Returns true if the specified object is an instance of
50       * <code>GroupIDPrincipal</code> and has the same name as this
51       * GroupIDPrincipal
52       *
53       * @param object Object to be compared
54       *
55       * @return true if the specified Object is equal to this
56       *         <code>GroupIDPrincipal</code>.
57       */
58      public boolean equals(Object object) {
59          if (!(object instanceof GroupIDPrincipal)) {
60              return false;
61          }
62  
63          if (object == this) {
64              return true;
65          }
66  
67          if (getName().equals(((GroupIDPrincipal) object).getName())) {
68              return true;
69          }
70  
71          return false;
72      }
73  }