1   package eu.fbk.knowledgestore.triplestore;
2   
3   import java.io.IOException;
4   
5   import com.google.common.collect.ForwardingObject;
6   
7   
8   /**
9    * A {@code TripleStore} that forwards all its method calls to another {@code TripleStore}.
10   * <p>
11   * This class provides a starting point for implementing the decorator pattern on top of the
12   * {@code TripleStore} interface. Subclasses must implement method {@link #delegate()} and
13   * override the methods of {@code TripleStore} they want to decorate.
14   * </p>
15   */
16  public abstract class ForwardingTripleStore extends ForwardingObject implements TripleStore {
17  
18      @Override
19      protected abstract TripleStore delegate();
20  
21      @Override
22      public void init() throws IOException {
23          delegate().init();
24      }
25  
26      @Override
27      public TripleTransaction begin(final boolean readOnly) throws IOException {
28          return delegate().begin(readOnly);
29      }
30  
31      @Override
32      public void reset() throws IOException {
33          delegate().reset();
34      }
35  
36      @Override
37      public void close() {
38          delegate().close();
39      }
40  
41  }