Skip to contentPackage: Wrapper
Wrapper
Coverage
1: /**
2: * Copyright (C) 2020 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: @FunctionalInterface
24: public interface Wrapper {
25:
26: /**
27: * Returns an object that implements the given interface to allow access to non-standard methods, or standard
28: * methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a
29: * proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the
30: * result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling unwrap
31: * recursively on the wrapped object or a proxy for that result. If the receiver is not a wrapper and does not
32: * implement the interface, then an {@link OntoDriverException} is thrown.
33: *
34: * @param cls The type of the required result
35: * @param <T> The type of the class modelled by this Class object
36: * @return An object implementing the interface
37: * @throws OntoDriverException If no matching object is found
38: */
39: <T> T unwrap(Class<T> cls) throws OntoDriverException;
40: }