1 /*******************************************************************************
2 * Copyright (c) 2010 Association for Decentralized Information Management in
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.databoard.adapter;
14 import org.simantics.databoard.Bindings;
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).
28 * This dependes on the implementation. Cloning adapter recycles only
29 * immutable instances.
31 * @param obj source instance
33 * @throws AdaptException
35 public abstract Object adapt(Object obj)
36 throws AdaptException;
39 * Adapt instance of one binding to format of another binding.
41 * Note! adapt may recycle the argument (use it in the result).
42 * This dependes on the implementation. Cloning adapter recycles only
43 * immutable instances.
45 * @param obj source instance
47 * @throws RuntimeAdaptException
49 public abstract Object adaptUnchecked(Object obj)
50 throws RuntimeAdaptException;