org.eclipse.actf.core.adapt
Class DefaultAdaptorFactory

java.lang.Object
  extended by org.eclipse.actf.core.adapt.DefaultAdaptorFactory
All Implemented Interfaces:
IAdaptorFactory

public class DefaultAdaptorFactory
extends Object
implements IAdaptorFactory

default implementation for creating adaptors in ACTF. Clients should subclass this implementation rather than implementing IAdaptorFactory.

Author:
Mike Squillace

Field Summary
protected static ClassLoaderCache _clCache
           
 
Constructor Summary
protected DefaultAdaptorFactory()
          create a default adaptor factory
 
Method Summary
 IAdaptor[] getAdaptors(Class type)
          retrieves the adaptors for the given type.
 IAdaptor[] getAdaptors(String className)
          retrieves the adaptors for the class name.
 IAdaptor[] getAllAdaptors(Class targetType)
          retrieves the adaptors not only for the given type but for all types of which this class is assignable.
static DefaultAdaptorFactory getInstance()
           
 void registerAdaptor(Class type, IAdaptor adaptor)
          registers an adaptor for the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_clCache

protected static final ClassLoaderCache _clCache
Constructor Detail

DefaultAdaptorFactory

protected DefaultAdaptorFactory()
create a default adaptor factory

Method Detail

getInstance

public static DefaultAdaptorFactory getInstance()

registerAdaptor

public void registerAdaptor(Class type,
                            IAdaptor adaptor)
registers an adaptor for the given type. This type should be returned by the adaptor's getSupportedTypes method.

Specified by:
registerAdaptor in interface IAdaptorFactory
Parameters:
type - - type for which adaptor is being registered
See Also:
IAdaptor.getSupportedTypes()

getAdaptors

public IAdaptor[] getAdaptors(Class type)
retrieves the adaptors for the given type. The adaptors are those that were registered via the registerAdaptor method.

Specified by:
getAdaptors in interface IAdaptorFactory
Parameters:
type - - type for which adaptors are desired
Returns:
registered adaptors for the given type or an empty array if no adaptors were registered for the given type

getAdaptors

public IAdaptor[] getAdaptors(String className)
retrieves the adaptors for the class name. The adaptors are those that were registered via the registerAdaptor method.

Specified by:
getAdaptors in interface IAdaptorFactory
Parameters:
className - - class name for which adaptors are desired
Returns:
registered adaptors for the class name or an empty array if no adaptors were registered for the given name

getAllAdaptors

public IAdaptor[] getAllAdaptors(Class targetType)
retrieves the adaptors not only for the given type but for all types of which this class is assignable. This method differs from getAdaptors in that getAdaptors returns those Adaptors only for that type while this method also tries to determine whether the class type argument is a subclass of a class type registered. For instance, a class type of org.eclipse.swt.widgets.Composite may not have any adaptors registered for it but it is a subclass of org.eclipse.swt.widgets.Control, which may have adaptors registered for it. In any case, all of the adaptors returned are those that were registered via the registerAdaptor method.

Specified by:
getAllAdaptors in interface IAdaptorFactory
Parameters:
targetType - - type for which adaptors are desired
Returns:
registered adaptors for the given type or any of it's super types, or an empty array if no adaptors were registered for the given type or any of its super types