1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 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 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.core.runtime; 12 13 /** 14 * An adapter factory defines behavioral extensions for 15 * one or more classes that implements the <code>IAdaptable</code> 16 * interface. Adapter factories are registered with an 17 * adapter manager. 18 * <p> 19 * This interface can be used without OSGi running. 20 * </p><p> 21 * Clients may implement this interface. 22 * </p> 23 * @see IAdapterManager 24 * @see IAdaptable 25 */ 26 public interface IAdapterFactory { 27 /** 28 * Returns an object which is an instance of the given class 29 * associated with the given object. Returns <code>null</code> if 30 * no such object can be found. 31 * 32 * @param adaptableObject the adaptable object being queried 33 * (usually an instance of <code>IAdaptable</code>) 34 * @param adapterType the type of adapter to look up 35 * @return a object castable to the given adapter type, 36 * or <code>null</code> if this adapter factory 37 * does not have an adapter of the given type for the 38 * given object 39 */ 40 public Object getAdapter(Object adaptableObject, Class adapterType); 41 42 /** 43 * Returns the collection of adapter types handled by this 44 * factory. 45 * <p> 46 * This method is generally used by an adapter manager 47 * to discover which adapter types are supported, in advance 48 * of dispatching any actual <code>getAdapter</code> requests. 49 * </p> 50 * 51 * @return the collection of adapter types 52 */ 53 public Class[] getAdapterList(); 54 } 55