1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.element.handler;
14 import org.simantics.g2d.element.ElementClass;
15 import org.simantics.g2d.element.ElementUtils;
16 import org.simantics.g2d.element.handler.impl.StaticObjectAdapter;
19 * This handler makes it possible to add adapters to different objects into an
20 * {@link ElementClass}. An element can have multiple Adapter handlers. For
21 * adaption, they are processed in the order of definition within the
22 * {@link ElementClass} and adaption should return the first
23 * <code>non-null</code> result returned by the any Adapter implementation.
26 * See {@link ElementUtils#adapt(org.simantics.g2d.element.IElement, Class)} for
27 * a utility that implements the above logic.
30 * @author Tuukka Lehtonen
31 * @see StaticObjectAdapter
33 public interface Adapter extends ElementHandler {
38 <T> T adapt(Class<T> toClass);