public class SimpleAccountManager extends NegativityAccountManager
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleAccountManager.Proxy |
static class |
SimpleAccountManager.Server |
| Modifier and Type | Field and Description |
|---|---|
protected Map<UUID,NegativityAccount> |
accounts |
| Constructor and Description |
|---|
SimpleAccountManager(boolean persistent) |
| Modifier and Type | Method and Description |
|---|---|
@Nullable NegativityAccount |
dispose(UUID accountId)
Indicates that the account for the given UUID can be forgotten by this manager.
|
CompletableFuture<NegativityAccount> |
get(UUID accountId)
Gets the account associated to the given UUID wrapped in a CompletableFuture.
|
CompletableFuture<Void> |
save(UUID accountId)
Saves the account associated to the given UUID.
|
void |
update(NegativityAccount account)
Makes this manager use the the given account's data instead of what it may have already.
|
getNowprotected final Map<UUID,NegativityAccount> accounts
public CompletableFuture<NegativityAccount> get(UUID accountId)
NegativityAccountManagerThe account may be returned directly (if cached for example), or loaded via potential (slow) IO operations.
Ideally, cancelling the returned CompletableFuture will cancel the underlying (potentially slow) operations to avoid wasting resources.
get in class NegativityAccountManageraccountId - the ID of the account to getNegativityAccountManager.getNow(java.util.UUID)public CompletableFuture<Void> save(UUID accountId)
NegativityAccountManagersave in class NegativityAccountManageraccountId - the ID of the account to savepublic void update(NegativityAccount account)
NegativityAccountManagerupdate in class NegativityAccountManageraccount - the account to usepublic @Nullable NegativityAccount dispose(UUID accountId)
NegativityAccountManagerWhat this method does is completely up to the implementing class, it may do nothing, or remove the account from a cache for example.
If an implementation caches accounts, the returned account would be the one removed from its cache.
dispose in class NegativityAccountManageraccountId - the ID of the account to dispose