comparison org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdaptable.d @ 105:bbe49769ec18

...
author Frank Benoit <benoit@tionex.de>
date Sun, 08 Nov 2009 12:42:30 +0100
parents bc29606a740c
children
comparison
equal deleted inserted replaced
104:88652073d1c2 105:bbe49769ec18
2 * Copyright (c) 2000, 2006 IBM Corporation and others. 2 * Copyright (c) 2000, 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/ 10 *******************************************************************************/
13 module org.eclipse.core.runtime.IAdaptable; 11 // Port to the D programming language:
12 // Frank Benoit <benoit@tionex.de>
13 module org.eclipse.core.runtimeIAdaptable;
14 14
15 import java.lang.all; 15 import java.lang.all;
16
16 17
17 /** 18 /**
18 * An interface for an adaptable object. 19 * An interface for an adaptable object.
19 * <p> 20 * <p>
20 * Adaptable objects can be dynamically extended to provide different 21 * Adaptable objects can be dynamically extended to provide different
21 * interfaces (or "adapters"). Adapters are created by adapter 22 * interfaces (or "adapters"). Adapters are created by adapter
22 * factories, which are in turn managed by type by adapter managers. 23 * factories, which are in turn managed by type by adapter managers.
23 * </p> 24 * </p>
24 * For example, 25 * For example,
25 * <pre> 26 * <pre>
26 * IAdaptable a = [some adaptable]; 27 * IAdaptable a = [some adaptable];
27 * IFoo x = (IFoo)a.getAdapter(IFoo.class); 28 * IFoo x = (IFoo)a.getAdapter(IFoo.class);
28 * if (x !is null) 29 * if (x != null)
29 * [do IFoo things with x] 30 * [do IFoo things with x]
30 * </pre> 31 * </pre>
31 * <p> 32 * <p>
32 * This interface can be used without OSGi running. 33 * This interface can be used without OSGi running.
33 * </p><p> 34 * </p><p>
43 * Returns an object which is an instance of the given class 44 * Returns an object which is an instance of the given class
44 * associated with this object. Returns <code>null</code> if 45 * associated with this object. Returns <code>null</code> if
45 * no such object can be found. 46 * no such object can be found.
46 * 47 *
47 * @param adapter the adapter class to look up 48 * @param adapter the adapter class to look up
48 * @return a object castable to the given class, 49 * @return a object castable to the given class,
49 * or <code>null</code> if this object does not 50 * or <code>null</code> if this object does not
50 * have an adapter for the given class 51 * have an adapter for the given class
51 */ 52 */
52 public Object getAdapter(ClassInfo adapter); 53 public Object getAdapter(Class adapter);
53 } 54 }