diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2014-02-01 11:18:41 -0800 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2014-02-01 11:18:41 -0800 |
commit | 06dcb39ca435897b082a5d454a11ddb21f230799 (patch) | |
tree | 66bc8c14065c4b947b011c765d677b0b1e2b3c13 /src/com/p4square/grow/provider/CollectionProvider.java | |
parent | 331f4939eb8f983b5b85663d7549e604ef485b9a (diff) |
Adding the feed backend support.
Diffstat (limited to 'src/com/p4square/grow/provider/CollectionProvider.java')
-rw-r--r-- | src/com/p4square/grow/provider/CollectionProvider.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/com/p4square/grow/provider/CollectionProvider.java b/src/com/p4square/grow/provider/CollectionProvider.java new file mode 100644 index 0000000..e4e9040 --- /dev/null +++ b/src/com/p4square/grow/provider/CollectionProvider.java @@ -0,0 +1,59 @@ +/* + * Copyright 2013 Jesse Morgan + */ + +package com.p4square.grow.provider; + +import java.io.IOException; +import java.util.Map; + +/** + * ListProvider is the logical extension of Provider for dealing with lists of + * items. + * + * @param C The type of the collection key. + * @param K The type of the item key. + * @param V The type of the value. + * + * @author Jesse Morgan <jesse@jesterpm.net> + */ +public interface CollectionProvider<C, K, V> { + /** + * Retrieve a specific object from the collection. + * + * @param collection The collection key. + * @param key The key for the object in the collection. + * @return The object or null if not found. + */ + V get(C collection, K key) throws IOException; + + /** + * Retrieve a collection. + * + * The returned map will never be null. + * + * @param collection The collection key. + * @return A Map of keys to values. + */ + Map<K, V> query(C collection) throws IOException; + + /** + * Retrieve a portion of a collection. + * + * The returned map will never be null. + * + * @param collection The collection key. + * @param limit Max number of items to return. + * @return A Map of keys to values. + */ + Map<K, V> query(C collection, int limit) throws IOException; + + /** + * Persist the object with the given key. + * + * @param collection The collection key. + * @param key The key for the object in the collection. + * @param obj The object to persist. + */ + void put(C collection, K key, V obj) throws IOException; +} |