Package com.sun.grid.security.login

## Class GroupPrincipal

- java.lang.Object
- - com.sun.grid.security.login.GroupPrincipal

- All Implemented Interfaces:
    `java.io.Serializable`, `java.security.Principal`

      public class GroupPrincipal
      extends java.lang.Object
      implements java.security.Principal, java.io.Serializable

  Generic `Principal` represent a group of users
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GroupPrincipal​(long name, boolean primaryGroup)` | Create a `GroupPrincipal` using a user's group name.
    `GroupPrincipal​(java.lang.String name, boolean primaryGroup)` | Create a `GroupPrincipal` using a `String` representation of the user's group name.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object o)` | Compares the specified Object with this `NumericGroupPrincipal` for equality.
    `java.lang.String` | `getName()` | Return the user's group name for this `GroupPrincipal`.
    `int` | `hashCode()` | Return a hash code for this `NumericGroupPrincipal`.
    `boolean` | `isPrimaryGroup()` | Return whether this group represents the primary group to which this user belongs.
    `java.lang.String` | `toString()` | Return a string representation of this `NumericGroupPrincipal`.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.security.Principal

      `implies`

- - ### Constructor Detail

    - #### GroupPrincipal

          public GroupPrincipal​(java.lang.String name,
                                boolean primaryGroup)

      Create a `GroupPrincipal` using a `String` representation of the user's group name.

      Parameters:
        `name` - the user's group

        `primaryGroup` - true if the specified group represents the primary group to which this user belongs.
      Throws:
        `java.lang.NullPointerException` - if the `name` is `null`.

    - #### GroupPrincipal

          public GroupPrincipal​(long name,
                                boolean primaryGroup)

      Create a `GroupPrincipal` using a user's group name.

      Parameters:
        `name` - the user's group

        `primaryGroup` - true if the specified group represents the primary group to which this user belongs.

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Return the user's group name for this `GroupPrincipal`.

      Specified by:
        `getName` in interface `java.security.Principal`
      Returns:
        the user's group name this `GroupPrincipal`

    - #### isPrimaryGroup

          public boolean isPrimaryGroup()

      Return whether this group represents the primary group to which this user belongs.

      Returns:
        true if this name of the group represents the primary group to which this user belongs, or false otherwise.

    - #### toString

          public java.lang.String toString()

      Return a string representation of this `NumericGroupPrincipal`.

      Specified by:
        `toString` in interface `java.security.Principal`
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of this `NumericGroupPrincipal`.

    - #### equals

          public boolean equals​(java.lang.Object o)

      Compares the specified Object with this `NumericGroupPrincipal` for equality. Returns true if the given object is also a `NumericGroupPrincipal` and the two NumericGroupPrincipals have the same group identification number (GID).

      Specified by:
        `equals` in interface `java.security.Principal`
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `o` - Object to be compared for equality with this `NumericGroupPrincipal`.
      Returns:
        true if the specified Object is equal equal to this `NumericGroupPrincipal`.

    - #### hashCode

          public int hashCode()

      Return a hash code for this `NumericGroupPrincipal`.

      Specified by:
        `hashCode` in interface `java.security.Principal`
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        a hash code for this `NumericGroupPrincipal`.