org.eclipse.equinox.common.src.org.eclipse.core.runtime.PlatformObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.diff.impl
Show all versions of com.liferay.diff.impl
Liferay Diff Implementation
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.core.runtime;
import org.eclipse.core.internal.runtime.AdapterManager;
/**
* An abstract superclass implementing the IAdaptable
* interface. getAdapter
invocations are directed
* to the platform's adapter manager.
*
* Note: In situations where it would be awkward to subclass this
* class, the same affect can be achieved simply by implementing
* the IAdaptable
interface and explicitly forwarding
* the getAdapter
request to the platform's
* adapter manager. The method would look like:
*
* public Object getAdapter(Class adapter) {
* return Platform.getAdapterManager().getAdapter(this, adapter);
* }
*
*
* This class can be used without OSGi running.
*
* Clients may subclass.
*
*
* @see Platform#getAdapterManager()
* @see IAdaptable
*/
public abstract class PlatformObject implements IAdaptable {
/**
* Constructs a new platform object.
*/
public PlatformObject() {
super();
}
/**
* Returns an object which is an instance of the given class
* associated with this object. Returns null
if
* no such object can be found.
*
* This implementation of the method declared by IAdaptable
* passes the request along to the platform's adapter manager; roughly
* Platform.getAdapterManager().getAdapter(this, adapter)
.
* Subclasses may override this method (however, if they do so, they
* should invoke the method on their superclass to ensure that the
* Platform's adapter manager is consulted).
*
*
* @param adapter the class to adapt to
* @return the adapted object or null
* @see IAdaptable#getAdapter(Class)
* @see Platform#getAdapterManager()
*/
public Object getAdapter(Class adapter) {
return AdapterManager.getDefault().getAdapter(this, adapter);
}
}