public abstract class BaseRepository<T extends ManagedEntity> extends Object implements Repository<T>
| Modifier and Type | Field and Description |
|---|---|
protected Extension<T> |
defaultExtension |
protected Map<String,T> |
mappings |
protected Map<String,Extension<T>> |
types |
| Constructor and Description |
|---|
BaseRepository(Class<T> clazz) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(Class<?> clazz)
Check if the given type of entity can be managed by this repository.
|
protected void |
atomicAdd(T entity)
Atomic add operation.
|
protected void |
atomicRemove(T entity)
Atomic remove operation.
|
protected T |
createFromConfig(String id,
io.vertx.core.json.JsonObject config)
Create entity based on
type defined given configuration. |
protected T |
createFromType(String id,
String type)
Create entity of given type.
|
T |
get(String id)
Get entity from repository by id.
|
Class<T> |
getEntityClass()
Get class of managed entities.
|
protected String |
getEntityName() |
protected Extension<T> |
getExtensionByType(String type,
boolean autoCreate) |
List<UsageStats> |
getUsageStats()
Get usage statistics of the repository.
|
void |
put(String id,
T entity)
Put a named entity into the repository.
|
void |
registerType(String type,
Extension<T> extension)
Register new type of entity to be manged in this repository.
|
protected void |
remove(String id)
Remove an entity and all its aliases(when
id is not an alias) based
on given id. |
String |
resolve(String name)
Resolve given name.
|
protected void |
update(String id,
io.vertx.core.json.JsonObject config) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOrCreateprotected final Map<String,Extension<T extends ManagedEntity>> types
protected final Map<String,T extends ManagedEntity> mappings
protected final Extension<T extends ManagedEntity> defaultExtension
protected String getEntityName()
protected T createFromType(String id, String type)
id - id of the entitytype - type of the entityprotected T createFromConfig(String id, io.vertx.core.json.JsonObject config)
type defined given configuration.id - id of the entityconfig - configuration in JSON formatprotected void atomicAdd(T entity)
entity - entityprotected void atomicRemove(T entity)
entity - entityprotected void remove(String id)
id is not an alias) based
on given id.id - id of the entity, could be an aliasprotected void update(String id, io.vertx.core.json.JsonObject config)
public Class<T> getEntityClass()
RepositorygetEntityClass in interface Repository<T extends ManagedEntity>public boolean accept(Class<?> clazz)
Repositoryaccept in interface Repository<T extends ManagedEntity>clazz - class of the entitypublic String resolve(String name)
Repositoryjdbc:clickhouse:{{ ch-server.somedomain }}/system will be resolved to
something like jdbc:clickhouse:127.0.0.1:8123/system.resolve in interface Repository<T extends ManagedEntity>name - name to resolvepublic List<UsageStats> getUsageStats()
RepositorygetUsageStats in interface Repository<T extends ManagedEntity>public void registerType(String type, Extension<T> extension)
RepositoryregisterType in interface Repository<T extends ManagedEntity>type - type of entity, defaults to extension class nameextension - extension for instantiate new type of entitypublic void put(String id, T entity)
Repositoryput in interface Repository<T extends ManagedEntity>id - id of the entity, could be nullentity - non-null entity to be addedpublic T get(String id)
Repositoryget in interface Repository<T extends ManagedEntity>id - id of the entityCopyright © 2019–2021. All rights reserved.