FileDocCategorySizeDatePackage
AdapterManager.javaAPI DocAndroid 1.5 API2860Wed May 06 22:41:04 BST 2009org.apache.harmony.luni.platform

AdapterManager

public final class AdapterManager extends Object implements IAdapterManager
Adapter Manager

Fields Summary
private final HashMap
factories
Constructors Summary
Methods Summary
public java.lang.ObjectgetAdapter(IAdaptable adaptable, java.lang.Class adapterType)


          
        List factoryList = factories.get(adapterType);
        if (factoryList != null) {
            for (Iterator factoryItr = factoryList.iterator(); factoryItr
                    .hasNext();) {
                IAdapterFactory factory = (IAdapterFactory) factoryItr.next();
                Object adapter = factory.getAdapter(adaptable, adapterType);
                if (adapter != null) {
                    return adapter;
                }
            }
        }
        return null;
    
public booleanhasAdapter(IAdaptable adaptable, java.lang.Class adapterType)

        return null == getAdapter(adaptable, adapterType);
    
public voidregisterAdapters(IAdapterFactory factory, java.lang.Class adaptable)

        List<IAdapterFactory> factoryList = factories.get(adaptable);
        if (factoryList == null) {
            factoryList = new ArrayList<IAdapterFactory>();
            factories.put(adaptable, factoryList);
        }
        factoryList.add(factory);
    
public voidunregisterAdapters(IAdapterFactory factory, java.lang.Class adaptable)

        List factoryList = factories.get(adaptable);
        if (factoryList != null) {
            factoryList.remove(factory);
        }
    
public voidunregisterAdapters(IAdapterFactory factory)

        for (Iterator<Class> knownAdaptablesItr = factories.keySet().iterator(); knownAdaptablesItr
                .hasNext();) {
            Class adaptable = knownAdaptablesItr.next();
            unregisterAdapters(factory, adaptable);
        }