1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.ontotext.ordi;
19
20 import com.ontotext.ordi.exception.ORDIException;
21
22 /**
23 * Interface for ORDI classes to provide ability to retrieve the delegate
24 * instance when the instance in question is in fact proxy class.
25 *
26 * @see java.sql.Wrapper
27 * @author vassil
28 */
29 public interface Wrapper {
30
31 /**
32 * Returns true if this either implements the interface argument or is
33 * directly or indirectly a wrapper for an object that does.
34 *
35 * @param iface
36 * A Class defining an interface that the result must implement.
37 * @return an object that implements the interface. May be a proxy for the
38 * actual implementing object.
39 * @throws ORDIException
40 */
41 public boolean isWrapperFor(Class<?> iface) throws ORDIException;
42
43 /**
44 * Returns an object that implements the given interface to allow access to
45 * non-standard methods, or standard methods not exposed by the proxy.
46 *
47 * @param iface
48 * a Class defining an interface.
49 * @return true if this implements the interface or directly or indirectly
50 * wraps an object that does.
51 * @throws ORDIException
52 */
53 public <T> T unwrap(Class<T> iface) throws ORDIException;
54 }