Package net.morimekta.providence.storage
Class InMemoryMessageListStore<K,M extends net.morimekta.providence.PMessage<M,F>,F extends net.morimekta.providence.descriptor.PField>
- java.lang.Object
-
- net.morimekta.providence.storage.InMemoryMessageListStore<K,M,F>
-
- All Implemented Interfaces:
MessageListReadOnlyStore<K,M,F>
,MessageListStore<K,M,F>
,ReadOnlyStore<K,java.util.List<M>>
,ReadWriteStore<K,java.util.List<M>>
public class InMemoryMessageListStore<K,M extends net.morimekta.providence.PMessage<M,F>,F extends net.morimekta.providence.descriptor.PField> extends java.lang.Object implements MessageListStore<K,M,F>
Simple in-memory storage of lists providence messages. Uses a local hash map for storing the instances.The store is thread safe through using reentrand read-write mutex handling, so reading can happen in parallel.
-
-
Constructor Summary
Constructors Constructor Description InMemoryMessageListStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(K key)
java.util.Map<K,java.util.List<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,java.util.List<M>>
putAll(java.util.Map<K,java.util.List<M>> values)
java.util.Map<K,java.util.List<M>>
removeAll(java.util.Collection<K> keys)
Remove the values for the given keys.-
Methods inherited from interface net.morimekta.providence.storage.MessageListReadOnlyStore
getAllBuilders, getBuilders
-
Methods inherited from interface net.morimekta.providence.storage.MessageListStore
putAllBuilders, putBuilders
-
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.ReadOnlyStore
get
-
Methods inherited from interface net.morimekta.providence.storage.ReadWriteStore
put, remove
-
-
-
-
Method Detail
-
getAll
@Nonnull public java.util.Map<K,java.util.List<M>> getAll(@Nonnull java.util.Collection<K> keys)
Description copied from interface:ReadOnlyStore
Look up a set of keys from the storage.
-
containsKey
public boolean containsKey(@Nonnull K key)
- Specified by:
containsKey
in 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:ReadOnlyStore
Get a collection of all the keys in the store.
-
putAll
@Nonnull public java.util.Map<K,java.util.List<M>> putAll(@Nonnull java.util.Map<K,java.util.List<M>> values)
- Specified by:
putAll
in interfaceReadWriteStore<K,M extends net.morimekta.providence.PMessage<M,F>>
- Parameters:
values
- Put all key value pairs form this map into the storage.- Returns:
- Immutable map of replaced values. Values not already present should not have an entry in the result map (no key -> null mapping).
-
removeAll
@Nonnull public java.util.Map<K,java.util.List<M>> removeAll(java.util.Collection<K> keys)
Description copied from interface:ReadWriteStore
Remove the values for the given keys.
-
-