Creates a new adapter if necessary and sets up its parameters. Override
this method to provide a custom adapter.
333833
protected void setUpAdapter() {
        if (mAdapter == null) {
            mAdapter = new SimpleMonthAdapter(getContext(), mController);
        } else {
            mAdapter.setSelectedDay(mSelectedDay);
            mAdapter.notifyDataSetChanged();
        }
        // refresh the view with the new parameters
        mAdapter.notifyDataSetChanged();
    }
1354772
public void setAdapter(PagerAdapter adapter) {
    if (mAdapter != null) {
      mAdapter.unregisterDataSetObserver(mObserver);
      mAdapter.startUpdate(this);
      mAdapter.destroyItem(this, mCurrentPosition, mCurrentFragment);
      mAdapter.finishUpdate(this);
      mCurrentPosition = 0;
    }

    mAdapter = adapter;
    mExpectedAdapterCount = 0;

    if (mAdapter != null) {
      if (mObserver == null) {
        mObserver = new PagerObserver();
      }
      mAdapter.registerDataSetObserver(mObserver);
      mPopulatePending = false;
      final boolean wasFirstLayout = mFirstLayout;
      mFirstLayout = true;
      mExpectedAdapterCount = mAdapter.getCount();
      if (mRestoredCurItem >= 0) {
        mAdapter.restoreState(mRestoredAdapterState, mRestoredClassLoader);
        setCurrentItemInternal(mRestoredCurItem, true);
        mRestoredCurItem = -1;
        mRestoredAdapterState = null;
        mRestoredClassLoader = null;
      } else if (!wasFirstLayout) {
        populate();
      } else {
        requestLayout();
      }
    }
  }
732220
function AdapterFactory(injector) {
    if (!injector.adapters) { return; }
    var me = this;

    this.adapterMap = {};
    _.each(injector.adapterMap, function (adapterName, adapterType) {
        var adapter = injector.adapters[adapterName];
        if (adapter) {
            me.adapterMap[adapterType + 'adapter'] = adapter;
        }
    });
}
779329
void initialise(@NonNull final Application application, CallbackAdapter adapter, Callback<ComapiClient> callback) {
        this.adapter = adapter;
        adapter.adapt(super.initialise(application, this, adapter), callback);
    }
1329651
def init_layout(self):
        
        parent = self.parent()
        if parent is not None:
            self.adapter = parent.adapter
            self.adapter.addFragment(self.fragment)
1162776
public void setAdapter(@NonNull ListAdapter adapter) {
    this.adapter = new MaterialSpinnerAdapterWrapper(getContext(), adapter)
        .setPopupPadding(popupPaddingLeft, popupPaddingTop, popupPaddingRight, popupPaddingBottom)
        .setBackgroundSelector(backgroundSelector)
        .setTextColor(textColor);
    setAdapterInternal(this.adapter);
  }
344849
private static Adapter tryAdapter( Class adapterClass, Object externalContext )
    {
        try
        {
            Adapter sa = ( Adapter ) adapterClass.newInstance();

            try
            {
                AdapterContext context = new AdapterContext( externalContext );
                
                if ( sa.accept( context ) )
                {
                    _log.info( "Adapter " + adapterClass.getName() + " accepted." );
                    sa.setContext( context );
                    return sa;
                }
                else
                {
                    _log.info( "Adapter " + adapterClass.getName() + " is present but did not accept." );
                }
            }
            catch ( Exception e )
            {
                _log.error( adapterClass.getName() + ".accept() threw an exception.", e );
            }
            catch ( LinkageError e )
            {
                _log.error( adapterClass.getName() + ".accept() caused a linkage error and may be out of date.", e );
            }
        }
        catch ( InstantiationException e )
        {
            _log.error( "Could not create instance of Adapter class " + adapterClass.getName(), e );
        }
        catch ( IllegalAccessException e )
        {
            _log.error( "Could not create instance of Adapter class " + adapterClass.getName(), e );
        }
        catch ( Exception e )
        {
            _log.error( "Error creating instance of Adapter class " + adapterClass.getName(), e );
        }

        return null;
    }
