Modifier and Type | Field and Description |
---|---|
private static User |
anonymous
The anonymous user is a local user used in places where no user is known.
|
private static User |
lastUser |
private Set<String> |
names
the user name
|
private long |
uid
the user id
|
private static long |
uidCounter |
private static Map<Long,User> |
userMap
the map of known users
|
Modifier | Constructor and Description |
---|---|
private |
User(long uid,
String name)
Private constructor, only called from get method.
|
Modifier and Type | Method and Description |
---|---|
void |
addName(String name)
Adds a user name to the list if it is not there, yet.
|
static void |
clearUserMap()
clears the static map of user ids to user objects
|
static User |
createLocalUser(String name)
Creates a local user with the given name
|
static User |
createOsmUser(long uid,
String name)
Creates a user known to the OSM server
|
boolean |
equals(Object obj) |
static User |
getAnonymous()
Replies the anonymous user
|
static User |
getById(long uid)
Returns the user with user id
uid or null if this user doesn't exist |
static List<User> |
getByName(String name)
Returns the list of users with name
name or the empty list if
no such users exist |
long |
getId()
Replies the user id.
|
String |
getName()
Replies the user name
|
List<String> |
getNames()
Returns the list of user names
|
private static long |
getNextLocalUid() |
int |
hashCode() |
boolean |
hasName(String name)
Returns true if the name is in the names list
|
boolean |
isLocalUser()
Determines if this user is local
|
boolean |
isOsmUser()
Determines if this user is known to OSM
|
String |
toString() |
private static long uidCounter
private static final User anonymous
getAnonymous()
private final long uid
private static long getNextLocalUid()
public static User createLocalUser(String name)
name
- the namepublic static User createOsmUser(long uid, String name)
uid
- the user idname
- the namepublic static void clearUserMap()
public static User getById(long uid)
uid
or null if this user doesn't existuid
- the user idpublic static List<User> getByName(String name)
name
or the empty list if
no such users existname
- the user namename
or the empty list if
no such users existpublic static User getAnonymous()
public String getName()
null
, but may be the empty stringpublic void addName(String name)
name
- User namepublic boolean hasName(String name)
name
- User nametrue
if the name is in the names listpublic long getId()
public boolean isOsmUser()
true
if this user is known to OSM, false
otherwisepublic boolean isLocalUser()
true
if this user is local, false
otherwise