Package dev.enola.data
Class MemoryRepositoryRW<T>
java.lang.Object
dev.enola.data.MemoryRepositoryRW<T>
- All Implemented Interfaces:
Provider<String,
,T> ProviderFromIRI<T>
,Repository<T>
,RepositoryRW<T>
,Store<T>
- Direct Known Subclasses:
ThingMemoryRepositoryRW
MemoryRepositoryRW is an in-memory
RepositoryRW
implemented using a ConcurrentHashMap
. It is suitable for us by multiple concurrent threads.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MemoryRepositoryRW
(com.google.common.collect.ImmutableList<Trigger<? extends T>> triggers) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.enola.data.ProviderFromIRI
get
Methods inherited from interface dev.enola.data.Repository
list, listIRI, stream
-
Constructor Details
-
MemoryRepositoryRW
-
-
Method Details
-
map
-
getIRI
-
merge
-
store
Description copied from interface:Store
Store a T.If this store already has this T, then it's replaced (entirely, not merged).
-
merge
Description copied from interface:Store
Merge a T into this store.If this store does not already have this T, then this does the same as
Store.store(Object)
.Otherwise, an implementation specific strategy "merges" the existing and new T in the store. Note that this strategy may well be "additive" - meaning you cannot "remove" (or "blank out") properties!
-
list
Description copied from interface:Repository
list() returns Ts directly (not just the IRIs, likeRepository.listIRI()
).This default implementation here just combines
Repository.listIRI()
andProviderFromIRI.get(String)
. Your subclass may be able to provide a more efficient and more "direct" implementation?- Specified by:
list
in interfaceRepository<T>
-
listIRI
- Specified by:
listIRI
in interfaceRepository<T>
-
get
Description copied from interface:Provider
Get.- Specified by:
get
in interfaceProvider<String,
T> - Specified by:
get
in interfaceProviderFromIRI<T>
- Parameters:
iri
- Key, never null- Returns:
- value, or null if there is no Value for the given key
-
trigger
-