]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/Adapter.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / Adapter.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.element.handler;
13
14 import org.simantics.g2d.element.ElementClass;
15 import org.simantics.g2d.element.ElementUtils;
16 import org.simantics.g2d.element.handler.impl.StaticObjectAdapter;
17
18 /**
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.
24  * 
25  * <p>
26  * See {@link ElementUtils#adapt(org.simantics.g2d.element.IElement, Class)} for
27  * a utility that implements the above logic.
28  * </p>
29  * 
30  * @author Tuukka Lehtonen
31  * @see StaticObjectAdapter
32  */
33 public interface Adapter extends ElementHandler {
34
35     /**
36      * @return
37      */
38     <T> T adapt(Class<T> toClass);
39
40 }