001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 */
012package org.nuxeo.ecm.automation.client;
013
014/**
015 * A factory for adapters. Adapters can be used to adapt client and session objects. For example you can contribute an
016 * adapter on the session to have an API suited for your needs.
017 * <p>
018 * To register adapters use {@link AutomationClient#registerAdapter(AdapterFactory)}.
019 *
020 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
021 */
022public interface AdapterFactory<T> {
023
024    /**
025     * Adapt the given object and return the adapter instance.
026     *
027     * @param toAdapt
028     * @return
029     */
030    T getAdapter(Session session, Class<T> clazz);
031
032}