View Javadoc

1   /*
2    * Copyright (c) 2006-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.danube.adapter;
14  
15  /**
16   * This interface is insipired by the similar from eclipse project
17   *
18   * @author Daniel Sendula
19   */
20  public interface AdapterFactory {
21  
22      /**
23       * Adopts given object to the instance of the asked class
24       * @param object object to he adopted
25       * @param cls asked class
26       * @return adopted given object to the instance of the asked class
27       */
28      <T> T adapt(T object, Class<T> cls);
29  
30      /**
31       * Returns list of classes to which given object can be adopted to by this adopter factory
32       * @return list of classes to which given object can be adopted to
33       */
34      <T> Class<T>[] getAdaptingClasses(T object);
35  
36  }