Skip to content

Package: Wrapper

Wrapper

Coverage

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.ontodriver;
16:
17: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
18:
19: /**
20: * Interface for retrieving concrete implementations of the OntoDriver API and/or classes the implementations use (e.g.
21: * classes of the underlying storage framework).
22: */
23: public interface Wrapper {
24:
25: /**
26: * Returns an object that implements the given interface to allow access to non-standard methods, or standard
27: * methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a
28: * proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the
29: * result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling unwrap
30: * recursively on the wrapped object or a proxy for that result. If the receiver is not a wrapper and does not
31: * implement the interface, then an {@link OntoDriverException} is thrown.
32: *
33: * @param cls The type of the required result
34: * @param <T> The type of the class modelled by this Class object
35: * @return An object implementing the interface
36: * @throws OntoDriverException If no matching object is found
37: */
38: <T> T unwrap(Class<T> cls) throws OntoDriverException;
39: }