1 // jGABL2 - The Java Graph Algorithm Base Library
2 // Copyright (C) 2000-2006 Alexander Schwartz
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 //
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13
14 package net.sf.jgabl2.adapt;
15
16
17 /**
18 * Represents an object that is adaptable, that is,
19 * it can return an adapter of a requested type.
20 *
21 * @author Alexander Schwartz
22 * @since 0.5.0
23 */
24 public interface IGenericAdaptable {
25
26 /**
27 * Retrieves an adapter of the specified type <code>t</code>.
28 *
29 * @todo Can we get rid of the type parameter?
30 *
31 * @param <T> the type of the requested adapter
32 * @param clazz the type of the requested adapter
33 * @return an adapter of the requested type; may not be <code>null</code>
34 * @throws UnavailableAdapterException if and only if no such adapter is
35 * available
36 */
37 public <T> T getAdapter(Class<?> clazz)
38 throws UnavailableAdapterException;
39 }