public final class WikiPrincipal
extends java.lang.Object
implements java.security.Principal, java.lang.Comparable<java.security.Principal>, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<java.security.Principal> |
COMPARATOR
Static instance of Comparator that allows Principals to be sorted.
|
static java.lang.String |
FULL_NAME
WikiPrincipal type denoting a user's full name.
|
static java.security.Principal |
GUEST
Represents an anonymous user.
|
static java.lang.String |
LOGIN_NAME
WikiPrincipal type denoting a user's login name.
|
static java.lang.String |
UNSPECIFIED
Generic WikiPrincipal of unspecified type.
|
static java.lang.String |
WIKI_NAME
WikiPrincipal type denoting a user's wiki name.
|
Modifier | Constructor and Description |
---|---|
protected |
WikiPrincipal()
For serialization purposes
|
|
WikiPrincipal(java.lang.String name)
Constructs a new WikiPrincipal with a given name and a type of
UNSPECIFIED . |
|
WikiPrincipal(java.lang.String name,
java.lang.String type)
Constructs a new WikiPrincipal with a given name and optional type
designator.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.security.Principal o)
Allows comparisons to any other Principal objects.
|
boolean |
equals(java.lang.Object obj)
Two
WikiPrincipal s are considered equal if their
names are equal (case-sensitive). |
java.lang.String |
getName()
Returns the wiki name of the Principal.
|
java.lang.String |
getType()
|
int |
hashCode()
The hashCode() returned for the WikiPrincipal is the same as
for its name.
|
java.lang.String |
toString()
Returns a human-readable representation of the object.
|
public static final java.security.Principal GUEST
public static final java.lang.String FULL_NAME
public static final java.lang.String LOGIN_NAME
public static final java.lang.String WIKI_NAME
public static final java.lang.String UNSPECIFIED
public static final java.util.Comparator<java.security.Principal> COMPARATOR
protected WikiPrincipal()
public WikiPrincipal(java.lang.String name)
UNSPECIFIED
.name
- the name of the Principalpublic WikiPrincipal(java.lang.String name, java.lang.String type)
type
parameter is not
LOGIN_NAME
, FULL_NAME
, WIKI_NAME
or WIKI_NAME
, this method throws
an IllegalArgumentException
.name
- the name of the Principaltype
- the type for this principal, which may be LOGIN_NAME
,
FULL_NAME
, WIKI_NAME
or WIKI_NAME
.public java.lang.String getName()
getName
in interface java.security.Principal
@CheckReturnValue public boolean equals(java.lang.Object obj)
WikiPrincipal
s are considered equal if their
names are equal (case-sensitive).equals
in interface java.security.Principal
equals
in class java.lang.Object
obj
- the object to compare@CheckReturnValue public int hashCode()
hashCode
in interface java.security.Principal
hashCode
in class java.lang.Object
public java.lang.String getType()
@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in interface java.security.Principal
toString
in class java.lang.Object
public int compareTo(java.security.Principal o)
compareTo
in interface java.lang.Comparable<java.security.Principal>
o
- stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.