1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2000,2008 Oracle.  All rights reserved.
5 *
6 * $Id: EntryBinding.java,v 12.7 2008/02/08 20:12:36 mark Exp $
7 */
8
9package com.sleepycat.bind;
10
11import com.sleepycat.db.DatabaseEntry;
12
13/**
14 * A binding between a key or data entry and a key or data object.
15 *
16 * <p><em>WARNING:</em> Binding instances are typically shared by multiple
17 * threads and binding methods are called without any special synchronization.
18 * Therefore, bindings must be thread safe.  In general no shared state should
19 * be used and any caching of computed values must be done with proper
20 * synchronization.</p>
21 *
22 * @author Mark Hayes
23 */
24public interface EntryBinding {
25
26    /**
27     * Converts a entry buffer into an Object.
28     *
29     * @param entry is the source entry buffer.
30     *
31     * @return the resulting Object.
32     */
33    Object entryToObject(DatabaseEntry entry);
34
35    /**
36     * Converts an Object into a entry buffer.
37     *
38     * @param object is the source Object.
39     *
40     * @param entry is the destination entry buffer.
41     */
42    void objectToEntry(Object object, DatabaseEntry entry);
43}
44