1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.databoard.adapter;
14 import org.simantics.databoard.Bindings;
\r
17 * Adapter converts one java class instance to another.
19 * Use {@link Bindings#getAdapter(org.simantics.databoard.binding.Binding, org.simantics.databoard.binding.Binding)}
20 * to instantiate an adapter between bindings.
22 public interface Adapter {
25 * Adapt instance of one binding to format of another binding.
27 * Note! adapt may recycle the argument (use it in the result).
\r
28 * This dependes on the implementation. Cloning adapter recycles only
\r
29 * immutable instances.
31 * @param obj source instance
33 * @throws AdaptException
35 public abstract Object adapt(Object obj)
36 throws AdaptException;
\r
39 * Adapt instance of one binding to format of another binding.
\r
41 * Note! adapt may recycle the argument (use it in the result).
\r
42 * This dependes on the implementation. Cloning adapter recycles only
\r
43 * immutable instances.
\r
45 * @param obj source instance
\r
47 * @throws RuntimeAdaptException
\r
49 public abstract Object adaptUnchecked(Object obj)
\r
50 throws RuntimeAdaptException;
\r