|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wiki.auth.WikiPrincipal
public final class WikiPrincipal

A lightweight, immutable Principal class. WikiPrincipals can be created with and optional "type" to denote what type of user profile Principal it represents (FULL_NAME, WIKI_NAME, LOGIN_NAME). Types are used to determine suitable user and login Principals in classes like WikiSession. However, the type property of a WikiPrincipal does not affect a WikiPrincipal's logical equality or hash code; two WikiPrincipals with the same name but different types are still considered equal.
| Field Summary | |
|---|---|
static Comparator<Principal> |
COMPARATOR
Static instance of Comparator that allows Principals to be sorted. |
static String |
FULL_NAME
WikiPrincipal type denoting a user's full name. |
static Principal |
GUEST
Represents an anonymous user. |
static String |
LOGIN_NAME
WikiPrincipal type denoting a user's login name. |
static String |
UNSPECIFIED
Generic WikiPrincipal of unspecified type. |
static String |
WIKI_NAME
WikiPrincipal type denoting a user's wiki name. |
| Constructor Summary | |
|---|---|
protected |
WikiPrincipal()
For serialization purposes |
|
WikiPrincipal(String name)
Constructs a new WikiPrincipal with a given name and a type of UNSPECIFIED. |
|
WikiPrincipal(String name,
String type)
Constructs a new WikiPrincipal with a given name and optional type designator. |
| Method Summary | |
|---|---|
int |
compareTo(Principal o)
Allows comparisons to any other Principal objects. |
boolean |
equals(Object obj)
Two WikiPrincipals are considered equal if their
names are equal (case-sensitive). |
String |
getName()
Returns the wiki name of the Principal. |
String |
getType()
Returns the Principal "type": LOGIN_NAME, FULL_NAME,
WIKI_NAME or WIKI_NAME |
int |
hashCode()
The hashCode() returned for the WikiPrincipal is the same as for its name. |
String |
toString()
Returns a human-readable representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Principal GUEST
public static final String FULL_NAME
public static final String LOGIN_NAME
public static final String WIKI_NAME
public static final String UNSPECIFIED
public static final Comparator<Principal> COMPARATOR
| Constructor Detail |
|---|
protected WikiPrincipal()
public WikiPrincipal(String name)
UNSPECIFIED.
name - the name of the Principal
public WikiPrincipal(String name,
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.| Method Detail |
|---|
public String getName()
getName in interface Principalpublic boolean equals(Object obj)
WikiPrincipals are considered equal if their
names are equal (case-sensitive).
equals in interface Principalequals in class Objectobj - the object to compare
public int hashCode()
hashCode in interface PrincipalhashCode in class Objectpublic String getType()
LOGIN_NAME, FULL_NAME,
WIKI_NAME or WIKI_NAME
public String toString()
toString in interface PrincipaltoString in class Objectpublic int compareTo(Principal o)
compareTo in interface Comparable<Principal>o -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||