View Javadoc

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  import net.sf.jgabl2.adapt.impl.GenericAdapterManagerImpl;
17  
18  /**
19   * An manager for adapters of objects.
20   * Resembles the adapter mechanism of Eclipse.
21   *
22   * @author Alexander Schwartz
23   * @since 0.5.0
24   */
25  public interface IGenericAdapterManager {
26  
27      /** The default implementation. */
28      public static final IGenericAdapterManager DEFAULT_INSTANCE
29          = new GenericAdapterManagerImpl();
30  
31      /**
32       * Retrieves an adapter of the specified type <code>t</code>.
33       *
34       * @todo Can we get rid of the type parameter?
35       *
36       * @param object the object to be adapted
37       * @param type the type of the requested adapter
38       * @param <AdapterType> the type of the requested adapter
39       *
40       * @return an adapter of the requested type; may not be <code>null</code>
41       * @throws UnavailableAdapterException if and only if no such adapter is
42       *                     available
43       */
44      <AdapterType> AdapterType getAdapter(Object object, Class<?> type)
45              throws UnavailableAdapterException;
46  }