Package net.morimekta.providence.storage
Class InMemoryMessageSetStore<K,M extends net.morimekta.providence.PMessage<M,F>,F extends net.morimekta.providence.descriptor.PField>
- java.lang.Object
-
- net.morimekta.providence.storage.InMemoryMessageSetStore<K,M,F>
-
- All Implemented Interfaces:
MessageReadOnlyStore<K,M,F>,MessageSetStore<K,M,F>,ReadOnlyStore<K,M>,ReadWriteSetStore<K,M>
public class InMemoryMessageSetStore<K,M extends net.morimekta.providence.PMessage<M,F>,F extends net.morimekta.providence.descriptor.PField> extends java.lang.Object implements MessageSetStore<K,M,F>
Simple in-memory set storage of providence messages. Uses a local hash map for storing the instances. The store is thread safe through using re-entrant read-write mutex handling, so reading can happen in parallel.
-
-
Constructor Summary
Constructors Constructor Description InMemoryMessageSetStore(java.util.function.Function<M,K> messageToKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(K key)java.util.Map<K,M>getAll(java.util.Collection<K> keys)Look up a set of keys from the storage.java.util.Collection<K>keys()Get a collection of all the keys in the store.java.util.Map<K,M>putAll(java.util.Collection<M> values)java.util.Map<K,M>removeAll(java.util.Collection<K> keys)Remove the values for the given keys.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.morimekta.providence.storage.MessageReadOnlyStore
getAllBuilders, getBuilder
-
Methods inherited from interface net.morimekta.providence.storage.MessageSetStore
putAllBuilders, putBuilder
-
Methods inherited from interface net.morimekta.providence.storage.ReadOnlyStore
get, size
-
Methods inherited from interface net.morimekta.providence.storage.ReadWriteSetStore
put, remove
-
-
-
-
Method Detail
-
getAll
@Nonnull public java.util.Map<K,M> getAll(@Nonnull java.util.Collection<K> keys)
Description copied from interface:ReadOnlyStoreLook up a set of keys from the storage.
-
containsKey
public boolean containsKey(@Nonnull K key)- Specified by:
containsKeyin interfaceReadOnlyStore<K,M extends net.morimekta.providence.PMessage<M,F>>- Parameters:
key- The key to look up.- Returns:
- True if the key was contained in the map.
-
keys
@Nonnull public java.util.Collection<K> keys()
Description copied from interface:ReadOnlyStoreGet a collection of all the keys in the store.
-
removeAll
@Nonnull public java.util.Map<K,M> removeAll(java.util.Collection<K> keys)
Description copied from interface:ReadWriteSetStoreRemove the values for the given keys.
-
-