comparison dwtx/core/runtime/PlatformObject.d @ 122:9d0585bcb7aa

Add core.jobs package
author Frank Benoit <benoit@tionex.de>
date Tue, 12 Aug 2008 02:34:21 +0200
parents
children 3d684126a966
comparison
equal deleted inserted replaced
121:c0304616ea23 122:9d0585bcb7aa
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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.core.runtime.PlatformObject;
14
15 import dwt.dwthelper.utils;
16
17 import dwtx.core.runtime.IAdaptable;
18 // import dwtx.core.internal.runtime.AdapterManager;
19
20 /**
21 * An abstract superclass implementing the <code>IAdaptable</code>
22 * interface. <code>getAdapter</code> invocations are directed
23 * to the platform's adapter manager.
24 * <p>
25 * Note: In situations where it would be awkward to subclass this
26 * class, the same affect can be achieved simply by implementing
27 * the {@link IAdaptable} interface and explicitly forwarding
28 * the <code>getAdapter</code> request to an implementation
29 * of the {@link IAdapterManager} service. The method would look like:
30 * <pre>
31 * public Object getAdapter(Class adapter) {
32 * IAdapterManager manager = ...;//lookup the IAdapterManager service
33 * return manager.getAdapter(this, adapter);
34 * }
35 * </pre>
36 * </p><p>
37 * This class can be used without OSGi running.
38 * </p><p>
39 * Clients may subclass.
40 * </p>
41 *
42 * @see IAdapterManager
43 * @see IAdaptable
44 */
45 public abstract class PlatformObject : IAdaptable {
46 /**
47 * Constructs a new platform object.
48 */
49 public this() {
50 super();
51 }
52
53 /**
54 * Returns an object which is an instance of the given class
55 * associated with this object. Returns <code>null</code> if
56 * no such object can be found.
57 * <p>
58 * This implementation of the method declared by <code>IAdaptable</code>
59 * passes the request along to the platform's adapter manager; roughly
60 * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
61 * Subclasses may override this method (however, if they do so, they
62 * should invoke the method on their superclass to ensure that the
63 * Platform's adapter manager is consulted).
64 * </p>
65 *
66 * @param adapter the class to adapt to
67 * @return the adapted object or <code>null</code>
68 * @see IAdaptable#getAdapter(Class)
69 */
70 public Object getAdapter(ClassInfo adapter) {
71 implMissing( __FILE__, __LINE__ );
72 return null;
73 // return AdapterManager.getDefault().getAdapter(this, adapter);
74 }
75 }