summaryrefslogtreecommitdiff
path: root/src/main/java/com/p4square/grow/provider/Provider.java
blob: ca6af2507ea3e8180c1077ac18e71d26a10c09fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright 2013 Jesse Morgan
 */

package com.p4square.grow.provider;

import java.io.IOException;

/**
 * Provider provides a simple interface for loading and persisting
 * objects.
 *
 * @author Jesse Morgan <jesse@jesterpm.net>
 */
public interface Provider<K, V> {
    /**
     * Retrieve the object with the given key.
     *
     * @param key The key for the object.
     * @return The object or null if not found.
     */
    V get(K key) throws IOException;

    /**
     * Persist the object with the given key.
     *
     * @param key The key for the object.
     * @param obj The object to persist.
     */
    void put(K key, V obj) throws IOException;
}