Errai 3.0.1-SNAPSHOT

org.jboss.errai.security.client.local.context
Class BasicUserCacheImpl

java.lang.Object
  extended by org.jboss.errai.security.client.local.context.BasicUserCacheImpl
All Implemented Interfaces:
ActiveUserCache

@ApplicationScoped
public class BasicUserCacheImpl
extends Object
implements ActiveUserCache

Author:
Max Barkley

Constructor Summary
BasicUserCacheImpl()
           
 
Method Summary
 User getUser()
           
 boolean hasUser()
          When this returns false, calls to ActiveUserCache.getUser() will return User.ANONYMOUS.
 void invalidateCache()
          Invalidate the cached User.
 boolean isValid()
           
 void setUser(User user)
          Set the currently logged in User.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicUserCacheImpl

public BasicUserCacheImpl()
Method Detail

getUser

public User getUser()
Specified by:
getUser in interface ActiveUserCache
Returns:
The currently logged in User. Never returns null. If no user is logged in, returns User.ANONYMOUS.

setUser

public void setUser(User user)
Description copied from interface: ActiveUserCache
Set the currently logged in User.

Specified by:
setUser in interface ActiveUserCache
Parameters:
user - The User currently logged in.

isValid

public boolean isValid()
Specified by:
isValid in interface ActiveUserCache
Returns:
False if the cached User has been invalidated.

invalidateCache

public void invalidateCache()
Description copied from interface: ActiveUserCache
Invalidate the cached User.

Specified by:
invalidateCache in interface ActiveUserCache

hasUser

public boolean hasUser()
Description copied from interface: ActiveUserCache
When this returns false, calls to ActiveUserCache.getUser() will return User.ANONYMOUS.

Specified by:
hasUser in interface ActiveUserCache
Returns:
True iff there is a cached User available from a recent login.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.