1248755
public void setAdapter(PagerAdapter adapter) {
        if (mAdapter != null) {
            mAdapter.unregisterDataSetObserver(mObserver);
            mAdapter.startUpdate(this);
            for (int i = 0; i < mItems.size(); i++) {
                final ItemInfo ii = mItems.get(i);
                mAdapter.destroyItem(this, ii.position, ii.object);
            }
            mAdapter.finishUpdate(this);
            mItems.clear();
            removeNonDecorViews();
            mCurItem = 0;
            scrollTo(0, 0);
        }

        final PagerAdapter oldAdapter = mAdapter;
        mAdapter = adapter;
        mExpectedAdapterCount = 0;

        if (mAdapter != null) {
            if (mObserver == null) {
                mObserver = new PagerObserver();
            }
            mAdapter.registerDataSetObserver(mObserver);
            mPopulatePending = false;
            final boolean wasFirstLayout = mFirstLayout;
            mFirstLayout = true;
            mExpectedAdapterCount = mAdapter.getCount();
            if (mRestoredCurItem >= 0) {
                mAdapter.restoreState(mRestoredAdapterState, mRestoredClassLoader);
                setCurrentItemInternal(mRestoredCurItem, false, true);
                mRestoredCurItem = -1;
                mRestoredAdapterState = null;
                mRestoredClassLoader = null;
            } else if (!wasFirstLayout) {
                populate();
            } else {
                requestLayout();
            }
        }

        if (mAdapterChangeListener != null && oldAdapter != adapter) {
            mAdapterChangeListener.onAdapterChanged(oldAdapter, adapter);
        }
    }
1045443
private void setup (XMLReader xmlReader)
    {
    if (xmlReader == null) {
        throw new NullPointerException("XMLReader must not be null");
    }
    this.xmlReader = xmlReader;
    qAtts = new AttributesAdapter();
    }
553734
function createAdapter(type) {
    var adapterConfig = adaptersConfig[type];
    if (!adapterConfig) {
        throw new Error('Adapter type ' + type + ' has not been registered.');
    }
    return new DebugAdapter(adaptersConfig[type], adaptersCwd[type]);
}
716047
function loadAdapter(type, location) {
    var options = adapterConfig[type];
    try {
        var modulePath = adapterModulePath(type, options);

        global.JuttleAdapterAPI = JuttleAdapterAPI;

        var start = new Date();

        if (!options.builtin) {
            checkCompatible(type, modulePath, location);
        }

        var init = require(modulePath);

        var loaded = new Date();
        var adapter = init(options);

        global.JuttleAdapterAPI = undefined;

        if (adapter.name !== type) {
            throw new Error('adapter name ', adapter.name, ' != type ', type);
        }
        var initialized = new Date();

        logger.debug(adapter.name, 'adapter loaded in', (loaded - start), 'ms,',
                     'initialized in', (initialized - loaded), 'ms');

        register(adapter.name, adapter);

        return adapter;
    } catch (err) {
        logger.error('error loading adapter ' + type + ': ' + err.message);
        throw err;
    }
}
185895
def adapter(adapter, options = {}, &block)
      case adapter
      when Symbol
        use(Adapters.const_get(adapter), options, &block)
      when Class
        use(adapter, options, &block)
      else
        raise ArgumentError, 'Adapter must be a Moneta store' unless adapter.respond_to?(:load) && adapter.respond_to?(:store)
        raise ArgumentError, 'No options allowed' unless options.empty?
        @proxies.unshift adapter
        nil
      end
    end
985571
def setup_custom_class(klass, required_methods: [])
      unless klass.respond_to?(*required_methods)
        raise ProxyFetcher::Exceptions::WrongCustomClass.new(klass, required_methods)
      end

      klass
    end
703836
public static Adapter<? extends RecyclerView.ViewHolder> simpleAdapter(@NonNull View view, @NonNull LayoutHelper layoutHelper) {
        return new SimpleViewAdapter(view, layoutHelper);
    }
760892
public Config createAdaptorRuntime(SchedulerStateManagerAdaptor adaptor) {
    return Config.newBuilder()
        .put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor).build();
  }
746659
def adapter
      unless @adapter_.value
        adapter = self.class.adapter_plugin_class.new
        adapter.connect! if adapter.respond_to?(:connect!)
        @adapter_.compare_and_set(nil, adapter)
        clear_cache!
      end
      @adapter_.value
    end
1029864
@Override
    public void addAppender(Appender newAppender) {
        // Null values for newAppender parameter are strictly forbidden.
        if (newAppender == null) {
            return;
        }
        // If the appender is already there, add this one to the end before
        // removing the
        // previous one
        boolean isAppenderPresent = appenderList.contains(newAppender);
        String appenderName = newAppender.getName() != null ? newAppender.getName(): "default";
        if (isAppenderPresent) {
            appenderList.add(newAppender);
            for (Iterator<Appender> it = appenderList.iterator(); it.hasNext();) {
                Appender appender = it.next();
                if (newAppender.equals(appender)) {
                    configuredAppenderList.add(appenderName);
                    it.remove();
                    appender.close();
                    return;
                }
            }
        } else {
            appenderList.add(newAppender);
        }
        configuredAppenderList.add(appenderName);
    }