# Principal

public interface **Principal**

|---|---|---|
| Known Indirect Subclasses [GroupPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/GroupPrincipal.html), [UserPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/UserPrincipal.html), [X500Principal](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/x500/X500Principal.html) |---|---| | [GroupPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/GroupPrincipal.html) | A `UserPrincipal` representing a *group identity*, used to determine access rights to objects in a file system. | | [UserPrincipal](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/UserPrincipal.html) | A `Principal` representing an identity used to determine access rights to objects in a file system. | | [X500Principal](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/x500/X500Principal.html) | This class represents an X.500 `Principal`. | |||

This interface represents the abstract notion of a principal, which
can be used to represent any entity, such as an individual, a
corporation, and a login id.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/X509Certificate.html`

### Public Method Summary

|---|---|
| abstract boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Principal.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) another) Compares this principal to the specified object. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getName](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Principal.html#getName())() Returns the name of this principal. |
| abstract int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Principal.html#hashCode())() Returns a hashcode for this principal. |
| boolean | [implies](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Principal.html#implies(javax.security.auth.Subject))([Subject](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Subject.html) subject) Returns true if the specified subject is implied by this principal. |
| abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/Principal.html#toString())() Returns a string representation of this principal. |

## Public Methods

#### public abstract boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) another)

Compares this principal to the specified object. Returns true
if the object passed in matches the principal represented by
the implementation of this interface.

##### Parameters

| another | principal to compare with. |
|---|---|

##### Returns

- true if the principal passed in is the same as that encapsulated by this principal, and false otherwise.

#### public abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getName**
()

Returns the name of this principal.

##### Returns

- the name of this principal.

#### public abstract int
**hashCode**
()

Returns a hashcode for this principal.

##### Returns

- a hashcode for this principal.

#### public boolean
**implies**
([Subject](https://developers.google.com/j2objc/javadoc/jre/reference/javax/security/auth/Subject.html) subject)

Returns true if the specified subject is implied by this principal.

The default implementation of this method returns true if
`subject` is non-null and contains at least one principal that
is equal to this principal.

Subclasses may override this with a different implementation, if
necessary.

##### Parameters

| subject | the `Subject` |
|---|---|

##### Returns

- true if `subject` is non-null and is implied by this principal, or false otherwise.

#### public abstract [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns a string representation of this principal.

##### Returns

- a string representation of this principal.